1 AutoGen Definitions options
;
3 prog
-title
= "GnuTLS certificate tool";
4 prog
-desc
= "Manipulate certificates and private keys.";
5 detail
= "Tool to parse and generate X.509 certificates, requests and private keys.
6 It can be used interactively or non interactively by
7 specifying the template command line option.";
8 short
-usage
= "certtool [options]\ncerttool --help for usage instructions.\n";
17 name
= generate
-self
-signed
;
19 descrip
= "Generate a self-signed certificate";
24 name
= generate
-certificate
;
26 descrip
= "Generate a signed certificate";
31 name
= generate
-proxy
;
32 descrip
= "Generates a proxy certificate";
38 descrip
= "Generate a CRL";
43 name
= update
-certificate
;
45 descrip
= "Update a signed certificate";
50 name
= generate
-privkey
;
52 descrip
= "Generate a private key";
57 name
= generate
-request
;
59 descrip
= "Generate a PKCS #10 certificate request";
66 descrip
= "Verify a PEM encoded certificate chain.";
67 doc
= "The last certificate in the chain must be a self signed one.";
72 descrip
= "Verify a PEM encoded certificate chain using a trusted list.";
73 doc
= "The trusted certificate list must be loaded with --load-ca-certificate.";
74 flags
-must
= load
-ca
-certificate
;
79 descrip
= "Verify a CRL using a trusted list.";
80 doc
= "The trusted certificate list must be loaded with --load-ca-certificate.";
81 flags
-must
= load
-ca
-certificate
;
85 name
= generate
-dh
-params
;
86 descrip
= "Generate PKCS #3 encoded Diffie-Hellman parameters.";
92 descrip
= "Get the included PKCS #3 encoded Diffie-Hellman parameters.";
93 doc
= "Returns stored DH parameters in GnuTLS. Those parameters are used in the SRP protocol. The parameters returned by fresh generation
94 are more efficient since GnuTLS 3.0.9.";
99 descrip
= "Print information PKCS #3 encoded Diffie-Hellman parameters";
105 descrip
= "Loads a private key file";
107 doc
= "This can be either a file or a PKCS #11 URL";
112 descrip
= "Loads a public key file";
114 doc
= "This can be either a file or a PKCS #11 URL";
119 descrip
= "Loads a certificate request file";
126 name
= load
-certificate
;
127 descrip
= "Loads a certificate file";
129 doc
= "This can be either a file or a PKCS #11 URL";
133 name
= load
-ca
-privkey
;
134 descrip
= "Loads the certificate authority's private key file";
136 doc
= "This can be either a file or a PKCS #11 URL";
140 name
= load
-ca
-certificate
;
141 descrip
= "Loads the certificate authority's certificate file";
143 doc
= "This can be either a file or a PKCS #11 URL";
149 descrip
= "Password to use";
155 descrip
= "Print big number in an easier format to parse";
160 name
= null
-password
;
161 descrip
= "Enforce a NULL password";
162 doc
= "This option enforces a NULL password. This may be different than the empty password in some schemas.";
166 name
= certificate
-info
;
168 descrip
= "Print information on the given certificate";
173 name
= certificate
-pubkey
;
174 descrip
= "Print certificate's public key";
179 name
= pgp
-certificate
-info
;
180 descrip
= "Print information on the given OpenPGP certificate";
185 name
= pgp
-ring
-info
;
186 descrip
= "Print information on the given OpenPGP keyring structure";
193 descrip
= "Print information on the given CRL structure";
199 descrip
= "Print information on the given certificate request";
205 name
= no
-crq
-extensions
;
206 descrip
= "Do not use extensions in certificate requests";
212 descrip
= "Print information on a PKCS #12 structure";
218 descrip
= "Print information on a PKCS #7 structure";
224 descrip
= "Convert S/MIME to PKCS #7 structure";
231 descrip
= "Print information on a private key";
237 descrip
= "Print information on an OpenPGP private key";
243 descrip
= "Print information on a public key";
244 doc
= "The option combined with --load-request, --load-pubkey, --load-privkey and --load-certificate will extract the public key of the object in question.";
249 descrip
= "Generate an X.509 version 1 certificate (with no extensions)";
255 descrip
= "Generate a PKCS #12 structure";
256 doc
= "It requires a certificate, a private key and possibly a CA certificate to be specified.";
257 flags
-must
= load
-certificate
;
262 descrip
= "Generate a PKCS #8 structure";
269 descrip
= "Use PKCS #8 format for private keys";
275 descrip
= "Generate RSA key";
276 doc
= "When combined with --generate-privkey generates an RSA private key.";
281 descrip
= "Generate DSA key";
282 doc
= "When combined with --generate-privkey generates a DSA private key.";
287 descrip
= "Generate ECC (ECDSA) key";
288 doc
= "When combined with --generate-privkey generates an elliptic curve private key to be used with ECDSA.";
299 descrip
= "Hash algorithm to use for signing.";
300 doc
= "Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512.";
305 descrip
= "Use DER format for input certificates and private keys.";
308 doc
= "The input files will be assumed to be in DER or RAW format.
309 Unlike options that in PEM input would allow multiple input data (e.g. multiple
310 certificates), when reading in DER format a single data structure is read.";
320 descrip
= "Use DER format for output certificates and private keys";
323 doc
= "The output will be in DER or RAW format.";
334 descrip
= "Specify the number of bits for key generate";
341 arg
-name
= "Security parameter";
342 descrip
= "Specify the security level [low, legacy, normal, high, ultra].";
343 doc
= "This is alternative to the bits option.";
347 name
= disable
-quick
-random
;
348 descrip
= "No effect";
356 descrip
= "Template file to use for non-interactive operation";
364 descrip
= "Cipher to use for PKCS #8 and #12 operations";
365 doc
= "Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour.";
369 ds
-type
= 'SEE ALSO';
377 ds
-type
= 'EXAMPLES';
380 @subheading Generating private keys
381 To create an RSA private key
, run
:
383 $ certtool
--generate
-privkey
--outfile key.pem
--rsa
386 To create a DSA or elliptic
curves (ECDSA
) private key use the
387 above command combined with
'dsa' or
'ecc' options.
389 @subheading Generating certificate requests
390 To create a certificate
request (needed when the certificate is issued by
393 certtool
--generate
-request
--load
-privkey key.pem \
394 --outfile request.pem
397 If the private key is stored in a smart card you can generate
398 a request by specifying the private key object URL.
400 $ .
/certtool
--generate
-request
--load
-privkey
"pkcs11:..." \
401 --load
-pubkey
"pkcs11:..." --outfile request.pem
405 @subheading Generating a self
-signed certificate
406 To create a self signed certificate
, use the command
:
408 $ certtool
--generate
-privkey
--outfile ca
-key.pem
409 $ certtool
--generate
-self
-signed
--load
-privkey ca
-key.pem \
410 --outfile ca
-cert.pem
413 Note that a self
-signed certificate usually belongs to a certificate
414 authority
, that signs other certificates.
416 @subheading Generating a certificate
417 To generate a certificate using the previous request
, use the command
:
419 $ certtool
--generate
-certificate
--load
-request request.pem \
420 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
421 --load
-ca
-privkey ca
-key.pem
424 To generate a certificate using the private key only
, use the command
:
426 $ certtool
--generate
-certificate
--load
-privkey key.pem \
427 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
428 --load
-ca
-privkey ca
-key.pem
431 @subheading Certificate information
432 To view the certificate information
, use
:
434 $ certtool
--certificate
-info
--infile cert.pem
437 @subheading PKCS #
12 structure generation
438 To generate a PKCS #
12 structure using the previous key and certificate
,
441 $ certtool
--load
-certificate cert.pem
--load
-privkey key.pem \
442 --to
-p12
--outder
--outfile key.p12
445 Some
tools (reportedly web browsers
) have problems with that file
446 because it does not contain the CA certificate for the certificate.
447 To work around that problem in the tool
, you can use the
448 --load
-ca
-certificate parameter as follows
:
451 $ certtool
--load
-ca
-certificate ca.pem \
452 --load
-certificate cert.pem
--load
-privkey key.pem \
453 --to
-p12
--outder
--outfile key.p12
456 @subheading Diffie
-Hellman parameter generation
457 To generate parameters for Diffie
-Hellman key exchange
, use the command
:
459 $ certtool
--generate
-dh
-params
--outfile dh.pem
--sec
-param normal
462 @subheading Proxy certificate generation
463 Proxy certificate can be used to delegate your credential to a
464 temporary
, typically short
-lived
, certificate. To create one from the
465 previously created certificate
, first create a temporary key and then
466 generate a proxy certificate for it
, using the commands
:
469 $ certtool
--generate
-privkey
> proxy
-key.pem
470 $ certtool
--generate
-proxy
--load
-ca
-privkey key.pem \
471 --load
-privkey proxy
-key.pem
--load
-certificate cert.pem \
472 --outfile proxy
-cert.pem
475 @subheading Certificate revocation list generation
476 To create an empty Certificate Revocation
List (CRL
) do
:
479 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
480 --load
-ca
-certificate x509
-ca.pem
483 To create a CRL that contains some revoked certificates
, place the
484 certificates in a file and use @code
{--load
-certificate
} as follows
:
487 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
488 --load
-ca
-certificate x509
-ca.pem
--load
-certificate revoked
-certs.pem
491 To verify a Certificate Revocation
List (CRL
) do
:
494 $ certtool
--verify
-crl
--load
-ca
-certificate x509
-ca.pem
< crl.pem
504 @subheading Certtool
's template file format
505 A template file can be used to avoid the interactive questions of
506 certtool. Initially create a file named 'cert.cfg
' that contains the information
507 about the certificate. The template can be used as below:
510 $ certtool --generate-certificate cert.pem --load-privkey key.pem \
511 --template cert.cfg \
512 --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
515 An example certtool template file that can be used to generate a certificate
516 request or a self signed certificate follows.
519 # X.509 Certificate options
523 # The organization of the subject.
524 organization = "Koko inc."
526 # The organizational unit of the subject.
527 unit = "sleeping dept."
529 # The locality of the subject.
532 # The state of the certificate owner.
535 # The country of the subject. Two letter code.
538 # The common name of the certificate owner.
541 # A user id of the certificate owner.
544 # Set domain components
548 # If the supported DN OIDs are not adequate you can set
550 # For example set the X.520 Title and the X.520 Pseudonym
551 # by using OID and string pairs.
552 #dn_oid = 2.5.4.12 Dr.
553 #dn_oid = 2.5.4.65 jackal
555 # This is deprecated and should not be used in new
557 # pkcs9_email = "none@@none.org"
559 # The serial number of the certificate
562 # In how many days, counting from today, this certificate will expire.
563 expiration_days = 700
565 # X.509 v3 extensions
567 # A dnsname in case of a WWW server.
568 #dns_name = "www.none.org"
569 #dns_name = "www.morethanone.org"
571 # A subject alternative name URI
572 #uri = "http://www.example.com"
574 # An IP address in case of a server.
575 #ip_address = "192.168.1.1"
577 # An email in case of a person
578 email = "none@@none.org"
580 # Challenge password used in certificate requests
581 challenge_passwd = 123456
583 # An URL that has CRLs (certificate revocation lists)
584 # available. Needed in CA certificates.
585 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
587 # Whether this is a CA certificate or not
590 # for microsoft smart card logon
591 # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
593 ### Other predefined key purpose OIDs
595 # Whether this certificate will be used for a TLS client
598 # Whether this certificate will be used for a TLS server
601 # Whether this certificate will be used to sign data (needed
602 # in TLS DHE ciphersuites).
605 # Whether this certificate will be used to encrypt data (needed
606 # in TLS RSA ciphersuites). Note that it is preferred to use different
607 # keys for encryption and signing.
610 # Whether this key will be used to sign other certificates.
613 # Whether this key will be used to sign CRLs.
616 # Whether this key will be used to sign code.
619 # Whether this key will be used to sign OCSP data.
622 # Whether this key will be used for time stamping.
625 # Whether this key will be used for IPsec IKE operations.
628 ### end of key purpose OIDs
630 # When generating a certificate from a certificate
631 # request, then honor the extensions stored in the request
632 # and store them in the real certificate.
633 #honor_crq_extensions
635 # Path length contraint. Sets the maximum number of
636 # certificates that can be used to certify this certificate.
637 # (i.e. the certificate chain length)
642 # ocsp_uri = http://my.ocsp.server/ocsp
645 # ca_issuers_uri = http://my.ca.issuer
647 # Certificate policies
648 # policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0
649 # policy1_txt = "This is a long policy to summarize"
650 # policy1_url = http://www.example.com/a-policy-to-read
652 # policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1
653 # policy2_txt = "This is a short policy"
654 # policy2_url = http://www.example.com/another-policy-to-read
657 # Options for proxy certificates
658 # proxy_policy_language = 1.3.6.1.5.5.7.21.1
661 # Options for generating a CRL
663 # next CRL update will be in 43 days (wow)
664 #crl_next_update = 43
666 # this is the 5th CRL by this CA