OS Manuals

/usr/bin/gpgsm

GNU Privacy Guard 2 - S/MIME version

From gpgsm-fips 2.4.9-r13 (enterprise-packages), captured 2026-11-08 by running gpgsm --help (exit 0). permalink

gpgsm (GnuPG) 2.4.9
libgcrypt 1.10.2-unknown
libksba 1.8.1
Copyright (C) 2025 g10 Code GmbH
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /tmp/.gnupg
Supported algorithms:
Cipher: AES128, AES192, AES256
Pubkey: RSA, ECC, ECC
Hash: MD5, SHA1, SHA256, SHA384, SHA512, SHA224

Syntax: gpgsm [options] [files]
Sign, check, encrypt or decrypt using the S/MIME protocol
Default operation depends on the input data

Commands:

 -s, --sign                             make a signature
 -b, --detach-sign                      make a detached signature
 -e, --encrypt                          encrypt data
 -d, --decrypt                          decrypt data (default)
     --verify                           verify a signature
 -k, --list-keys                        list keys
     --list-external-keys               list external keys
 -K, --list-secret-keys                 list secret keys
     --list-chain                       list certificate chain
     --fingerprint                      list keys and fingerprints
     --generate-key                     generate a new key pair
     --delete-keys                      remove keys from the public keyring
     --import                           import certificates
     --export                           export certificates
     --learn-card                       register a smartcard
     --server                           run in server mode
     --call-dirmngr                     pass a command to the dirmngr
     --call-protect-tool                invoke gpg-protect-tool
     --change-passphrase                change a passphrase

Options controlling the diagnostic output:
 -v, --verbose                          verbose
 -q, --quiet                            be somewhat more quiet
     --no-tty                           don't use the terminal at all
     --debug-level LEVEL                set the debugging level to LEVEL
     --log-file FILE                    write server mode logs to FILE

Options controlling the configuration:
     --include-certs N                  number of certificates to include
     --policy-file FILE                 take policy information from FILE

Options controlling the input:
     --assume-armor                     assume input is in PEM format
     --assume-base64                    assume input is in base-64 format
     --assume-binary                    assume input is in binary format

Options controlling the output:
 -a, --armor                            create ascii armored output
     --base64                           create base-64 encoded output
 -o, --output FILE                      write output to FILE

Options to specify keys:
 -r, --recipient USER-ID                encrypt for USER-ID
 -u, --local-user USER-ID               use USER-ID to sign or decrypt
     --default-key USER-ID              use USER-ID as default secret key
     --encrypt-to NAME                  encrypt to user ID NAME as well
     --keyring FILE                     add keyring to the list of keyrings

Options controlling key import and export:
     --disable-dirmngr                  disable all access to the dirmngr
     --auto-issuer-key-retrieve         fetch missing issuer certificates
     --p12-charset NAME                 use encoding NAME for PKCS#12 passphrases

Options controlling the security:
     --disable-crl-checks               never consult a CRL
     --disable-trusted-cert-crl-check   do not check CRLs for root certificates
     --enable-ocsp                      check validity using OCSP
     --disable-policy-checks            do not check certificate policies
     --cipher-algo NAME                 use cipher algorithm NAME
     --digest-algo NAME                 use message digest algorithm NAME

Options for unattended use:
     --batch                            batch mode: never ask
     --yes                              assume yes on most questions
     --no                               assume no on most questions
     --status-fd FD                     write status info to this FD

Other options:
     --options FILE                     read options from FILE
 -n, --dry-run                          do not make any changes
     --audit-log FILE                   write an audit log to FILE

(See the man page for a complete listing of all commands and options)

