Sample code for 30+ languages & platforms
Xbase++ Requires Chilkat v11.0.0+

RSA Import Public Key

See more RSA Examples

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

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oPubKey
LOCAL oRsa

nSuccess := 0

oPubKey := CreateObject("Chilkat.PublicKey")
//  In all Chilkat methods expecting a path, you pass either absolute or relative paths.
nSuccess := oPubKey:LoadFromFile("rsaKeys/myTestRsaPublic.pem")
IF (nSuccess == 0)
    ? oPubKey:LastErrorText
    oPubKey:destroy()
    RETURN
ENDIF

oRsa := CreateObject("Chilkat.Rsa")

//  Tell RSA to use the public key.
oRsa:UsePublicKey(oPubKey)

oPubKey:destroy()
oRsa:destroy()