Sample code for 30+ languages & platforms
Visual FoxPro

RSA Import Public Key

See more RSA Examples

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

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loPubKey
LOCAL loRsa

lnSuccess = 0

loPubKey = CreateObject('Chilkat.PublicKey')
* In all Chilkat methods expecting a path, you pass either absolute or relative paths.
lnSuccess = loPubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem")
IF (lnSuccess = 0) THEN
    ? loPubKey.LastErrorText
    RELEASE loPubKey
    CANCEL
ENDIF

loRsa = CreateObject('Chilkat.Rsa')

* Tell RSA to use the public key.
loRsa.UsePublicKey(loPubKey)

RELEASE loPubKey
RELEASE loRsa