Skip to main content

Veritran Docs

[en] GPG Commands

[en] You can run GPG commands to securely import private keys and generate RSA key pairs, allowing you to manage encryption and digital signatures effectively. See a list of possible commands below.

[en] Import a private key to the keyring
gpg --batch --pinentry-mode loopback --import gpg_test_private_sec.asc 

[en] Note that --batch avoids the need for a passphrase, while --pinentry-mode loopback avoids the no-pinentry error. This command allows you to explicitly ask the user for the passphrase without having a pinentry associated to the system.

[en] Generate keys

[en] The following command generates a pair of RSA keys, public and private, which are saved to the keyring.

gpg --pinentry-mode=loopback --default-new-key-algo rsa4096 --gen-key

[en] If the error "Unusable public key" appears, check if you generated the key using GPG version 2.1.17 or higher. If so, instead of --gen-key, use --full-generate-key below to generate a pair of RSA keys, public and private.

gpg --pinentry-mode=loopback --full-generate-key 

[en] Use the following command to export the key from the keyring into a file.

gpg --pinentry-mode loopback --output exportedProvateAndPublicKey.asc --armor --export-secret-keys YOUR_UID_KEY_HERE