Sample code for 30+ languages & platforms
Visual FoxPro

RSA Import Private Key

See more RSA Examples

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

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loPrivKey
LOCAL lcPassword
LOCAL loRsa

lnSuccess = 0

loPrivKey = CreateObject('Chilkat.PrivateKey')
lcPassword = "secret"
* In all Chilkat methods expecting a path, you pass either absolute or relative paths.
lnSuccess = loPrivKey.LoadAnyFormatFile("rsaKeys/myTestRsaPrivate.pem",lcPassword)
IF (lnSuccess = 0) THEN
    ? loPrivKey.LastErrorText
    RELEASE loPrivKey
    CANCEL
ENDIF

loRsa = CreateObject('Chilkat.Rsa')

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

RELEASE loPrivKey
RELEASE loRsa