3.1 User Commands

At this time you can use some cryptographic commands. The behavior of these commands relies on a fashion of invocation because they are also intended to be used as library functions. In case you don’t have the signer’s public key, for example, the function pgg-verify-region fails immediately, but if the function had been called interactively, it would ask you to retrieve the signer’s public key from the server.

Command: pgg-encrypt-region start end recipients &optional sign passphrase

Encrypt the current region between start and end for recipients. When the function were called interactively, you would be asked about the recipients.

If encryption is successful, it replaces the current region contents (in the accessible portion) with the resulting data.

If optional argument sign is non-nil, the function is request to do a combined sign and encrypt. This currently is confirmed to work with GnuPG, but might not work with PGP or PGP5.

If optional passphrase is nil, the passphrase will be obtained from the passphrase cache or user.

Command: pgg-encrypt-symmetric-region &optional start end passphrase

Encrypt the current region between start and end using a symmetric cipher. After invocation you are asked for a passphrase.

If optional passphrase is nil, the passphrase will be obtained from the passphrase cache or user.

symmetric-cipher encryption is currently only implemented for GnuPG.

Command: pgg-decrypt-region start end &optional passphrase

Decrypt the current region between start and end. If decryption is successful, it replaces the current region contents (in the accessible portion) with the resulting data.

If optional passphrase is nil, the passphrase will be obtained from the passphrase cache or user.

Command: pgg-sign-region start end &optional cleartext passphrase

Make the signature from text between start and end. If the optional third argument cleartext is non-nil, or the function is called interactively, it does not create a detached signature. In such a case, it replaces the current region contents (in the accessible portion) with the resulting data.

If optional passphrase is nil, the passphrase will be obtained from the passphrase cache or user.

Command: pgg-verify-region start end &optional signature fetch

Verify the current region between start and end. If the optional third argument signature is non-nil, it is treated as the detached signature file of the current region.

If the optional 4th argument fetch is non-nil, or the function is called interactively, we attempt to fetch the signer’s public key from the key server.

Command: pgg-insert-key

Retrieve the user’s public key and insert it as ASCII-armored format.

Command: pgg-snarf-keys-region start end

Collect public keys in the current region between start and end, and add them into the user’s keyring.