Visual Basic 6.0
Visual Basic 6.0
RSA Import Public Key from Certificate PEM
See more RSA Examples
Uses a certificate's public key for RSA encryption. The public key from the certificate .pem file is used.Chilkat Visual Basic 6.0 Downloads
Dim success As Long
success = 0
Dim cert As New ChilkatCert
success = cert.LoadFromFile("qa_data/pem/mf_public_rsa.pem")
If (success = 0) Then
Debug.Print cert.LastErrorText
Exit Sub
End If
Dim pubKey As New PublicKey
success = cert.GetPublicKey(pubKey)
Dim rsa As New ChilkatRsa
success = rsa.UsePublicKey(pubKey)
rsa.EncodingMode = "base64"
Dim encryptedStr As String
encryptedStr = rsa.EncryptStringENC("hello",0)
Debug.Print "encrypted string = " & encryptedStr