Skip to content

PGP decrypt file

ts
function PGPDecryptFile(
  inFile:  string,
  outFile: string,
  pubKey:  string,
  privKey: string
): boolean;

This function decrypts a file using OpenPGP; this function accepts the following parameters:

ParameterTypeRequirementExplanation
inFilestringrequiredthis is the full path and name to the file that you wish to decrypt
outFilestringrequiredthis is the full path and name of the resulting decrypted file you wish to generate
pubKeystringrequiredthe full path and name to a file containing the recipient’s PGP public key
privKeystringrequiredthe full path and name to a file containing the recipient’s PGP private key

Possible return values:

ValueExplanation
truethe function succeeded: the file was decrypted
truethe function failed: the file was not decrypted

Example

ts
{
  PGPDecryptFile('C:\\Data\\budget.xlsx.pgp', 'C:\\Encrypted\\budget.xlsx',
    'C:\\PGPKeys\\Bob.pubkey', 'C:\\PGPKeys\\Bob.privkey');
}