AutoIt
AutoIt
Use Base64 RSA Key to Encrypt
See more RSA Examples
Loads a Base64 RSA key and uses it to encrypt a string, returning the result in base64.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oPubkey = ObjCreate("Chilkat.PublicKey")
$bSuccess = $oPubkey.LoadBase64("MIICdgIBADA ... A9PXLk+j5A==")
If ($bSuccess = False) Then
ConsoleWrite($oPubkey.LastErrorText & @CRLF)
Exit
EndIf
$oRsa = ObjCreate("Chilkat.Rsa")
$bSuccess = $oRsa.UsePublicKey($oPubkey)
If ($bSuccess = False) Then
ConsoleWrite($oRsa.LastErrorText & @CRLF)
Exit
EndIf
$oRsa.EncodingMode = "base64"
Local $sEncryptedStr = $oRsa.EncryptStringENC("12345678",False)
ConsoleWrite($sEncryptedStr & @CRLF)