Sample code for 30+ languages & platforms
VBScript

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

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

set rsa = CreateObject("Chilkat.Rsa")

' Tell RSA to use the public key.
success = rsa.UsePublicKey(pubKey)

outFile.Close