PGPSignFile (create a detached signature)
ts
function PGPSignFile(
inFile: string, // required
sigFile: string, // required
pubKeyFile: string, // required
privKeyFile: string // required
): boolean;NOTE
This function is available as of Syncplify Server! v7.1.1. If you are running an older version, upgrade to v7.1.1 or later to use it.
Creates a detached PGP signature for inFile and writes it to sigFile. The signature can later be verified by a recipient who holds the corresponding public key, confirming that the file was signed by you and has not been modified.
This is distinct from encryption: the file itself is not encrypted. Only the signature file is generated.
| Parameter | Type | Requirement | Explanation |
|---|---|---|---|
inFile | string | required | Fully qualified path to the file to sign |
sigFile | string | required | Fully qualified path where the detached signature will be written |
pubKeyFile | string | required | Path to the signer's PGP public key file |
privKeyFile | string | required | Path to the signer's PGP private key file |
| Return value | Explanation |
|---|---|
true | Signature was created successfully |
false | Signing failed (missing file, invalid key, etc.) |
NOTE
The recipient verifies the signature using the signer's public key. The signer's private key is kept secret and never shared.
Example
ts
var ok = PGPSignFile(
'/var/outbox/report.csv',
'/var/outbox/report.csv.sig',
'/keys/sender.pubkey',
'/keys/sender.privkey'
);
if (ok) {
Log('File signed successfully.');
} else {
Log('Signing failed.');
}TIP
To generate a PGP key pair, use GeneratePGPKeys. To verify a signature produced by PGPSignFile, use PGPVerifyFile.
