<< back to sysax.com Product page

12.5. Decrypting OpenPGP encrypted files

The sysaxftp.exe program can be used to decrypt files using the -pgpdecrypt option. If a keyring file name is not explicitly specified, the default keyring is used to obtain the private key used for decryption.

Exhibit 12.21. Syntax of command for decrypting openPGP encrypted files

sysaxftp.exe -pgpdecrypt <encrypted file> -passphrase <private key passphrase> [-pgpout <output filename>] [-pgpkeyring <keyring file name>]

Exhibit 12.22. Examples for using the command for decrypting openPGP encrypted files

sysaxftp.exe -pgpdecrypt encrypted.pgp -passphrase mypass; #decrypt encrypted.pgp using private key of user jane.doe

sysaxftp.exe -pgpdecrypt encrypted.pgp -passphrase mypass -pgpout myfile.txt -pgpkeyring mykeyring.pgp ; #decrypt encrypted.pgp to myfile.txt using private key from mykeyring.pgp

The pgpdecrypt command can be used to decrypt files from within a script. The pgpresult predefined status flag is set to the predefined constant success if the corresponding command completed successfully. If an empty string is passed in for the output filename, it will be derived from the encrypted input file.

Exhibit 12.23. Syntax of command for decrypting openPGP encrypted files

pgpdecrypt <file to decrypt>, <private key passphrase>, <output filename>, [<keyring file name>];

Exhibit 12.24. Examples for using the command for decrypting openPGP encrypted files

pgpdecrypt "encrypted.pgp", "mypass", "myfile.txt";  #decrypt encrypted.pgp to myfile.txt using the private key for user jane.doe

pgpdecrypt "encrypted.pgp", "mypass", "";  #decrypt encrypted.pgp to encrypted.txt using the private key for user jane.doe

pgpdecrypt "encrypted.pgp", "mypass", "myfile.txt", "mykeyring.pgp";  #decrypt encrypted.pgp using the private key from mykeyring.pgp