VB.NET
VB.NET
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 VB.NET Downloads
Dim success As Boolean = False
Dim cert As New Chilkat.Cert
success = cert.LoadFromFile("qa_data/pem/mf_public_rsa.pem")
If (success = False) Then
Debug.WriteLine(cert.LastErrorText)
Exit Sub
End If
Dim pubKey As New Chilkat.PublicKey
cert.GetPublicKey(pubKey)
Dim rsa As New Chilkat.Rsa
rsa.UsePublicKey(pubKey)
rsa.EncodingMode = "base64"
Dim encryptedStr As String = rsa.EncryptStringENC("hello",False)
Debug.WriteLine("encrypted string = " & encryptedStr)