PGP Decrypt File
ts
// Decrypt a file using the recipient's private key
var ok = 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
| Return value | Explanation |
|---|---|
true | Decryption succeeded |
false | Decryption failed (file not found, invalid key, corrupt data, etc.) |
WARNING
The recipient's private key is required for decryption. Make sure to keep your private key secure and never include it directly in script source code. Use GetSecret to retrieve key paths or passphrases at runtime instead.
Example
ts
var ok = PGPDecryptFile(
"/data/budget.xlsx.pgp",
"/data/budget.xlsx",
"/keys/bob.privkey"
);
if (ok) {
Log("File decrypted successfully!");
} else {
Log("Decryption failed.");
}