Lianja
Lianja
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 Lianja Downloads
llSuccess = .F.
loCert = createobject("CkCert")
llSuccess = loCert.LoadFromFile("qa_data/pem/mf_public_rsa.pem")
if (llSuccess = .F.) then
? loCert.LastErrorText
release loCert
return
endif
loPubKey = createobject("CkPublicKey")
loCert.GetPublicKey(loPubKey)
loRsa = createobject("CkRsa")
loRsa.UsePublicKey(loPubKey)
loRsa.EncodingMode = "base64"
lcEncryptedStr = loRsa.EncryptStringENC("hello",.F.)
? "encrypted string = " + lcEncryptedStr
release loCert
release loPubKey
release loRsa