1GPGSM(1)                     GNU Privacy Guard 2.4                    GPGSM(1)
2
3
4

NAME

6       gpgsm - CMS encryption and signing tool
7

SYNOPSIS

9       gpgsm [--homedir dir] [--options file] [options] command [args]
10
11
12

DESCRIPTION

14       gpgsm  is a tool similar to gpg to provide digital encryption and sign‐
15       ing services on X.509 certificates and the CMS protocol.  It is  mainly
16       used  as  a  backend for S/MIME mail processing.  gpgsm includes a full
17       featured certificate management and complies with all rules defined for
18       the German Sphinx project.
19
20
21
22
23

COMMANDS

25       Commands  are  not  distinguished from options except for the fact that
26       only one command is allowed.
27
28
29
30
31
32   Commands not specific to the function
33
34
35
36       --version
37              Print the program version and licensing information.  Note  that
38              you cannot abbreviate this command.
39
40
41       --help, -h
42              Print  a  usage message summarizing the most useful command-line
43              options.  Note that you cannot abbreviate this command.
44
45
46       --warranty
47              Print warranty information.  Note  that  you  cannot  abbreviate
48              this command.
49
50
51       --dump-options
52              Print  a  list of all available options and commands.  Note that
53              you cannot abbreviate this command.
54
55   Commands to select the type of operation
56
57
58
59       --encrypt
60              Perform an encryption.  The keys the data is encrypted  to  must
61              be set using the option --recipient.
62
63
64       --decrypt
65              Perform  a decryption; the type of input is automatically deter‐
66              mined.  It may either be in binary form or  PEM  encoded;  auto‐
67              matic determination of base-64 encoding is not done.
68
69
70       --sign Create a digital signature.  The key used is either the fist one
71              found in the keybox or those set with the --local-user option.
72
73
74       --verify
75              Check a signature file for validity.  Depending on the arguments
76              a detached signature may also be checked.
77
78
79       --server
80              Run in server mode and wait for commands on the stdin.
81
82
83       --call-dirmngr command [args]
84              Behave  as a Dirmngr client issuing the request command with the
85              optional list of args.  The output of  the  Dirmngr  is  printed
86              stdout.   Please  note that file names given as arguments should
87              have an absolute file name (i.e. commencing with /) because they
88              are  passed verbatim to the Dirmngr and the working directory of
89              the Dirmngr might not be the same as the  one  of  this  client.
90              Currently it is not possible to pass data via stdin to the Dirm‐
91              ngr.  command should not contain spaces.
92
93              This is command is required for certain maintaining tasks of the
94              dirmngr where a dirmngr must be able to call back to gpgsm.  See
95              the Dirmngr manual for details.
96
97
98       --call-protect-tool arguments
99              Certain maintenance operations are done by an  external  program
100              call gpg-protect-tool; this is usually not installed in a direc‐
101              tory listed in the PATH variable.  This command provides a  sim‐
102              ple  wrapper to access this tool.  arguments are passed verbatim
103              to this command; use ‘--help’ to get a list of supported  opera‐
104              tions.
105
106
107
108   How to manage the certificates and keys
109
110
111
112       --generate-key
113       --gen-key
114              This  command  allows  the creation of a certificate signing re‐
115              quest or a self-signed certificate.  It is commonly  used  along
116              with  the --output option to save the created CSR or certificate
117              into a file.  If used with the --batch a parameter file is  used
118              to  create  the CSR or certificate and it is further possible to
119              create non-self-signed certificates.
120
121
122       --list-keys
123       -k     List all available certificates stored in the  local  key  data‐
124              base.   Note  that  the  displayed data might be reformatted for
125              better human readability and illegal characters are replaced  by
126              safe substitutes.
127
128
129       --list-secret-keys
130       -K     List  all available certificates for which a corresponding a se‐
131              cret key is available.
132
133
134       --list-external-keys pattern
135              List certificates matching pattern  using  an  external  server.
136              This utilizes the dirmngr service.
137
138
139       --list-chain
140              Same  as  --list-keys  but  also  prints  all keys making up the
141              chain.
142
143
144
145       --dump-cert
146       --dump-keys
147              List all available certificates stored in the local key database
148              using a format useful mainly for debugging.
149
150
151       --dump-chain
152              Same  as  --dump-keys  but  also  prints  all keys making up the
153              chain.
154
155
156       --dump-secret-keys
157              List all available certificates for which a corresponding a  se‐
158              cret  key  is  available using a format useful mainly for debug‐
159              ging.
160
161
162       --dump-external-keys pattern
163              List certificates matching pattern  using  an  external  server.
164              This  utilizes  the  dirmngr  service.   It uses a format useful
165              mainly for debugging.
166
167
168       --show-certs [files]
169              This command takes certificate files as input and prints  infor‐
170              mation  about them in the same format as --dump-cert does.  Each
171              file may either contain a single binary certificate  or  several
172              PEM  encoded  certificates.  If no files are given, the input is
173              taken from stdin.
174
175              Please note that the listing format may be changed in future re‐
176              leases  and  that  the option --with-colons has currently no ef‐
177              fect.
178
179
180
181       --keydb-clear-some-cert-flags
182              This is a debugging aid to reset certain flags in the key  data‐
183              base  which  are used to cache certain certificate statuses.  It
184              is especially useful if a bad CRL or a weird  running  OCSP  re‐
185              sponder  did accidentally revoke certificate.  There is no secu‐
186              rity issue with this command because gpgsm always make sure that
187              the  validity  of  a  certificate  is checked right before it is
188              used.
189
190
191       --delete-keys pattern
192              Delete the keys matching pattern.  Note that there is no command
193              to delete the secret part of the key directly.  In case you need
194              to do this, you should run the command gpgsm  --dump-secret-keys
195              KEYID  before  you delete the key, copy the string of hex-digits
196              in the ``keygrip'' line and delete the file consisting of  these
197              hex-digits  and the suffix .key from the ‘private-keys-v1.d’ di‐
198              rectory below our GnuPG home directory (usually ‘~/.gnupg’).
199
200
201       --export [pattern]
202              Export all certificates stored in the Keybox or those  specified
203              by the optional pattern. Those pattern consist of a list of user
204              ids (see: [how-to-specify-a-user-id]).  When used along with the
205              --armor  option  a  few informational lines are prepended before
206              each block.  There is one limitation: As there  is  no  commonly
207              agreed  upon way to pack more than one certificate into an ASN.1
208              structure, the binary export (i.e. without  using  armor)  works
209              only  for the export of one certificate.  Thus it is required to
210              specify  a  pattern  which  yields  exactly   one   certificate.
211              Ephemeral certificate are only exported if all pattern are given
212              as fingerprints or keygrips.
213
214
215       --export-secret-key-p12 key-id
216              Export the private key and the certificate identified by  key-id
217              using  the  PKCS#12 format.  When used with the --armor option a
218              few informational lines are prepended to the output.  Note, that
219              the PKCS#12 format is not very secure and proper transport secu‐
220              rity should be used to convey the exported key.   (See:  [option
221              --p12-charset].)
222
223
224       --export-secret-key-p8 key-id
225       --export-secret-key-raw key-id
226              Export  the  private key of the certificate identified by key-id
227              with any encryption stripped.  The ...-raw  command  exports  in
228              PKCS#1  format;  the  ...-p8  command  exports in PKCS#8 format.
229              When used with the --armor option a few informational lines  are
230              prepended to the output.  These commands are useful to prepare a
231              key for use on a TLS server.
232
233
234       --import [files]
235              Import the certificates from the PEM or binary encoded files  as
236              well  as  from  signed-only  messages.  This command may also be
237              used to import a secret key from a PKCS#12 file.
238
239
240       --learn-card
241              Read information about the private keys from the  smartcard  and
242              import  the  certificates from there.  This command utilizes the
243              gpg-agent and in turn the scdaemon.
244
245
246       --change-passphrase user_id
247       --passwd user_id
248              Change the passphrase of the private key belonging to  the  cer‐
249              tificate   specified   as  user_id.   Note,  that  changing  the
250              passphrase/PIN of a smartcard is not yet supported.
251
252

