<< back to sysax.com Product page

12.3. Keyrings and key management

Public and private key files used for OpenPGP encryption and decryption are stored in keyring files. The Sysax FTP Automation program maintains a default keyring. When a keyring file name is not explicitly specified, the default keyring is used. The -pgexportpublickey option is used to export a public key and the -pgpexportprivatekey option is used to export a private key.

Exhibit 12.3. Syntax of commands for exporting public and private keys

sysaxftp.exe -pgpexportpubkey <username or email> -pgpkeyout <output filename> [-pgpkeyring <keyring file name>]

sysaxftp.exe -pgpexportprivkey <username or email> -pgpkeyout <output filename> [-pgpkeyring <keyring file name>]

Exhibit 12.4. Examples for using the commands for exporting public and private keys

sysaxftp.exe -pgpexportpubkey john.doe -pgpkeyout keyout.pub -pgpkeyring mykeyring.pgp    #export public key for user john.doe from mykeyring.pgp

sysaxftp.exe -pgpexportprivkey john.doe -pgpkeyout keyout.priv    #export private key for user john.doe from default keyring

The -pgpimportpubkey option is used to import a previously exported public key or a public key from a user to whom a file or message needs to be sent. The -pgpimportprivatekey option is used to import a previously exported private key.

Exhibit 12.5. Syntax of commands for importing public and private keys

sysaxftp.exe -pgpimportpubkey <public key filename> [-pgpkeyring <keyring file name>]

sysaxftp.exe -pgpimportprivkey <private key filename> [-pgpkeyring <keyring file name>]

Exhibit 12.6. Examples for using the commands for importing public and private keys

sysaxftp.exe -pgpimportpubkey key.pub -pgpkeyring mykeyring.pgp    #import public key from key.pub to mykeyring.pgp

sysaxftp.exe -pgpimportprivkey key.priv   #import private key from key.priv to default keyring

The -pgplistkeys option is used to list the contents of the default public and private keyring or a specific keyring file that is specified.

Exhibit 12.7. Syntax of command for listing keyring contents

sysaxftp.exe -pgplistkeys [-pgpkeyring <keyring file name>]

Exhibit 12.8. Examples for using the command for listing keyring contents

sysaxftp.exe -pgplistkeys    #list contents of the default public and private keyring

sysaxftp.exe -pgplistkeys -pgpkeyring mykeyring.pgp   #list contents of mykeyring.pgp keyring

The pgpexportpubkey and pgpexportprivkey commands can be used to export public and private keys from within a script.

The pgpresult predefined status flag is set to the predefined constant success if the corresponding command completed successfully.

Exhibit 12.9. Syntax of commands for keyrings and key management

pgpexportpubkey <username or email>, <output filename>, [<optional keyring file>];

pgpexportprivkey <username or email>, <output filename>, [<optional keyring file>];

Exhibit 12.10. Examples for using the commands for keyrings and key management

pgpexportpubkey "john.doe", "keyout.pub", "mykeyring.pgp";    #export public key for user john.doe from mykeyring.pgp

pgpexportprivkey "john.doe", "keyout.priv";    #export private key for user john.doe from default keyring

The pgpimportpubkey and pgpimportprivkey commands can be used to import public and private keys from within a script.

The pgpresult predefined status flag is set to the predefined constant success if the corresponding command completed successfully.

Exhibit 12.11. Syntax of commands for keyrings and key management

pgpimportpubkey <key file to import>, [<optional keyring file>];

pgpimportprivkey <key file to import>, [<optional keyring file>];

Exhibit 12.12. Examples for using the commands for keyrings and key management

pgpimportpubkey "key.pub", "mykeyring.pgp";    #import public key from key.pub to mykeyring.pgp

pgpimportprivkey "key.priv";    #import private key from key.priv to default keyring