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";
154 name
= simple
-numbers
;
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";
281 descrip
= "Generate DSA key";
287 descrip
= "Generate ECC (ECDSA) key";
294 descrip
= "Hash algorithm to use for signing.";
295 doc
= "Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512.";
300 descrip
= "Use DER format for input certificates and private keys.";
303 doc
= "The input files will be assumed to be in DER or RAW format.
304 Unlike options that in PEM input would allow multiple input data (e.g. multiple
305 certificates), when reading in DER format a single data structure is read.";
315 descrip
= "Use DER format for output certificates and private keys";
318 doc
= "The output will be in DER or RAW format.";
329 descrip
= "Specify the number of bits for key generate";
336 arg
-name
= "Security parameter";
337 descrip
= "Specify the security level [low, legacy, normal, high, ultra].";
338 doc
= "This is alternative to the bits option.";
342 name
= disable
-quick
-random
;
343 descrip
= "No effect";
351 descrip
= "Template file to use for non-interactive operation";
359 descrip
= "Cipher to use for PKCS #8 and #12 operations";
360 doc
= "Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour.";
364 ds
-type
= 'SEE ALSO';
372 ds
-type
= 'EXAMPLES';
375 @subheading Generating private keys
376 To create an RSA private key
, run
:
378 $ certtool
--generate
-privkey
--outfile key.pem
--rsa
381 To create a DSA or elliptic
curves (ECDSA
) private key use the
382 above command combined with
'dsa' or
'ecc' options.
384 @subheading Generating certificate requests
385 To create a certificate
request (needed when the certificate is issued by
388 certtool
--generate
-request
--load
-privkey key.pem \
389 --outfile request.pem
392 If the private key is stored in a smart card you can generate
393 a request by specifying the private key object URL.
395 $ .
/certtool
--generate
-request
--load
-privkey
"pkcs11:..." \
396 --load
-pubkey
"pkcs11:..." --outfile request.pem
400 @subheading Generating a self
-signed certificate
401 To create a self signed certificate
, use the command
:
403 $ certtool
--generate
-privkey
--outfile ca
-key.pem
404 $ certtool
--generate
-self
-signed
--load
-privkey ca
-key.pem \
405 --outfile ca
-cert.pem
408 Note that a self
-signed certificate usually belongs to a certificate
409 authority
, that signs other certificates.
411 @subheading Generating a certificate
412 To generate a certificate using the previous request
, use the command
:
414 $ certtool
--generate
-certificate
--load
-request request.pem \
415 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
416 --load
-ca
-privkey ca
-key.pem
419 To generate a certificate using the private key only
, use the command
:
421 $ certtool
--generate
-certificate
--load
-privkey key.pem \
422 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
423 --load
-ca
-privkey ca
-key.pem
426 @subheading Certificate information
427 To view the certificate information
, use
:
429 $ certtool
--certificate
-info
--infile cert.pem
432 @subheading PKCS #
12 structure generation
433 To generate a PKCS #
12 structure using the previous key and certificate
,
436 $ certtool
--load
-certificate cert.pem
--load
-privkey key.pem \
437 --to
-p12
--outder
--outfile key.p12
440 Some
tools (reportedly web browsers
) have problems with that file
441 because it does not contain the CA certificate for the certificate.
442 To work around that problem in the tool
, you can use the
443 --load
-ca
-certificate parameter as follows
:
446 $ certtool
--load
-ca
-certificate ca.pem \
447 --load
-certificate cert.pem
--load
-privkey key.pem \
448 --to
-p12
--outder
--outfile key.p12
451 @subheading Diffie
-Hellman parameter generation
452 To generate parameters for Diffie
-Hellman key exchange
, use the command
:
454 $ certtool
--generate
-dh
-params
--outfile dh.pem
--sec
-param normal
457 @subheading Proxy certificate generation
458 Proxy certificate can be used to delegate your credential to a
459 temporary
, typically short
-lived
, certificate. To create one from the
460 previously created certificate
, first create a temporary key and then
461 generate a proxy certificate for it
, using the commands
:
464 $ certtool
--generate
-privkey
> proxy
-key.pem
465 $ certtool
--generate
-proxy
--load
-ca
-privkey key.pem \
466 --load
-privkey proxy
-key.pem
--load
-certificate cert.pem \
467 --outfile proxy
-cert.pem
470 @subheading Certificate revocation list generation
471 To create an empty Certificate Revocation
List (CRL
) do
:
474 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
475 --load
-ca
-certificate x509
-ca.pem
478 To create a CRL that contains some revoked certificates
, place the
479 certificates in a file and use @code
{--load
-certificate
} as follows
:
482 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
483 --load
-ca
-certificate x509
-ca.pem
--load
-certificate revoked
-certs.pem
486 To verify a Certificate Revocation
List (CRL
) do
:
489 $ certtool
--verify
-crl
--load
-ca
-certificate x509
-ca.pem
< crl.pem
499 @subheading Certtool
's template file format
500 A template file can be used to avoid the interactive questions of
501 certtool. Initially create a file named 'cert.cfg
' that contains the information
502 about the certificate. The template can be used as below:
505 $ certtool --generate-certificate cert.pem --load-privkey key.pem \
506 --template cert.cfg \
507 --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
510 An example certtool template file that can be used to generate a certificate
511 request or a self signed certificate follows.
514 # X.509 Certificate options
518 # The organization of the subject.
519 organization = "Koko inc."
521 # The organizational unit of the subject.
522 unit = "sleeping dept."
524 # The locality of the subject.
527 # The state of the certificate owner.
530 # The country of the subject. Two letter code.
533 # The common name of the certificate owner.
536 # A user id of the certificate owner.
539 # Set domain components
543 # If the supported DN OIDs are not adequate you can set
545 # For example set the X.520 Title and the X.520 Pseudonym
546 # by using OID and string pairs.
547 #dn_oid = 2.5.4.12 Dr.
548 #dn_oid = 2.5.4.65 jackal
550 # This is deprecated and should not be used in new
552 # pkcs9_email = "none@@none.org"
554 # The serial number of the certificate
557 # In how many days, counting from today, this certificate will expire.
558 expiration_days = 700
560 # X.509 v3 extensions
562 # A dnsname in case of a WWW server.
563 #dns_name = "www.none.org"
564 #dns_name = "www.morethanone.org"
566 # A subject alternative name URI
567 #uri = "http://www.example.com"
569 # An IP address in case of a server.
570 #ip_address = "192.168.1.1"
572 # An email in case of a person
573 email = "none@@none.org"
575 # Challenge password used in certificate requests
576 challenge_passwd = 123456
578 # An URL that has CRLs (certificate revocation lists)
579 # available. Needed in CA certificates.
580 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
582 # Whether this is a CA certificate or not
585 # for microsoft smart card logon
586 # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
588 ### Other predefined key purpose OIDs
590 # Whether this certificate will be used for a TLS client
593 # Whether this certificate will be used for a TLS server
596 # Whether this certificate will be used to sign data (needed
597 # in TLS DHE ciphersuites).
600 # Whether this certificate will be used to encrypt data (needed
601 # in TLS RSA ciphersuites). Note that it is preferred to use different
602 # keys for encryption and signing.
605 # Whether this key will be used to sign other certificates.
608 # Whether this key will be used to sign CRLs.
611 # Whether this key will be used to sign code.
614 # Whether this key will be used to sign OCSP data.
617 # Whether this key will be used for time stamping.
620 # Whether this key will be used for IPsec IKE operations.
623 ### end of key purpose OIDs
625 # When generating a certificate from a certificate
626 # request, then honor the extensions stored in the request
627 # and store them in the real certificate.
628 #honor_crq_extensions
630 # Path length contraint. Sets the maximum number of
631 # certificates that can be used to certify this certificate.
632 # (i.e. the certificate chain length)
637 # ocsp_uri = http://my.ocsp.server/ocsp
640 # ca_issuers_uri = http://my.ca.issuer
642 # Certificate policies
643 # policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0
644 # policy1_txt = "This is a long policy to summarize"
645 # policy1_url = http://www.example.com/a-policy-to-read
647 # policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1
648 # policy2_txt = "This is a short policy"
649 # policy2_url = http://www.example.com/another-policy-to-read
652 # Options for proxy certificates
653 # proxy_policy_language = 1.3.6.1.5.5.7.21.1
656 # Options for generating a CRL
658 # next CRL update will be in 43 days (wow)
659 #crl_next_update = 43
661 # this is the 5th CRL by this CA