Sample code for 30+ languages & platforms
Lianja

RSA Import Private Key

See more RSA Examples

Shows how to select/import a private key for RSA signing or decryption.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loPrivKey = createobject("CkPrivateKey")
lcPassword = "secret"
// In all Chilkat methods expecting a path, you pass either absolute or relative paths.
llSuccess = loPrivKey.LoadAnyFormatFile("rsaKeys/myTestRsaPrivate.pem",lcPassword)
if (llSuccess = .F.) then
    ? loPrivKey.LastErrorText
    release loPrivKey
    return
endif

loRsa = createobject("CkRsa")

// Tell the RSA object to use the private key (i.e. import the private key)
loRsa.UsePrivateKey(loPrivKey)


release loPrivKey
release loRsa