To encrypt data to a specific person, you need to encrypt it with their public key. Prior to encrypting to the public key, the key must be imported to your keyring first. To get a public key onto your keyring, you must either find the public key on a keyserver or receive the public key file from the recipient and then import it onto your keyring.
To import a key to your keyring, you use the --import variable. The file containing the key(s) to be imported should be in the current directory, or you must specify the fully qualified path to the file containing the keys. Note that both private and public keys will be imported, if they exist in the file. If a key being imported already exists in the local keyring, the keys are merged.
pgp --import <keyname.asc> [options]
The following options are available with the --import variable.
- --import-format specifies the import format for the current operation. See --import-format for more information.
- --manual-import-keys changes the behavior of PGP Command Line when keys are found during import operations. The default is all.
- --manual-import-key-pairs changes the behavior of PGP Command Line when key pairs are found during an import operation.
- --passphrase is the passphrase of the key being imported.
- --new-passphrase is the new passphrase of the bundle key being imported.
- --local-user is the key ID of an existing bundle key.
- --local mode runs the operation in local mode.
pgp --import "Bob Smith.asc"