OPTIONS

254       GPGSM features a bunch of options to control the exact behaviour and to
255       change the default configuration.
256
257
258
259
260
261   How to change the configuration
262
263
264       These  options  are  used  to  change the configuration and are usually
265       found in the option file.
266
267
268
269
270       --options file
271              Reads configuration from file instead of from the  default  per-
272              user  configuration  file.   The  default  configuration file is
273              named ‘gpgsm.conf’ and expected in the  ‘.gnupg’  directory  di‐
274              rectly below the home directory of the user.
275
276
277       --homedir dir
278              Set the name of the home directory to dir. If this option is not
279              used, the home directory defaults to  ‘~/.gnupg’.   It  is  only
280              recognized  when  given  on the command line.  It also overrides
281              any home  directory  stated  through  the  environment  variable
282GNUPGHOME’ or (on Windows systems) by means of the Registry en‐
283              try HKCU\Software\GNU\GnuPG:HomeDir.
284
285              On Windows systems it is possible to install GnuPG as a portable
286              application.  In this case only this command line option is con‐
287              sidered, all other ways to set a home directory are ignored.
288
289              To install GnuPG as a portable application under Windows, create
290              an  empty  file named ‘gpgconf.ctl’ in the same directory as the
291              tool ‘gpgconf.exe’.  The root of the installation is  then  that
292              directory;  or, if ‘gpgconf.exe’ has been installed directly be‐
293              low a directory named ‘bin’, its  parent  directory.   You  also
294              need  to  make sure that the following directories exist and are
295              writable:    ‘ROOT/home’    for    the    GnuPG     home     and
296ROOT/var/cache/gnupg’ for internal cache files.
297
298
299
300       -v
301
302       --verbose
303              Outputs  additional information while running.  You can increase
304              the verbosity by giving several verbose commands to gpgsm,  such
305              as ‘-vv’.
306
307
308       --keyserver string
309              This  is a deprecated option.  It was used to add an LDAP server
310              to  use  for  X.509  certificate  and  CRL  lookup.   The  alias
311              --ldapserver  existed from version 2.2.28 to 2.2.33 and 2.3.2 to
312              2.3.4 but is now entirely ignored.
313
314              LDAP servers must be given in the configuration for dirmngr.
315
316
317       --policy-file filename
318              Change the default name of the policy file to filename.  The de‐
319              fault name is ‘policies.txt’.
320
321
322       --agent-program file
323              Specify  an  agent program to be used for secret key operations.
324              The default value is determined by running the command  gpgconf.
325              Note  that  the  pipe  symbol  (|) is used for a regression test
326              suite hack and may thus not be used in the file name.
327
328
329       --dirmngr-program file
330              Specify a dirmngr program to be used for CRL  checks.   The  de‐
331              fault value is ‘/usr/bin/dirmngr’.
332
333
334       --prefer-system-dirmngr
335              This option is obsolete and ignored.
336
337
338       --disable-dirmngr
339              Entirely disable the use of the Dirmngr.
340
341
342       --no-autostart
343              Do not start the gpg-agent or the dirmngr if it has not yet been
344              started and its service is required.  This option is mostly use‐
345              ful on machines where the connection to gpg-agent has been redi‐
346              rected to another machines.  If dirmngr is required on  the  re‐
347              mote  machine, it may be started manually using gpgconf --launch
348              dirmngr.
349
350
351       --no-secmem-warning
352              Do not print a warning when the so called "secure memory" cannot
353              be used.
354
355
356       --log-file file
357              When  running in server mode, append all logging output to file.
358              Use ‘socket://’ to log to socket.
359
360
361       --log-time
362              Prefix all log output with a timestamp even if no  log  file  is
363              used.
364
365
366   Certificate related options
367
368
369
370
371       --enable-policy-checks
372       --disable-policy-checks
373              By default policy checks are enabled.  These options may be used
374              to change it.
375
376
377       --enable-crl-checks
378       --disable-crl-checks
379              By default the CRL checks are enabled and the DirMngr is used to
380              check for revoked certificates.  The disable option is most use‐
381              ful with an off-line network connection to suppress  this  check
382              and  also  to avoid that new certificates introduce a web bug by
383              including a certificate specific CRL  DP.   The  disable  option
384              also  disables an issuer certificate lookup via the authorityIn‐
385              foAccess property of the certificate;  the  --enable-issuer-key-
386              retrieve can be used to make use of that property anyway.
387
388
389       --enable-trusted-cert-crl-check
390       --disable-trusted-cert-crl-check
391              By  default  the  CRL  for trusted root certificates are checked
392              like for any other certificates.  This allows a CA to revoke its
393              own  certificates voluntary without the need of putting all ever
394              issued certificates into a CRL.  The disable option may be  used
395              to  switch this extra check off.  Due to the caching done by the
396              Dirmngr, there will not  be  any  noticeable  performance  gain.
397              Note,  that  this also disables possible OCSP checks for trusted
398              root certificates.  A more specific way of disabling this  check
399              is  by  adding  the ``relax'' keyword to the root CA line of the
400trustlist.txt
401
402
403
404       --force-crl-refresh
405              Tell the dirmngr to reload the CRL for each request.  For better
406              performance,  the  dirmngr  will  actually optimize this by sup‐
407              pressing the loading for short time intervals (e.g. 30 minutes).
408              This option is useful to make sure that a fresh CRL is available
409              for certificates hold in the keybox.  The suggested way of doing
410              this  is by using it along with the option --with-validation for
411              a key listing command.  This option should not be used in a con‐
412              figuration file.
413
414
415       --enable-issuer-based-crl-check
416              Run  a CRL check even for certificates which do not have any CRL
417              distribution point.  This requires that a suitable  LDAP  server
418              has been configured in Dirmngr and that the CRL can be found us‐
419              ing the issuer.  This option reverts to what  GnuPG  did  up  to
420              version 2.2.20.  This option is in general not useful.
421
422
423       --enable-ocsp
424       --disable-ocsp
425              By  default  OCSP checks are disabled.  The enable option may be
426              used to enable OCSP checks via Dirmngr.  If CRL checks are  also
427              enabled,  CRLs  will be used as a fallback if for some reason an
428              OCSP request will not succeed.  Note, that  you  have  to  allow
429              OCSP  requests  in  Dirmngr's configuration too (option --allow-
430              ocsp) and configure Dirmngr properly.  If you do not do  so  you
431              will get the error code ‘Not supported’.
432
433
434       --auto-issuer-key-retrieve
435              If  a required certificate is missing while validating the chain
436              of certificates, try to load that certificate from  an  external
437              location.  This usually means that Dirmngr is employed to search
438              for the certificate.  Note that this option makes  a  "web  bug"
439              like  behavior  possible.   LDAP  server operators can see which
440              keys you request, so by sending you a message signed by a  brand
441              new  key  (which  you naturally will not have on your local key‐
442              box), the operator can tell both your IP address  and  the  time
443              when  you  verified the signature.  Note that if CRL checking is
444              not disabled issuer certificates are retrieved in any case using
445              the caIssuers authorityInfoAccess method.
446
447
448
449
450       --validation-model name
451              This option changes the default validation model.  The only pos‐
452              sible values are "shell" (which is the default),  "chain"  which
453              forces  the use of the chain model and "steed" for a new simpli‐
454              fied model.  The chain model is also used if an  option  in  the
455trustlist.txt’  or an attribute of the certificate requests it.
456              However the standard model (shell) is in that case always  tried
457              first.
458
459
460       --ignore-cert-extension oid
461              Add  oid to the list of ignored certificate extensions.  The oid
462              is expected to be in dotted decimal form, like  2.5.29.3.   This
463              option may be used more than once.  Critical flagged certificate
464              extensions matching one of the OIDs in the list are  treated  as
465              if  they  are actually handled and thus the certificate will not
466              be rejected due to an unknown critical extension.  Use this  op‐
467              tion  with care because extensions are usually flagged as criti‐
468              cal for a reason.
469
470
471   Input and Output
472
473
474
475       --armor
476       -a     Create PEM encoded output.  Default is binary output.
477
478
479       --base64
480              Create Base-64 encoded  output;  i.e.  PEM  without  the  header
481              lines.
482
483
484       --assume-armor
485              Assume  the input data is PEM encoded.  Default is to autodetect
486              the encoding but this is may fail.
487
488
489       --assume-base64
490              Assume the input data is plain base-64 encoded.
491
492
493       --assume-binary
494              Assume the input data is binary encoded.
495
496
497       --input-size-hint n
498              This option can be used to tell GPGSM the size of the input data
499              in  bytes.   n must be a positive base-10 number.  It is used by
500              the --status-fd line ``PROGRESS'' to provide a value  for  ``to‐
501              tal'' if that is not available by other means.
502
503
504
505       --p12-charset name
506              gpgsm  uses  the  UTF-8  encoding  when encoding passphrases for
507              PKCS#12 files.  This option may be used to force the  passphrase
508              to be encoded in the specified encoding name.  This is useful if
509              the application used to import the key uses a different encoding
510              and  thus  will not be able to import a file generated by gpgsm.
511              Commonly used values for name are Latin1 and CP850.   Note  that
512              gpgsm  itself  automagically  imports any file with a passphrase
513              encoded to the most commonly used encodings.
514
515
516
517       --default-key user_id
518              Use user_id as the standard key for signing.  This key  is  used
519              if  no  other key has been defined as a signing key.  Note, that
520              the first --local-users option also sets this key if it has  not
521              yet been set; however --default-key always overrides this.
522
523
524
525       --local-user user_id
526
527       -u user_id
528              Set  the  user(s)  to  be  used for signing.  The default is the
529              first secret key found in the database.
530
531
532
533       --recipient name
534       -r     Encrypt to the user id name.  There are several ways a  user  id
535              may be given (see: [how-to-specify-a-user-id]).
536
537
538
539       --output file
540       -o file
541              Write output to file.  The default is to write it to stdout.
542
543
544
545
546       --with-key-data
547              Displays extra information with the --list-keys commands.  Espe‐
548              cially a line tagged grp is printed which tells you the  keygrip
549              of  a  key.  This string is for example used as the file name of
550              the secret key.  Implies --with-colons.
551
552
553
554       --with-validation
555              When doing a key listing, do a full validation  check  for  each
556              key  and print the result.  This is usually a slow operation be‐
557              cause it requires a CRL lookup and other operations.
558
559              When used along with --import, a validation of  the  certificate
560              to  import  is  done  and only imported if it succeeds the test.
561              Note that this does not affect an already available  certificate
562              in  the  DB.  This option is therefore useful to simply verify a
563              certificate.
564
565
566
567       --with-md5-fingerprint
568              For standard key listings, also print the MD5 fingerprint of the
569              certificate.
570
571
572       --with-keygrip
573              Include  the  keygrip  in  standard key listings.  Note that the
574              keygrip is always listed in --with-colons mode.
575
576
577       --with-secret
578              Include info about the presence of a secret key  in  public  key
579              listings done with --with-colons.
580
581
582       --no-pretty-dn
583              By  default  gpgsm prints distinguished names (DNs) like the Is‐
584              suer or Subject in a more readable format (e.g. using a well de‐
585              fined  order  of the parts).  However, this format can't be used
586              as input strings.  This  option  reverts  printing  to  standard
587              RFC-2253  format  and thus avoids the need to use --dump-cert or
588              --with-colons to get the ``real'' name.
589
590
591   How to change how the CMS is created
592
593
594
595       --include-certs n
596              Using n of -2 includes all certificate except for the root cert,
597              -1  includes all certs, 0 does not include any certs, 1 includes
598              only the signers cert and all other positive values  include  up
599              to n certificates starting with the signer cert.  The default is
600              -2.
601
602
603       --cipher-algo oid
604              Use the cipher algorithm with the ASN.1  object  identifier  oid
605              for  encryption.   For  convenience  the  strings  3DES, AES and
606              AES256 may be used instead of their OIDs.  The  default  is  AES
607              (2.16.840.1.101.3.4.1.2).
608
609
610       --digest-algo name
611              Use  name  as  the message digest algorithm.  Usually this algo‐
612              rithm is deduced from the respective signing certificate.   This
613              option forces the use of the given algorithm and may lead to se‐
614              vere interoperability problems.
615
616
617   Doing things one usually do not want to do
618
619
620
621
622
623       --chuid uid
624              Change the current user to uid which may either be a number or a
625              name.   This  can be used from the root account to run gpgsm for
626              another user.  If uid is not the current UID a standard PATH  is
627              set  and  the envvar GNUPGHOME is unset.  To override the latter
628              the option --homedir can be used.  This option has only  an  ef‐
629              fect  when  used on the command line.  This option has currently
630              no effect at all on Windows.
631
632
633
634       --extra-digest-algo name
635              Sometimes signatures are broken in that they announce a  differ‐
636              ent  digest algorithm than actually used.  gpgsm uses a one-pass
637              data processing model and thus needs to rely  on  the  announced
638              digest  algorithms  to  properly hash the data.  As a workaround
639              this option may be used to tell gpgsm to also hash the data  us‐
640              ing  the algorithm name; this slows processing down a little bit
641              but allows verification of such  broken  signatures.   If  gpgsm
642              prints  an error like ``digest algo 8 has not been enabled'' you
643              may want to try this option, with ‘SHA256’ for name.
644
645
646       --compliance string
647              Set the compliance mode.  Valid  values  are  shown  when  using
648              "help" for string.
649
650
651       --min-rsa-length n
652              This option adjusts the compliance mode "de-vs" for stricter key
653              size requirements.  For example, a value of 3000  turns  rsa2048
654              and dsa2048 keys into non-VS-NfD compliant keys.
655
656
657       --require-compliance
658              To  check that data has been encrypted according to the rules of
659              the current compliance mode, a gpgsm user needs to evaluate  the
660              status  lines.   This  is  allows frontends to handle compliance
661              check in a more flexible way.  However, for scripted use the re‐
662              quired evaluation of the status-line requires quite some effort;
663              this option can be used instead to  make  sure  that  the  gpgsm
664              process  exits  with  a  failure if the compliance rules are not
665              fulfilled.  Note that this option has currently an  effect  only
666              in "de-vs" mode.
667
668
669       --ignore-cert-with-oid oid
670              Add oid to the list of OIDs to be checked while reading certifi‐
671              cates from smartcards. The oid is expected to be in dotted deci‐
672              mal  form,  like  2.5.29.3.   This  option may be used more than
673              once.  As of now certificates with an extended key usage  match‐
674              ing  one  of those OIDs are ignored during a --learn-card opera‐
675              tion and not imported.  This option can help to keep  the  local
676              key  database  clear  of  unneeded certificates stored on smart‐
677              cards.
678
679
680       --faked-system-time epoch
681              This option is only useful for testing; it sets the system  time
682              back  or  forth  to epoch which is the number of seconds elapsed
683              since the year 1970.  Alternatively epoch may be given as a full
684              ISO time string (e.g. "20070924T154812").
685
686
687       --with-ephemeral-keys
688              Include  ephemeral  flagged  keys in the output of key listings.
689              Note that they are included anyway if the key specification  for
690              a listing is given as fingerprint or keygrip.
691
692
693       --compatibility-flags flags
694              Set  compatibility flags to work around problems due to non-com‐
695              pliant certificates or data.  The flags are  given  as  a  comma
696              separated  list  of flag names and are OR-ed together.  The spe‐
697              cial flag "none" clears the list and allows to start  over  with
698              an  empty  list.  To get a list of available flags the sole word
699              "help" can be used.
700
701
702       --debug-level level
703              Select the debug level for investigating problems. level may  be
704              a numeric value or by a keyword:
705
706
707              none   No  debugging at all.  A value of less than 1 may be used
708                     instead of the keyword.
709
710              basic  Some basic debug messages.  A value between 1 and  2  may
711                     be used instead of the keyword.
712
713              advanced
714                     More verbose debug messages.  A value between 3 and 5 may
715                     be used instead of the keyword.
716
717              expert Even more detailed messages.  A value between 6 and 8 may
718                     be used instead of the keyword.
719
720              guru   All  of  the  debug messages you can get. A value greater
721                     than 8 may be used instead of the keyword.  The  creation
722                     of  hash  tracing files is only enabled if the keyword is
723                     used.
724
725       How these messages are mapped to the  actual  debugging  flags  is  not
726       specified  and may change with newer releases of this program. They are
727       however carefully selected to best aid in debugging.
728
729
730       --debug flags
731              Set debug flags.  All flags are or-ed and flags may be given  in
732              C  syntax  (e.g.  0x0042)  or  as a comma separated list of flag
733              names.  To get a list of all supported  flags  the  single  word
734              "help" can be used. This option is only useful for debugging and
735              the behavior may change at any time without notice.
736
737              Note, that all flags set using this option may get overridden by
738              --debug-level.
739
740
741       --debug-all
742              Same as --debug=0xffffffff
743
744
745       --debug-allow-core-dump
746              Usually  gpgsm  tries to avoid dumping core by well written code
747              and by disabling core dumps for security reasons.  However, bugs
748              are  pretty  durable  beasts  and to squash them it is sometimes
749              useful to have a core dump.  This option enables core dumps  un‐
750              less the Bad Thing happened before the option parsing.
751
752
753       --debug-no-chain-validation
754              This is actually not a debugging option but only useful as such.
755              It lets gpgsm bypass all certificate chain validation checks.
756
757
758       --debug-ignore-expiration
759              This is actually not a debugging option but only useful as such.
760              It lets gpgsm ignore all notAfter dates, this is used by the re‐
761              gression tests.
762
763
764       --passphrase-fd n
765              Read the passphrase from file descriptor n. Only the first  line
766              will  be  read  from  file descriptor n. If you use 0 for n, the
767              passphrase will be read from STDIN. This can  only  be  used  if
768              only one passphrase is supplied.
769
770              Note that this passphrase is only used if the option --batch has
771              also been given.
772
773
774       --pinentry-mode mode
775              Set the pinentry mode to mode.  Allowed values for mode are:
776
777              default
778                     Use the default of the agent, which is ask.
779
780              ask    Force the use of the Pinentry.
781
782              cancel Emulate use of Pinentry's cancel button.
783
784              error  Return a Pinentry error (``No Pinentry'').
785
786              loopback
787                     Redirect Pinentry queries to the caller.   Note  that  in
788                     contrast to Pinentry the user is not prompted again if he
789                     enters a bad password.
790
791
792       --request-origin origin
793              Tell gpgsm to assume that the operation ultimately originated at
794              origin.   Depending  on  the origin certain restrictions are ap‐
795              plied and the Pinentry may include an extra note on the  origin.
796              Supported values for origin are: local which is the default, re‐
797              mote to indicate a remote origin or browser for an operation re‐
798              quested by a web browser.
799
800
801       --no-common-certs-import
802              Suppress the import of common certificates on keybox creation.
803
804
805       All  the long options may also be given in the configuration file after
806       stripping off the two leading dashes.
807
808
809

