PGP Decrypt File
ts
// Decrypt a file using the recipient's private key
var err = PGPDecryptFile(
"/transfer/confidential.pdf.pgp", // Encrypted input file
"/documents/confidential.pdf", // Output decrypted file
"/keys/bob.privkey" // Recipient's private key
);Decrypts a file using the recipient's PGP private key. The output is the original, decrypted file.
Parameters
| Name | Type | Description |
|---|---|---|
| inputFile | string | Path to the encrypted file |
| outputFile | string | Path for the resulting decrypted file |
| recipientPrivKey | string | Path to the recipient's private key file |
Returns
- Returns
nullon success, or an error object if decryption fails.
WARNING
The recipient's private key is required for decryption. Make sure to keep your private key secure.
Example
ts
var err = PGPDecryptFile(
"/data/budget.xlsx.pgp",
"/data/budget.xlsx",
"/keys/bob.privkey"
);
if (err == null) {
Log("File decrypted successfully!");
} else {
Log("Decryption failed: " + err);
}