1certtool(1) User Commands certtool(1)
2
3
4
6 certtool - GnuTLS certificate tool
7
9 certtool [-flags] [-flag [value]] [--option-name[[=| ]value]]
10
11 All arguments must be options.
12
14 Tool to parse and generate X.509 certificates, requests and private
15 keys. It can be used interactively or non interactively by specifying
16 the template command line option.
17
18 The tool accepts files or supported URIs via the --infile option. In
19 case PIN is required for URI access you can provide it using the envi‐
20 ronment variables GNUTLS_PIN and GNUTLS_SO_PIN.
21
22
24 -d num, --debug=num
25 Enable debugging. This option takes an integer number as its
26 argument. The value of num is constrained to being:
27 in the range 0 through 9999
28
29 Specifies the debug level.
30
31 -V, --verbose
32 More verbose output.
33
34
35 --infile=file
36 Input file.
37
38
39 --outfile=str
40 Output file.
41
42
43 Certificate related options
44 -i, --certificate-info
45 Print information on the given certificate.
46
47
48 --pubkey-info
49 Print information on a public key.
50
51 The option combined with --load-request, --load-pubkey,
52 --load-privkey and --load-certificate will extract the public
53 key of the object in question.
54
55 -s, --generate-self-signed
56 Generate a self-signed certificate.
57
58
59 -c, --generate-certificate
60 Generate a signed certificate.
61
62
63 --generate-proxy
64 Generates a proxy certificate.
65
66
67 -u, --update-certificate
68 Update a signed certificate.
69
70
71 --fingerprint
72 Print the fingerprint of the given certificate.
73
74 This is a simple hash of the DER encoding of the certificate. It
75 can be combined with the --hash parameter. However, it is recom‐
76 mended for identification to use the key-id which depends only
77 on the certificate's key.
78
79 --key-id
80 Print the key ID of the given certificate.
81
82 This is a hash of the public key of the given certificate. It
83 identifies the key uniquely, remains the same on a certificate
84 renewal and depends only on signed fields of the certificate.
85
86 --certificate-pubkey
87 Print certificate's public key.
88
89 This option is deprecated as a duplicate of --pubkey-info
90
91 NOTE: THIS OPTION IS DEPRECATED
92
93 --v1 Generate an X.509 version 1 certificate (with no extensions).
94
95
96 --sign-params=str
97 Sign a certificate with a specific signature algorithm.
98
99 This option can be combined with --generate-certificate, to sign
100 the certificate with a specific signature algorithm variant. The
101 only option supported is 'RSA-PSS', and should be specified when
102 the signer does not have a certificate which is marked for
103 RSA-PSS use only.
104
105 Certificate request related options
106 --crq-info
107 Print information on the given certificate request.
108
109
110 -q, --generate-request
111 Generate a PKCS #10 certificate request. This option must not
112 appear in combination with any of the following options: infile.
113
114 Will generate a PKCS #10 certificate request. To specify a pri‐
115 vate key use --load-privkey.
116
117 --no-crq-extensions
118 Do not use extensions in certificate requests.
119
120
121 PKCS#12 file related options
122 --p12-info
123 Print information on a PKCS #12 structure.
124
125 This option will dump the contents and print the metadata of the
126 provided PKCS #12 structure.
127
128 --p12-name=str
129 The PKCS #12 friendly name to use.
130
131 The name to be used for the primary certificate and private key
132 in a PKCS #12 file.
133
134 --to-p12
135 Generate a PKCS #12 structure.
136
137 It requires a certificate, a private key and possibly a CA cer‐
138 tificate to be specified.
139
140 Private key related options
141 -k, --key-info
142 Print information on a private key.
143
144
145 --p8-info
146 Print information on a PKCS #8 structure.
147
148 This option will print information about encrypted PKCS #8
149 structures. That option does not require the decryption of the
150 structure.
151
152 --to-rsa
153 Convert an RSA-PSS key to raw RSA format.
154
155 It requires an RSA-PSS key as input and will output a raw RSA
156 key. This command is necessary for compatibility with applica‐
157 tions that cannot read RSA-PSS keys.
158
159 -p, --generate-privkey
160 Generate a private key.
161
162 When generating RSA-PSS private keys, the --hash option will re‐
163 strict the allowed hash for the key; in the same keys the
164 --salt-size option is also acceptable.
165
166 --key-type=str
167 Specify the key type to use on key generation.
168
169 This option can be combined with --generate-privkey, to specify
170 the key type to be generated. Valid options are, 'rsa',
171 'rsa-pss', 'dsa', 'ecdsa', 'ed25519, 'ed448', 'x25519', and
172 'x448'.'. When combined with certificate generation it can be
173 used to specify an RSA-PSS certificate when an RSA key is given.
174
175 --bits=num
176 Specify the number of bits for key generation. This option
177 takes an integer number as its argument.
178
179
180 --curve=str
181 Specify the curve used for EC key generation.
182
183 Supported values are secp192r1, secp224r1, secp256r1, secp384r1
184 and secp521r1.
185
186 --sec-param=security parameter
187 Specify the security level [low, legacy, medium, high, ultra].
188
189 This is alternative to the bits option.
190
191 --to-p8
192 Convert a given key to a PKCS #8 structure.
193
194 This needs to be combined with --load-privkey.
195
196 -8, --pkcs8
197 Use PKCS #8 format for private keys.
198
199
200 --provable
201 Generate a private key or parameters from a seed using a prov‐
202 able method.
203
204 This will use the FIPS PUB186-4 algorithms (i.e., Shawe-Taylor)
205 for provable key generation. When specified the private keys or
206 parameters will be generated from a seed, and can be later vali‐
207 dated with --verify-provable-privkey to be correctly generated
208 from the seed. You may specify --seed or allow GnuTLS to gener‐
209 ate one (recommended). This option can be combined with --gener‐
210 ate-privkey or --generate-dh-params.
211
212 That option applies to RSA and DSA keys. On the DSA keys the PQG
213 parameters are generated using the seed, and on RSA the two
214 primes.
215
216 --verify-provable-privkey
217 Verify a private key generated from a seed using a provable
218 method.
219
220 This will use the FIPS-186-4 algorithms for provable key genera‐
221 tion. You may specify --seed or use the seed stored in the pri‐
222 vate key structure.
223
224 --seed=str
225 When generating a private key use the given hex-encoded seed.
226
227 The seed acts as a security parameter for the private key, and
228 thus a seed size which corresponds to the security level of the
229 private key should be provided (e.g., 256-bits seed).
230
231 CRL related options
232 -l, --crl-info
233 Print information on the given CRL structure.
234
235
236 --generate-crl
237 Generate a CRL.
238
239 This option generates a Certificate Revocation List. When com‐
240 bined with --load-crl it would use the loaded CRL as base for
241 the generated (i.e., all revoked certificates in the base will
242 be copied to the new CRL). To add new certificates to the CRL
243 use --load-certificate.
244
245 --verify-crl
246 Verify a Certificate Revocation List using a trusted list. This
247 option must appear in combination with the following options:
248 load-ca-certificate.
249
250 The trusted certificate list must be loaded with --load-ca-cer‐
251 tificate.
252
253 Certificate verification related options
254 -e, --verify-chain
255 Verify a PEM encoded certificate chain.
256
257 Verifies the validity of a certificate chain. That is, an or‐
258 dered set of certificates where each one is the issuer of the
259 previous, and the first is the end-certificate to be validated.
260 In a proper chain the last certificate is a self signed one. It
261 can be combined with --verify-purpose or --verify-hostname.
262
263 --verify
264 Verify a PEM encoded certificate (chain) against a trusted set.
265
266 The trusted certificate list can be loaded with --load-ca-cer‐
267 tificate. If no certificate list is provided, then the system's
268 trusted certificate list is used. Note that during verification
269 multiple paths may be explored. On a successful verification the
270 successful path will be the last one. It can be combined with
271 --verify-purpose or --verify-hostname.
272
273 --verify-hostname=str
274 Specify a hostname to be used for certificate chain verifica‐
275 tion.
276
277 This is to be combined with one of the verify certificate op‐
278 tions.
279
280 --verify-email=str
281 Specify a email to be used for certificate chain verification.
282 This option must not appear in combination with any of the fol‐
283 lowing options: verify-hostname.
284
285 This is to be combined with one of the verify certificate op‐
286 tions.
287
288 --verify-purpose=str
289 Specify a purpose OID to be used for certificate chain verifica‐
290 tion.
291
292 This object identifier restricts the purpose of the certificates
293 to be verified. Example purposes are 1.3.6.1.5.5.7.3.1 (TLS
294 WWW), 1.3.6.1.5.5.7.3.4 (EMAIL) etc. Note that a CA certificate
295 without a purpose set (extended key usage) is valid for any pur‐
296 pose.
297
298 --verify-allow-broken
299 Allow broken algorithms, such as MD5 for verification.
300
301 This can be combined with --p7-verify, --verify or --ver‐
302 ify-chain.
303
304 --verify-profile=str
305 Specify a security level profile to be used for verification.
306
307 This option can be used to specify a certificate verification
308 profile. Certificate
309 verification profiles correspond to the security level. This
310 should be one of
311 'none', 'very weak', 'low', 'legacy', 'medium', 'high', 'ul‐
312 tra',
313 'future'. Note that by default no profile is applied, unless
314 one is set
315 as minimum in the gnutls configuration file.
316
317 PKCS#7 structure options
318 --p7-generate
319 Generate a PKCS #7 structure.
320
321 This option generates a PKCS #7 certificate container structure.
322 To add certificates in the structure use --load-certificate and
323 --load-crl.
324
325 --p7-sign
326 Signs using a PKCS #7 structure.
327
328 This option generates a PKCS #7 structure containing a signature
329 for the provided data from infile. The data are stored within
330 the structure. The signer certificate has to be specified using
331 --load-certificate and --load-privkey. The input to --load-cer‐
332 tificate can be a list of certificates. In case of a list, the
333 first certificate is used for signing and the other certificates
334 are included in the structure.
335
336 --p7-detached-sign
337 Signs using a detached PKCS #7 structure.
338
339 This option generates a PKCS #7 structure containing a signature
340 for the provided data from infile. The signer certificate has to
341 be specified using --load-certificate and --load-privkey. The
342 input to --load-certificate can be a list of certificates. In
343 case of a list, the first certificate is used for signing and
344 the other certificates are included in the structure.
345
346 --p7-include-cert, --no-p7-include-cert
347 The signer's certificate will be included in the cert list. The
348 no-p7-include-cert form will disable the option. This option is
349 enabled by default.
350
351 This options works with --p7-sign or --p7-detached-sign and will
352 include or exclude the signer's certificate into the generated
353 signature.
354
355 --p7-time, --no-p7-time
356 Will include a timestamp in the PKCS #7 structure. The
357 no-p7-time form will disable the option.
358
359 This option will include a timestamp in the generated signature
360
361 --p7-show-data, --no-p7-show-data
362 Will show the embedded data in the PKCS #7 structure. The
363 no-p7-show-data form will disable the option.
364
365 This option can be combined with --p7-verify or --p7-info and
366 will display the embedded signed data in the PKCS #7 structure.
367
368 --p7-info
369 Print information on a PKCS #7 structure.
370
371
372 --p7-verify
373 Verify the provided PKCS #7 structure.
374
375 This option verifies the signed PKCS #7 structure. The certifi‐
376 cate list to use for verification can be specified with
377 --load-ca-certificate. When no certificate list is provided,
378 then the system's certificate list is used. Alternatively a di‐
379 rect signer can be provided using --load-certificate. A key pur‐
380 pose can be enforced with the --verify-purpose option, and the
381 --load-data option will utilize detached data.
382
383 --smime-to-p7
384 Convert S/MIME to PKCS #7 structure.
385
386
387 Other options
388 --generate-dh-params
389 Generate PKCS #3 encoded Diffie-Hellman parameters.
390
391 The will generate random parameters to be used with Diffie-Hell‐
392 man key exchange. The output parameters will be in PKCS #3 for‐
393 mat. Note that it is recommended to use the --get-dh-params op‐
394 tion instead.
395
396 NOTE: THIS OPTION IS DEPRECATED
397
398 --get-dh-params
399 List the included PKCS #3 encoded Diffie-Hellman parameters.
400
401 Returns stored DH parameters in GnuTLS. Those parameters re‐
402 turned are defined in RFC7919, and can be considered standard
403 parameters for a TLS key exchange. This option is provided for
404 old applications which require DH parameters to be specified;
405 modern GnuTLS applications should not require them.
406
407 --dh-info
408 Print information PKCS #3 encoded Diffie-Hellman parameters.
409
410
411 --load-privkey=str
412 Loads a private key file.
413
414 This can be either a file or a PKCS #11 URL
415
416 --load-pubkey=str
417 Loads a public key file.
418
419 This can be either a file or a PKCS #11 URL
420
421 --load-request=str
422 Loads a certificate request file.
423
424 This option can be used with a file
425
426 --load-certificate=str
427 Loads a certificate file.
428
429 This option can be used with a file
430
431 --load-ca-privkey=str
432 Loads the certificate authority's private key file.
433
434 This can be either a file or a PKCS #11 URL
435
436 --load-ca-certificate=str
437 Loads the certificate authority's certificate file.
438
439 This can be either a file or a PKCS #11 URL
440
441 --load-crl=str
442 Loads the provided CRL.
443
444 This option can be used with a file
445
446 --load-data=str
447 Loads auxiliary data.
448
449 This option can be used with a file
450
451 --password=str
452 Password to use.
453
454 You can use this option to specify the password in the command
455 line instead of reading it from the tty. Note, that the command
456 line arguments are available for view in others in the system.
457 Specifying password as '' is the same as specifying no password.
458
459 --null-password
460 Enforce a NULL password.
461
462 This option enforces a NULL password. This is different than the
463 empty or no password in schemas like PKCS #8.
464
465 --empty-password
466 Enforce an empty password.
467
468 This option enforces an empty password. This is different than
469 the NULL or no password in schemas like PKCS #8.
470
471 --hex-numbers
472 Print big number in an easier format to parse.
473
474
475 --cprint
476 In certain operations it prints the information in C-friendly
477 format.
478
479 In certain operations it prints the information in C-friendly
480 format, suitable for including into C programs.
481
482 --rsa Generate RSA key.
483
484 When combined with --generate-privkey generates an RSA private
485 key.
486
487 NOTE: THIS OPTION IS DEPRECATED
488
489 --dsa Generate DSA key.
490
491 When combined with --generate-privkey generates a DSA private
492 key.
493
494 NOTE: THIS OPTION IS DEPRECATED
495
496 --ecc Generate ECC (ECDSA) key.
497
498 When combined with --generate-privkey generates an elliptic
499 curve private key to be used with ECDSA.
500
501 NOTE: THIS OPTION IS DEPRECATED
502
503 --ecdsa
504 This is an alias for the --ecc option.
505
506 NOTE: THIS OPTION IS DEPRECATED
507
508 --hash=str
509 Hash algorithm to use for signing.
510
511 Available hash functions are SHA1, RMD160, SHA256, SHA384,
512 SHA512, SHA3-224, SHA3-256, SHA3-384, SHA3-512.
513
514 --salt-size=num
515 Specify the RSA-PSS key default salt size. This option takes an
516 integer number as its argument.
517
518 Typical keys shouldn't set or restrict this option.
519
520 --inder, --no-inder
521 Use DER format for input certificates, private keys, and DH pa‐
522 rameters . The no-inder form will disable the option.
523
524 The input files will be assumed to be in DER or RAW format. Un‐
525 like options that in PEM input would allow multiple input data
526 (e.g. multiple certificates), when reading in DER format a sin‐
527 gle data structure is read.
528
529 --inraw
530 This is an alias for the --inder option.
531
532 --outder, --no-outder
533 Use DER format for output certificates, private keys, and DH pa‐
534 rameters. The no-outder form will disable the option.
535
536 The output will be in DER or RAW format.
537
538 --outraw
539 This is an alias for the --outder option.
540
541 --disable-quick-random
542 No effect.
543
544
545 NOTE: THIS OPTION IS DEPRECATED
546
547 --template=str
548 Template file to use for non-interactive operation.
549
550
551 --stdout-info
552 Print information to stdout instead of stderr.
553
554
555 --ask-pass
556 Enable interaction for entering password when in batch mode.
557
558 This option will enable interaction to enter password when in
559 batch mode. That is useful when the template option has been
560 specified.
561
562 --pkcs-cipher=cipher
563 Cipher to use for PKCS #8 and #12 operations.
564
565 Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192,
566 aes-256, rc2-40, arcfour.
567
568 --provider=str
569 Specify the PKCS #11 provider library.
570
571 This will override the default options in
572 /etc/gnutls/pkcs11.conf
573
574 --text, --no-text
575 Output textual information before PEM-encoded certificates, pri‐
576 vate keys, etc. The no-text form will disable the option. This
577 option is enabled by default.
578
579 Output textual information before PEM-encoded data
580
581 -v arg, --version=arg
582 Output version of program and exit. The default mode is `v', a
583 simple version. The `c' mode will print copyright information
584 and `n' will print the full copyright notice.
585
586 -h, --help
587 Display usage information and exit.
588
589 -!, --more-help
590 Pass the extended usage information through a pager.
591
592
594 Certtool's template file format
595 A template file can be used to avoid the interactive questions of cert‐
596 tool. Initially create a file named 'cert.cfg' that contains the infor‐
597 mation about the certificate. The template can be used as below:
598
599 $ certtool --generate-certificate --load-privkey key.pem --template cert.cfg --outfile cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
600
601 An example certtool template file that can be used to generate a cer‐
602 tificate request or a self signed certificate follows.
603
604 # X.509 Certificate options
605 #
606 # DN options
607
608 # The organization of the subject.
609 organization = "Koko inc."
610
611 # The organizational unit of the subject.
612 unit = "sleeping dept."
613
614 # The locality of the subject.
615 # locality =
616
617 # The state of the certificate owner.
618 state = "Attiki"
619
620 # The country of the subject. Two letter code.
621 country = GR
622
623 # The common name of the certificate owner.
624 cn = "Cindy Lauper"
625
626 # A user id of the certificate owner.
627 #uid = "clauper"
628
629 # Set domain components
630 #dc = "name"
631 #dc = "domain"
632
633 # If the supported DN OIDs are not adequate you can set
634 # any OID here.
635 # For example set the X.520 Title and the X.520 Pseudonym
636 # by using OID and string pairs.
637 #dn_oid = "2.5.4.12 Dr."
638 #dn_oid = "2.5.4.65 jackal"
639
640 # This is deprecated and should not be used in new
641 # certificates.
642 # pkcs9_email = "none@none.org"
643
644 # An alternative way to set the certificate's distinguished name directly
645 # is with the "dn" option. The attribute names allowed are:
646 # C (country), street, O (organization), OU (unit), title, CN (common name),
647 # L (locality), ST (state), placeOfBirth, gender, countryOfCitizenship,
648 # countryOfResidence, serialNumber, telephoneNumber, surName, initials,
649 # generationQualifier, givenName, pseudonym, dnQualifier, postalCode, name,
650 # businessCategory, DC, UID, jurisdictionOfIncorporationLocalityName,
651 # jurisdictionOfIncorporationStateOrProvinceName,
652 # jurisdictionOfIncorporationCountryName, XmppAddr, and numeric OIDs.
653
654 #dn = "cn = Nikos,st = New Something,C=GR,surName=Mavrogiannopoulos,2.5.4.9=Arkadias"
655
656 # The serial number of the certificate
657 # The value is in decimal (i.e. 1963) or hex (i.e. 0x07ab).
658 # Comment the field for a random serial number.
659 serial = 007
660
661 # In how many days, counting from today, this certificate will expire.
662 # Use -1 if there is no expiration date.
663 expiration_days = 700
664
665 # Alternatively you may set concrete dates and time. The GNU date string
666 # formats are accepted. See:
667 # https://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html
668
669 #activation_date = "2004-02-29 16:21:42"
670 #expiration_date = "2025-02-29 16:24:41"
671
672 # X.509 v3 extensions
673
674 # A dnsname in case of a WWW server.
675 #dns_name = "www.none.org"
676 #dns_name = "www.morethanone.org"
677
678 # An othername defined by an OID and a hex encoded string
679 #other_name = "1.3.6.1.5.2.2 302ca00d1b0b56414e5245494e2e4f5247a11b3019a006020400000002a10f300d1b047269636b1b0561646d696e"
680 #other_name_utf8 = "1.2.4.5.6 A UTF8 string"
681 #other_name_octet = "1.2.4.5.6 A string that will be encoded as ASN.1 octet string"
682
683 # Allows writing an XmppAddr Identifier
684 #xmpp_name = juliet@im.example.com
685
686 # Names used in PKINIT
687 #krb5_principal = user@REALM.COM
688 #krb5_principal = HTTP/user@REALM.COM
689
690 # A subject alternative name URI
691 #uri = "https://www.example.com"
692
693 # An IP address in case of a server.
694 #ip_address = "192.168.1.1"
695
696 # An email in case of a person
697 email = "none@none.org"
698
699 # TLS feature (rfc7633) extension. That can is used to indicate mandatory TLS
700 # extension features to be provided by the server. In practice this is used
701 # to require the Status Request (extid: 5) extension from the server. That is,
702 # to require the server holding this certificate to provide a stapled OCSP response.
703 # You can have multiple lines for multiple TLS features.
704
705 # To ask for OCSP status request use:
706 #tls_feature = 5
707
708 # Challenge password used in certificate requests
709 challenge_password = 123456
710
711 # Password when encrypting a private key
712 #password = secret
713
714 # An URL that has CRLs (certificate revocation lists)
715 # available. Needed in CA certificates.
716 #crl_dist_points = "https://www.getcrl.crl/getcrl/"
717
718 # Whether this is a CA certificate or not
719 #ca
720
721 # Subject Unique ID (in hex)
722 #subject_unique_id = 00153224
723
724 # Issuer Unique ID (in hex)
725 #issuer_unique_id = 00153225
726
727 #### Key usage
728
729 # The following key usage flags are used by CAs and end certificates
730
731 # Whether this certificate will be used to sign data (needed
732 # in TLS DHE ciphersuites). This is the digitalSignature flag
733 # in RFC5280 terminology.
734 signing_key
735
736 # Whether this certificate will be used to encrypt data (needed
737 # in TLS RSA ciphersuites). Note that it is preferred to use different
738 # keys for encryption and signing. This is the keyEncipherment flag
739 # in RFC5280 terminology.
740 encryption_key
741
742 # Whether this key will be used to sign other certificates. The
743 # keyCertSign flag in RFC5280 terminology.
744 #cert_signing_key
745
746 # Whether this key will be used to sign CRLs. The
747 # cRLSign flag in RFC5280 terminology.
748 #crl_signing_key
749
750 # The keyAgreement flag of RFC5280. Its purpose is loosely
751 # defined. Not use it unless required by a protocol.
752 #key_agreement
753
754 # The dataEncipherment flag of RFC5280. Its purpose is loosely
755 # defined. Not use it unless required by a protocol.
756 #data_encipherment
757
758 # The nonRepudiation flag of RFC5280. Its purpose is loosely
759 # defined. Not use it unless required by a protocol.
760 #non_repudiation
761
762 #### Extended key usage (key purposes)
763
764 # The following extensions are used in an end certificate
765 # to clarify its purpose. Some CAs also use it to indicate
766 # the types of certificates they are purposed to sign.
767
768
769 # Whether this certificate will be used for a TLS client;
770 # this sets the id-kp-clientAuth (1.3.6.1.5.5.7.3.2) of
771 # extended key usage.
772 #tls_www_client
773
774 # Whether this certificate will be used for a TLS server;
775 # this sets the id-kp-serverAuth (1.3.6.1.5.5.7.3.1) of
776 # extended key usage.
777 #tls_www_server
778
779 # Whether this key will be used to sign code. This sets the
780 # id-kp-codeSigning (1.3.6.1.5.5.7.3.3) of extended key usage
781 # extension.
782 #code_signing_key
783
784 # Whether this key will be used to sign OCSP data. This sets the
785 # id-kp-OCSPSigning (1.3.6.1.5.5.7.3.9) of extended key usage extension.
786 #ocsp_signing_key
787
788 # Whether this key will be used for time stamping. This sets the
789 # id-kp-timeStamping (1.3.6.1.5.5.7.3.8) of extended key usage extension.
790 #time_stamping_key
791
792 # Whether this key will be used for email protection. This sets the
793 # id-kp-emailProtection (1.3.6.1.5.5.7.3.4) of extended key usage extension.
794 #email_protection_key
795
796 # Whether this key will be used for IPsec IKE operations (1.3.6.1.5.5.7.3.17).
797 #ipsec_ike_key
798
799 ## adding custom key purpose OIDs
800
801 # for microsoft smart card logon
802 # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
803
804 # for email protection
805 # key_purpose_oid = 1.3.6.1.5.5.7.3.4
806
807 # for any purpose (must not be used in intermediate CA certificates)
808 # key_purpose_oid = 2.5.29.37.0
809
810 ### end of key purpose OIDs
811
812 ### Adding arbitrary extensions
813 # This requires to provide the extension OIDs, as well as the extension data in
814 # hex format. The following two options are available since GnuTLS 3.5.3.
815 #add_extension = "1.2.3.4 0x0AAB01ACFE"
816
817 # As above but encode the data as an octet string
818 #add_extension = "1.2.3.4 octet_string(0x0AAB01ACFE)"
819
820 # For portability critical extensions shouldn't be set to certificates.
821 #add_critical_extension = "5.6.7.8 0x1AAB01ACFE"
822
823 # When generating a certificate from a certificate
824 # request, then honor the extensions stored in the request
825 # and store them in the real certificate.
826 #honor_crq_extensions
827
828 # Alternatively only specific extensions can be copied.
829 #honor_crq_ext = 2.5.29.17
830 #honor_crq_ext = 2.5.29.15
831
832 # Path length constraint. Sets the maximum number of
833 # certificates that can be used to certify this certificate.
834 # (i.e. the certificate chain length)
835 #path_len = -1
836 #path_len = 2
837
838 # OCSP URI
839 # ocsp_uri = https://my.ocsp.server/ocsp
840
841 # CA issuers URI
842 # ca_issuers_uri = https://my.ca.issuer
843
844 # Certificate policies
845 #policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0
846 #policy1_txt = "This is a long policy to summarize"
847 #policy1_url = https://www.example.com/a-policy-to-read
848
849 #policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1
850 #policy2_txt = "This is a short policy"
851 #policy2_url = https://www.example.com/another-policy-to-read
852
853 # The number of additional certificates that may appear in a
854 # path before the anyPolicy is no longer acceptable.
855 #inhibit_anypolicy_skip_certs 1
856
857 # Name constraints
858
859 # DNS
860 #nc_permit_dns = example.com
861 #nc_exclude_dns = test.example.com
862
863 # EMAIL
864 #nc_permit_email = "nmav@ex.net"
865
866 # Exclude subdomains of example.com
867 #nc_exclude_email = .example.com
868
869 # Exclude all e-mail addresses of example.com
870 #nc_exclude_email = example.com
871
872 # IP
873 #nc_permit_ip = 192.168.0.0/16
874 #nc_exclude_ip = 192.168.5.0/24
875 #nc_permit_ip = fc0a:eef2:e7e7:a56e::/64
876
877
878 # Options for proxy certificates
879 #proxy_policy_language = 1.3.6.1.5.5.7.21.1
880
881
882 # Options for generating a CRL
883
884 # The number of days the next CRL update will be due.
885 # next CRL update will be in 43 days
886 #crl_next_update = 43
887
888 # this is the 5th CRL by this CA
889 # The value is in decimal (i.e. 1963) or hex (i.e. 0x07ab).
890 # Comment the field for a time-based number.
891 # Time-based CRL numbers generated in GnuTLS 3.6.3 and later
892 # are significantly larger than those generated in previous
893 # versions. Since CRL numbers need to be monotonic, you need
894 # to specify the CRL number here manually if you intend to
895 # downgrade to an earlier version than 3.6.3 after publishing
896 # the CRL as it is not possible to specify CRL numbers greater
897 # than 2**63-2 using hex notation in those versions.
898 #crl_number = 5
899
900 # Specify the update dates more precisely.
901 #crl_this_update_date = "2004-02-29 16:21:42"
902 #crl_next_update_date = "2025-02-29 16:24:41"
903
904 # The date that the certificates will be made seen as
905 # being revoked.
906 #crl_revocation_date = "2025-02-29 16:24:41"
907
908
909
911 Generating private keys
912 To create an RSA private key, run:
913 $ certtool --generate-privkey --outfile key.pem --rsa
914
915 To create a DSA or elliptic curves (ECDSA) private key use the above
916 command combined with 'dsa' or 'ecc' options.
917
918 Generating certificate requests
919 To create a certificate request (needed when the certificate is issued
920 by another party), run:
921 certtool --generate-request --load-privkey key.pem --outfile request.pem
922
923 If the private key is stored in a smart card you can generate a request
924 by specifying the private key object URL.
925 $ ./certtool --generate-request --load-privkey "pkcs11:..." --load-pubkey "pkcs11:..." --outfile request.pem
926
927
928 Generating a self-signed certificate
929 To create a self signed certificate, use the command:
930 $ certtool --generate-privkey --outfile ca-key.pem
931 $ certtool --generate-self-signed --load-privkey ca-key.pem --outfile ca-cert.pem
932
933 Note that a self-signed certificate usually belongs to a certificate
934 authority, that signs other certificates.
935
936 Generating a certificate
937 To generate a certificate using the previous request, use the command:
938 $ certtool --generate-certificate --load-request request.pem --outfile cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
939
940 To generate a certificate using the private key only, use the command:
941 $ certtool --generate-certificate --load-privkey key.pem --outfile cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
942
943 Certificate information
944 To view the certificate information, use:
945 $ certtool --certificate-info --infile cert.pem
946
947 Changing the certificate format
948 To convert the certificate from PEM to DER format, use:
949 $ certtool --certificate-info --infile cert.pem --outder --outfile cert.der
950
951 PKCS #12 structure generation
952 To generate a PKCS #12 structure using the previous key and certifi‐
953 cate, use the command:
954 $ certtool --load-certificate cert.pem --load-privkey key.pem --to-p12 --outder --outfile key.p12
955
956 Some tools (reportedly web browsers) have problems with that file be‐
957 cause it does not contain the CA certificate for the certificate. To
958 work around that problem in the tool, you can use the --load-ca-cer‐
959 tificate parameter as follows:
960
961 $ certtool --load-ca-certificate ca.pem --load-certificate cert.pem --load-privkey key.pem --to-p12 --outder --outfile key.p12
962
963 Obtaining Diffie-Hellman parameters
964 To obtain the RFC7919 parameters for Diffie-Hellman key exchange, use
965 the command:
966 $ certtool --get-dh-params --outfile dh.pem --sec-param medium
967
968 Verifying a certificate
969 To verify a certificate in a file against the system's CA trust store
970 use the following command:
971 $ certtool --verify --infile cert.pem
972
973 It is also possible to simulate hostname verification with the follow‐
974 ing options:
975 $ certtool --verify --verify-hostname www.example.com --infile cert.pem
976
977
978 Proxy certificate generation
979 Proxy certificate can be used to delegate your credential to a tempo‐
980 rary, typically short-lived, certificate. To create one from the pre‐
981 viously created certificate, first create a temporary key and then gen‐
982 erate a proxy certificate for it, using the commands:
983
984 $ certtool --generate-privkey > proxy-key.pem
985 $ certtool --generate-proxy --load-ca-privkey key.pem --load-privkey proxy-key.pem --load-certificate cert.pem --outfile proxy-cert.pem
986
987 Certificate revocation list generation
988 To create an empty Certificate Revocation List (CRL) do:
989
990 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem --load-ca-certificate x509-ca.pem
991
992 To create a CRL that contains some revoked certificates, place the cer‐
993 tificates in a file and use --load-certificate as follows:
994
995 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem --load-ca-certificate x509-ca.pem --load-certificate revoked-certs.pem
996
997 To verify a Certificate Revocation List (CRL) do:
998
999 $ certtool --verify-crl --load-ca-certificate x509-ca.pem < crl.pem
1000
1002 One of the following exit values will be returned:
1003
1004 0 (EXIT_SUCCESS)
1005 Successful program execution.
1006
1007 1 (EXIT_FAILURE)
1008 The operation failed or the command syntax was not valid.
1009
1011 p11tool (1), psktool (1), srptool (1)
1012
1015 Copyright (C) 2020-2021 Free Software Foundation, and others all rights
1016 reserved. This program is released under the terms of the GNU General
1017 Public License, version 3 or later
1018
1020 Please send bug reports to: bugs@gnutls.org
1021
1022
1023
10243.7.6 27 May 2022 certtool(1)