HOW TO SPECIFY A USER ID

811       There are different ways to specify a user ID to GnuPG.  Some  of  them
812       are only valid for gpg others are only good for gpgsm.  Here is the en‐
813       tire list of ways to specify a key:
814
815
816
817       By key Id.
818              This format is deduced from the length of  the  string  and  its
819              content or 0x prefix. The key Id of an X.509 certificate are the
820              low 64 bits of its SHA-1 fingerprint.  The use  of  key  Ids  is
821              just  a  shortcut,  for all automated processing the fingerprint
822              should be used.
823
824              When using gpg an exclamation mark (!) may be appended to  force
825              using  the specified primary or secondary key and not to try and
826              calculate which primary or secondary key to use.
827
828              The last four lines of the example give the key ID in their long
829              form as internally used by the OpenPGP protocol. You can see the
830              long key ID using the option --with-colons.
831
832         234567C4
833         0F34E556E
834         01347A56A
835         0xAB123456
836
837         234AABBCC34567C4
838         0F323456784E56EAB
839         01AB3FED1347A5612
840         0x234AABBCC34567C4
841
842
843
844
845       By fingerprint.
846              This format is deduced from the length of  the  string  and  its
847              content  or  the 0x prefix.  Note, that only the 20 byte version
848              fingerprint is available with gpgsm (i.e. the SHA-1 hash of  the
849              certificate).
850
851              When  using gpg an exclamation mark (!) may be appended to force
852              using the specified primary or secondary key and not to try  and
853              calculate which primary or secondary key to use.
854
855              The  best  way  to specify a key Id is by using the fingerprint.
856              This avoids any ambiguities in case that  there  are  duplicated
857              key IDs.
858
859         1234343434343434C434343434343434
860         123434343434343C3434343434343734349A3434
861         0E12343434343434343434EAB3484343434343434
862         0xE12343434343434343434EAB3484343434343434
863
864
865       gpgsm  also  accepts colons between each pair of hexadecimal digits be‐
866       cause this is the de-facto standard on how  to  present  X.509  finger‐
867       prints.   gpg  also allows the use of the space separated SHA-1 finger‐
868       print as printed by the key listing commands.
869
870
871       By exact match on OpenPGP user ID.
872              This is denoted by a leading equal sign. It does not make  sense
873              for X.509 certificates.
874
875         =Heinrich Heine <heinrichh@uni-duesseldorf.de>
876
877
878       By exact match on an email address.
879              This  is  indicated  by enclosing the email address in the usual
880              way with left and right angles.
881
882         <heinrichh@uni-duesseldorf.de>
883
884
885
886       By partial match on an email address.
887              This is indicated by prefixing the  search  string  with  an  @.
888              This uses a substring search but considers only the mail address
889              (i.e. inside the angle brackets).
890
891         @heinrichh
892
893
894       By exact match on the subject's DN.
895              This is indicated by a leading slash, directly followed  by  the
896              RFC-2253 encoded DN of the subject.  Note that you can't use the
897              string printed by gpgsm --list-keys because that  one  has  been
898              reordered and modified for better readability; use --with-colons
899              to print the raw (but standard escaped) RFC-2253 string.
900
901         /CN=Heinrich Heine,O=Poets,L=Paris,C=FR
902
903
904       By exact match on the issuer's DN.
905              This is indicated by a leading hash mark, directly followed by a
906              slash  and  then directly followed by the RFC-2253 encoded DN of
907              the issuer.  This should return the Root  cert  of  the  issuer.
908              See note above.
909
910         #/CN=Root Cert,O=Poets,L=Paris,C=FR
911
912
913
914       By exact match on serial number and issuer's DN.
915              This  is  indicated  by a hash mark, followed by the hexadecimal
916              representation of the serial number, then followed  by  a  slash
917              and the RFC-2253 encoded DN of the issuer. See note above.
918
919         #4F03/CN=Root Cert,O=Poets,L=Paris,C=FR
920
921
922       By keygrip.
923              This  is indicated by an ampersand followed by the 40 hex digits
924              of a keygrip.  gpgsm prints the keygrip when using  the  command
925              --dump-cert.
926
927         &D75F22C3F86E355877348498CDC92BD21010A480
928
929
930
931       By substring match.
932              This is the default mode but applications may want to explicitly
933              indicate this by putting the asterisk in front.   Match  is  not
934              case sensitive.
935
936         Heine
937         *Heine
938
939
940       . and + prefixes
941              These prefixes are reserved for looking up mails anchored at the
942              end and for a word search mode.  They are  not  yet  implemented
943              and using them is undefined.
944
945
946              Please  note  that we have reused the hash mark identifier which
947              was used in old GnuPG versions to indicate the so called  local-
948              id.  It is not anymore used and there should be no conflict when
949              used with X.509 stuff.
950
951              Using the RFC-2253 format of DNs has the drawback that it is not
952              possible  to  map them back to the original encoding, however we
953              don't have to do this because our key database stores  this  en‐
954              coding as meta data.
955
956
957

