GeneratePGPKeys function

function GeneratePGPKeys(
  keyPairName: string,
  directory:   string,
  bits:        number  // 512, 1024, 2048, ...
): boolean

This function generates a PGP key-pair (public and private keys), and saves both keys as files in the specified directory.

The name of both files will be keyPairName; the public key’s file name will be keyPairName.pubkey, while the private key’s file name will be keyPairName.privkey.

The bits parameter is an integer number, and it must be a PGP-compatible key size; typically these are powers of 2, like 512, 1024, or 2048 (for example).

If this function succeeds, it returns true, otherwise it returns false.

Example:

{
  if (GeneratePGPKeys('testkey', 'C:\\PGPKeys', 2048)) {
    Log('Key-pair successfully generated');
  }
}