Forrest logo
back to the gpg tool

gpg:tldr:24215

gpg: Create a GPG public and private key interactively.
$ gpg --full-generate-key
try on your machine

The command "gpg --full-generate-key" is used to generate a new GnuPG (GPG) key pair with advanced options.

GnuPG is a free and open-source encryption software that allows users to generate and manage cryptographic keys for secure communication and data integrity. When generating a key pair, two keys are created: a public key and a private key. The public key is used for encryption or verifying digital signatures, while the private key is kept secret and used for decryption or creating digital signatures.

The "--full-generate-key" option specifies that the user wants to generate a new key pair with advanced options. This will launch a series of prompts and settings to customize the key generation process. Here is a breakdown of the key generation steps:

  1. Key Type: The user is asked to choose the type of GPG key they want to generate, such as RSA, DSA, or ECDSA. RSA is the most commonly used key type.

  2. Key Size: The user is prompted to select the desired key size in bits. Larger key sizes offer stronger security, but also have longer encryption and decryption times. Common key sizes for RSA range from 2048 to 4096 bits.

  3. Expiration Date: The user can specify an expiration date for the key. This helps ensure that old or compromised keys are no longer used. The user can choose a specific date or set the key to never expire.

  4. Passphrase: The user is asked to enter a passphrase for the private key. This passphrase adds an additional layer of security by encrypting the private key with a password. It is recommended to choose a strong passphrase that is difficult to guess.

  5. User Information: The user provides their name, email address, and optional comment. This information is associated with the public key and can be used to identify the key owner.

After completing these steps, GnuPG will generate the key pair and store it in the local keyring. The public key can be shared with others for encryption or signature verification, while the private key should be kept secure and protected.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gpg tool