EXAMPLES

959         $ gpgsm -er goo@bar.net <plaintext >ciphertext
960
961
962
963

FILES

965       There  are  a  few  configuration  files  to control certain aspects of
966       gpgsm's operation. Unless noted, they are expected in the current  home
967       directory (see: [option --homedir]).
968
969
970
971       gpgsm.conf
972              This  is  the  standard  configuration  file  read  by  gpgsm on
973              startup.  It may contain any valid long option; the leading  two
974              dashes may not be entered and the option may not be abbreviated.
975              This default name may be  changed  on  the  command  line  (see:
976              [gpgsm-option --options]).  You should backup this file.
977
978
979       common.conf
980              This is an optional configuration file read by gpgsm on startup.
981              It may contain options pertaining to all  components  of  GnuPG.
982              Its current main use is for the "use-keyboxd" option.
983
984
985       policies.txt
986              This  is  a  list of allowed CA policies.  This file should list
987              the object identifiers of the  policies  line  by  line.   Empty
988              lines and lines starting with a hash mark are ignored.  Policies
989              missing in this file and not marked as critical in the  certifi‐
990              cate  will  print  only  a  warning;  certificates with policies
991              marked as critical and not listed in this  file  will  fail  the
992              signature verification.  You should backup this file.
993
994              For example, to allow only the policy 2.289.9.9, the file should
995              look like this:
996
997                # Allowed policies
998                2.289.9.9
999
1000
1001       qualified.txt
1002              This is the list of root certificates used  for  qualified  cer‐
1003              tificates.  They are defined as certificates capable of creating
1004              legally binding signatures in the same way as handwritten signa‐
1005              tures  are.  Comments start with a hash mark and empty lines are
1006              ignored.  Lines do have a length limit but this is not a serious
1007              limitation  as the format of the entries is fixed and checked by
1008              gpgsm: A non-comment line starts with optional whitespace,  fol‐
1009              lowed by exactly 40 hex characters, white space and a lowercased
1010              2 letter country code.  Additional  data  delimited  with  by  a
1011              white  space is current ignored but might late be used for other
1012              purposes.
1013
1014              Note that even if a certificate is listed  in  this  file,  this
1015              does  not  mean  that the certificate is trusted; in general the
1016              certificates listed in this file  need  to  be  listed  also  in
1017trustlist.txt’.  This  is  a  global  file  an installed in the
1018              sysconf directory (e.g.  ‘/etc/gnupg/qualified.txt’).
1019
1020              Every time gpgsm uses a certificate for signing or  verification
1021              this file will be consulted to check whether the certificate un‐
1022              der question has ultimately been issued by one of these CAs.  If
1023              this  is  the  case  the user will be informed that the verified
1024              signature represents a legally  binding  (``qualified'')  signa‐
1025              ture.  When creating a signature using such a certificate an ex‐
1026              tra prompt will be issued to let the user confirm  that  such  a
1027              legally binding signature shall really be created.
1028
1029              Because  this  software  has  not yet been approved for use with
1030              such certificates, appropriate notices will be shown to indicate
1031              this fact.
1032
1033
1034       help.txt
1035              This is plain text file with a few help entries used with pinen‐
1036              try as well as a large list of help items  for  gpg  and  gpgsm.
1037              The  standard  file has English help texts; to install localized
1038              versions use filenames like ‘help.LL.txt’ with LL  denoting  the
1039              locale.   GnuPG comes with a set of predefined help files in the
1040              data directory (e.g.  ‘/usr/share/gnupg/gnupg/help.de.txt’)  and
1041              allows  overriding  of any help item by help files stored in the
1042              system configuration directory (e.g.  ‘/etc/gnupg/help.de.txt’).
1043              For  a  reference  of the help file's syntax, please see the in‐
1044              stalled ‘help.txt’ file.
1045
1046
1047
1048       com-certs.pem
1049              This file is a collection of common certificates used  to  popu‐
1050              lated  a  newly created ‘pubring.kbx’.  An administrator may re‐
1051              place this file with a custom one.  The format is  a  concatena‐
1052              tion of PEM encoded X.509 certificates.  This global file is in‐
1053              stalled  in  the  data  directory  (e.g.  ‘/usr/share/gnupg/com-
1054              certs.pem’).
1055
1056
1057       Note that on larger installations, it is useful to put predefined files
1058       into the directory ‘/etc/skel/.gnupg/’  so  that  newly  created  users
1059       start  up  with  a  working  configuration.  For existing users a small
1060       helper script is provided to create these files (see: [addgnupghome]).
1061
1062       For internal purposes gpgsm creates and maintains a  few  other  files;
1063       they  all live in the current home directory (see: [option --homedir]).
1064       Only gpgsm may modify these files.
1065
1066
1067
1068       pubring.kbx
1069              This a database file storing the certificates as  well  as  meta
1070              information.   For  debugging  purposes  the tool kbxutil may be
1071              used to show the internal structure of this  file.   You  should
1072              backup this file.
1073
1074
1075       random_seed
1076              This content of this file is used to maintain the internal state
1077              of the random number generator  across  invocations.   The  same
1078              file is used by other programs of this software too.
1079
1080
1081       S.gpg-agent
1082              If  this  file  exists  gpgsm  will first try to connect to this
1083              socket for accessing gpg-agent before starting a  new  gpg-agent
1084              instance.   Under  Windows  this  socket  (which in reality be a
1085              plain file describing a regular TCP listening port) is the stan‐
1086              dard way of connecting the gpg-agent.
1087
1088

SEE ALSO

1090       gpg(1), gpg-agent(1)
1091
1092       The full documentation for this tool is maintained as a Texinfo manual.
1093       If GnuPG and the info program are properly installed at your site,  the
1094       command
1095
1096         info gnupg
1097
1098       should  give  you access to the complete manual including a menu struc‐
1099       ture and an index.
1100
1101
1102
1103GnuPG 2.4.3                       2023-06-21                          GPGSM(1)
Impressum