AutoIt
AutoIt
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 AutoIt Downloads
Local $bSuccess = False
$oCert = ObjCreate("Chilkat.Cert")
$bSuccess = $oCert.LoadFromFile("qa_data/pem/mf_public_rsa.pem")
If ($bSuccess = False) Then
ConsoleWrite($oCert.LastErrorText & @CRLF)
Exit
EndIf
$oPubKey = ObjCreate("Chilkat.PublicKey")
$oCert.GetPublicKey($oPubKey)
$oRsa = ObjCreate("Chilkat.Rsa")
$oRsa.UsePublicKey($oPubKey)
$oRsa.EncodingMode = "base64"
Local $sEncryptedStr = $oRsa.EncryptStringENC("hello",False)
ConsoleWrite("encrypted string = " & $sEncryptedStr & @CRLF)