(VBScript) RSA Import Public Key
Shows how to select/import a public key for RSA encryption or signature verification.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.PublicKey")
set pubKey = CreateObject("Chilkat.PublicKey")
' In all Chilkat methods expecting a path, you pass either absolute or relative paths.
success = pubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem")
If (success = 0) Then
outFile.WriteLine(pubKey.LastErrorText)
WScript.Quit
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Rsa")
set rsa = CreateObject("Chilkat.Rsa")
' Tell RSA to use the public key.
success = rsa.ImportPublicKeyObj(pubKey)
outFile.Close
|