myPKEModule := STD.Crypto.PublicKeyEncryption(pkAlgorithm, publicKeyFile, privateKeyFile, passphrase);
myPKEModule | The name of the Public Key Encryption module structure |
pkAlgorithm | The algorithm to use, as returned by SupportedPublicKeyAlgorithms() |
publicKeyFile | The File Specification of the PEM formatted Public Key file |
privateKeyFile | The File Specification of the PEM formatted Private Key file |
passphrase | The passphrase to use for encryption, decryption, signing, verifying |
A Public Key Encryption module is defined in ECL. Subsequent function definitions use the options defined in the Public Key Encryption module to perform asymmetric encryption/decryption/digital signing/signature verification.
Example:
IMPORT STD; privKeyFile := '/var/lib/HPCCSystems/myesp/test.key'; pubKeyFile := '/var/lib/HPCCSystems/myesp/test.key.pub'; //PKE Encryption module definition myPKEModule := STD.Crypto.PublicKeyEncryption('RSA', pubKeyFile, privKeyFile,''); DATA encrypted := myPKEModule.Encrypt((DATA)'The quick brown fox jumps over the lazy dog'); OUTPUT( (STRING)myPKEModule.Decrypt(encrypted) );