

It generates a random AES key // to use for the encryption.ĬkCrypt2_putCryptAlgorithm(crypt, 'aes')
DECRYPT FILE DELPHI CODE
This is the code your counterpart will run to // AES encrypt a file. Other methods exist for saving the private key in PKCS8 format, // both encrypted and un-encrypted. Success := CkPrivateKey_SavePemFile(privKey, 'qa_temp/privKey.pem')

Success := CkPrivateKey_LoadXml(privKey,privKeyXml) PrivKeyXml := CkRsa_exportPrivateKey(rsa) Success := CkPublicKey_SavePemFile(pubKey, False, 'qa_temp/pubKey.pem') For brevity, we are not checking the return value. Success := CkPublicKey_LoadFromString(pubKey,pubKeyXml) Generate an RSA key and save to PEM files. See Global Unlock Sample for sample code. Procedure TForm1.Button1Click(Sender: TObject) īegin // This example assumes the Chilkat API to have been previously unlocked. Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, PrivateKey, Rsa, PublicKey, Crypt2 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, * The examples here use the non-ActiveX DLL.

(5) Use it to AES decrypt the file or data. (2) Encrypt a file using a randomly generated AES encryption key. (1) Generate an RSA key and save both private and public parts to PEM files. This example will show the entire process. You decrypt the key, then decrypt the data using the AES key. Since you are the only one with access to the RSA private key, only you can decrypt the AES key. Your counterpart sends you both the encrypted data and the encrypted key. Your counterpart will generate an AES key, encrypt data (or a file) using it, then encrypt the AES key using your RSA public key. It can be used in this scenario: You will provide your RSA public key to any number of counterparts.
DECRYPT FILE DELPHI HOW TO
Demonstrates how to use RSA to protect a key for AES encryption.
