(Visual FoxPro) RSA Import Private Key
Shows how to select/import a private key for RSA signing or decryption.
LOCAL loPrivKey
LOCAL lcPassword
LOCAL lnSuccess
LOCAL loRsa
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.PrivateKey')
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
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Rsa')
loRsa = CreateObject('Chilkat.Rsa')
* Tell the RSA object to use the private key (i.e. import the private key)
loRsa.ImportPrivateKeyObj(loPrivKey)
RELEASE loPrivKey
RELEASE loRsa
|