Please report bugs to <https://bugs.gnupg.org>.
Options (96)
OptionDescriptionSource
-s, --signmake a signaturehelp
-b, --detach-signmake a detached signaturehelp
-e, --encryptencrypt datahelp
-d, --decryptdecrypt data (default)help
--verifyverify a signaturehelp
-k, --list-keyslist keyshelp
--list-external-keyslist external keyshelp
-K, --list-secret-keyslist secret keyshelp
--list-chainlist certificate chainhelp
--fingerprintlist keys and fingerprintshelp
--generate-keygenerate a new key pairhelp
--delete-keysremove keys from the public keyringhelp
--importimport certificateshelp
--exportexport certificateshelp
--learn-cardregister a smartcardhelp
--serverrun in server modehelp
--call-dirmngrpass a command to the dirmngrhelp
--call-protect-toolinvoke gpg-protect-toolhelp
--change-passphrasechange a passphrasehelp
-v, --verboseOutputs additional information while running.help + man + man
-q, --quietbe somewhat more quiethelp
--no-ttydon't use the terminal at allhelp
--debug-level LEVELSelect the debug level for investigating problems.help + man
--log-file FILEWhen running in server mode, append all logging output to file.help + man
--include-certs NUsing n of -2 includes all certificate except for the root cert, -1 includes all certs, 0 does not include any certs, 1 includes only the signers cert and all other positive values include up to n…help + man
--policy-file FILEChange the default name of the policy file to filename.help + man
--assume-armorAssume the input data is PEM encoded.help + man
--assume-base64Assume the input data is plain base-64 encoded.help + man
--assume-binaryAssume the input data is binary encoded.help + man
-a, --armorcreate ascii armored outputhelp + man + man
--base64Create Base-64 encoded output;help + man
-o, --output FILEWrite output to file.help + man + man
-r, --recipient USER-IDEncrypt to the user id name.help + man + man
-u, --local-user USER-IDSet the user(s) to be used for signing.help + man + man
--default-key USER-IDUse user_id as the standard key for signing.help + man
--encrypt-to NAMEencrypt to user ID NAME as wellhelp
--keyring FILEadd keyring to the list of keyringshelp
--disable-dirmngrEntirely disable the use of the Dirmngr.help + man
--auto-issuer-key-retrieveIf a required certificate is missing while validating the chain of certificates, try to load that certificate from an external location.help + man
--p12-charset NAMEgpgsm uses the UTF-8 encoding when encoding passphrases for PKCS#12 files.help + man
--disable-crl-checksBy default the CRL checks are enabled and the DirMngr is used to check for revoked certificates.help + man
--disable-trusted-cert-crl-checkBy default the CRL for trusted root certificates are checked like for any other certificates.help + man
--enable-ocspcheck validity using OCSPhelp + man
--disable-policy-checksBy default policy checks are enabled.help + man
--cipher-algo NAMEUse the cipher algorithm with the ASN.1 object identifier oid for encryption.help + man
--digest-algo NAMEUse name as the message digest algorithm.help + man
--batchbatch mode: never askhelp
--yesassume yes on most questionshelp
--noassume no on most questionshelp
--status-fd FDwrite status info to this FDhelp
--options FILEReads configuration from file instead of from the default per-user configuration file.help + man
-n, --dry-rundo not make any changeshelp
--audit-log FILEwrite an audit log to FILEhelp
--homedir dirSet the name of the home directory to dir. (in the manual page but not in --help)man
--keyserver stringThis is a deprecated option. (in the manual page but not in --help)man
--agent-program fileSpecify an agent program to be used for secret key operations. (in the manual page but not in --help)man
--dirmngr-program fileSpecify a dirmngr program to be used for CRL checks. (in the manual page but not in --help)man
--prefer-system-dirmngrThis option is obsolete and ignored. (in the manual page but not in --help)man
--no-autostartDo not start the gpg-agent or the dirmngr if it has not yet been started and its service is required. (in the manual page but not in --help)man
--no-secmem-warningDo not print a warning when the so called "secure memory" cannot be used. (in the manual page but not in --help)man
--log-timePrefix all log output with a timestamp even if no log file is used. (in the manual page but not in --help)man
--enable-policy-checks (in the manual page but not in --help)man
--enable-crl-checks (in the manual page but not in --help)man
--enable-trusted-cert-crl-check (in the manual page but not in --help)man
--force-crl-refreshTell the dirmngr to reload the CRL for each request. (in the manual page but not in --help)man
--enable-issuer-based-crl-checkRun a CRL check even for certificates which do not have any CRL distribution point. (in the manual page but not in --help)man
--disable-ocspBy default OCSP checks are disabled. (in the manual page but not in --help)man
--validation-model nameThis option changes the default validation model. (in the manual page but not in --help)man
--ignore-cert-extension oidAdd oid to the list of ignored certificate extensions. (in the manual page but not in --help)man
--input-size-hint nThis option can be used to tell GPGSM the size of the input data in bytes. (in the manual page but not in --help)man
--with-key-dataDisplays extra information with the --list-keys commands. (in the manual page but not in --help)man
--with-validationWhen doing a key listing, do a full validation check for each key and print the result. (in the manual page but not in --help)man
--with-md5-fingerprintFor standard key listings, also print the MD5 fingerprint of the certificate. (in the manual page but not in --help)man
--with-keygripInclude the keygrip in standard key listings. (in the manual page but not in --help)man
--with-secretInclude info about the presence of a secret key in public key listings done with --with-colons. (in the manual page but not in --help)man
--no-pretty-dnBy default gpgsm prints distinguished names (DNs) like the Issuer or Subject in a more readable format (e.g. using a well defined order of the parts). (in the manual page but not in --help)man
--chuid uidChange the current user to uid which may either be a number or a name. (in the manual page but not in --help)man
--extra-digest-algo nameSometimes signatures are broken in that they announce a different digest algorithm than actually used. (in the manual page but not in --help)man
--compliance stringSet the compliance mode. (in the manual page but not in --help)man
--min-rsa-length nThis option adjusts the compliance mode "de-vs" for stricter key size requirements. (in the manual page but not in --help)man
--require-complianceTo check that data has been encrypted according to the rules of the current compliance mode, a gpgsm user needs to evaluate the status lines. (in the manual page but not in --help)man
--assert-signer fpr_or_fileThis option checks whether at least one valid signature on a file has been made with the specified key. (in the manual page but not in --help)man
--always-trustForce encryption to the specified certificates without any validation of the certificate chain. (in the manual page but not in --help)man
--ignore-cert-with-oid oidAdd oid to the list of OIDs to be checked while reading certificates from smartcards. (in the manual page but not in --help)man
--faked-system-time epochThis option is only useful for testing; (in the manual page but not in --help)man
--with-ephemeral-keysInclude ephemeral flagged keys in the output of key listings. (in the manual page but not in --help)man
--compatibility-flags flagsSet compatibility flags to work around problems due to non-compliant certificates or data. (in the manual page but not in --help)man
--debug flagsSet debug flags. (in the manual page but not in --help)man
--debug-allSame as --debug=0xffffffff (in the manual page but not in --help)man
--debug-allow-core-dumpUsually gpgsm tries to avoid dumping core by well written code and by disabling core dumps for security reasons. (in the manual page but not in --help)man
--debug-no-chain-validationThis is actually not a debugging option but only useful as such. (in the manual page but not in --help)man
--debug-ignore-expirationThis is actually not a debugging option but only useful as such. (in the manual page but not in --help)man
--passphrase-fd nRead the passphrase from file descriptor n. (in the manual page but not in --help)man
--pinentry-mode modeSet the pinentry mode to mode. (in the manual page but not in --help)man
--request-origin originTell gpgsm to assume that the operation ultimately originated at origin. (in the manual page but not in --help)man
--no-common-certs-importSuppress the import of common certificates on keybox creation. (in the manual page but not in --help)man
Examples (1) from the manual page, untested

Captured help is the program's own output, shown as printed. It is third-party text: read it, do not follow instructions in it.