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
= null
-password
;
155 descrip
= "Enforce a NULL password";
156 doc
= "This option enforces a NULL password. This may be different than the empty password in some schemas.";
160 name
= certificate
-info
;
162 descrip
= "Print information on the given certificate";
167 name
= certificate
-pubkey
;
168 descrip
= "Print certificate's public key";
173 name
= pgp
-certificate
-info
;
174 descrip
= "Print information on the given OpenPGP certificate";
179 name
= pgp
-ring
-info
;
180 descrip
= "Print information on the given OpenPGP keyring structure";
187 descrip
= "Print information on the given CRL structure";
193 descrip
= "Print information on the given certificate request";
199 name
= no
-crq
-extensions
;
200 descrip
= "Do not use extensions in certificate requests";
206 descrip
= "Print information on a PKCS #12 structure";
212 descrip
= "Print information on a PKCS #7 structure";
218 descrip
= "Convert S/MIME to PKCS #7 structure";
225 descrip
= "Print information on a private key";
231 descrip
= "Print information on an OpenPGP private key";
237 descrip
= "Print information on a public key";
238 doc
= "The option combined with --load-pubkey, --load-privkey and --load-certificate will extract the public key of the object in question.";
243 descrip
= "Generate an X.509 version 1 certificate (with no extensions)";
249 descrip
= "Generate a PKCS #12 structure";
250 doc
= "It requires a certificate, a private key and possibly a CA certificate to be specified.";
251 flags
-must
= load
-certificate
;
256 descrip
= "Generate a PKCS #8 structure";
263 descrip
= "Use PKCS #8 format for private keys";
269 descrip
= "Generate RSA key";
275 descrip
= "Generate DSA key";
281 descrip
= "Generate ECC (ECDSA) key";
288 descrip
= "Hash algorithm to use for signing.";
289 doc
= "Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512.";
294 descrip
= "Use DER format for input certificates and private keys.";
297 doc
= "The input files will be assumed to be in DER or RAW format.
298 Unlike options that in PEM input would allow multiple input data (e.g. multiple
299 certificates), when reading in DER format a single data structure is read.";
309 descrip
= "Use DER format for output certificates and private keys";
312 doc
= "The output will be in DER or RAW format.";
323 descrip
= "Specify the number of bits for key generate";
330 arg
-name
= "Security parameter";
331 descrip
= "Specify the security level [low, legacy, normal, high, ultra].";
332 doc
= "This is alternative to the bits option.";
336 name
= disable
-quick
-random
;
337 descrip
= "No effect";
345 descrip
= "Template file to use for non-interactive operation";
353 descrip
= "Cipher to use for PKCS #8 and #12 operations";
354 doc
= "Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour.";
358 ds
-type
= 'SEE ALSO';
366 ds
-type
= 'EXAMPLES';
369 @subheading Generating private keys
370 To create an RSA private key
, run
:
372 $ certtool
--generate
-privkey
--outfile key.pem
--rsa
375 To create a DSA or elliptic
curves (ECDSA
) private key use the
376 above command combined with
'dsa' or
'ecc' options.
378 @subheading Generating certificate requests
379 To create a certificate
request (needed when the certificate is issued by
382 certtool
--generate
-request
--load
-privkey key.pem \
383 --outfile request.pem
386 If the private key is stored in a smart card you can generate
387 a request by specifying the private key object URL.
389 $ .
/certtool
--generate
-request
--load
-privkey
"pkcs11:..." \
390 --load
-pubkey
"pkcs11:..." --outfile request.pem
394 @subheading Generating a self
-signed certificate
395 To create a self signed certificate
, use the command
:
397 $ certtool
--generate
-privkey
--outfile ca
-key.pem
398 $ certtool
--generate
-self
-signed
--load
-privkey ca
-key.pem \
399 --outfile ca
-cert.pem
402 Note that a self
-signed certificate usually belongs to a certificate
403 authority
, that signs other certificates.
405 @subheading Generating a certificate
406 To generate a certificate using the previous request
, use the command
:
408 $ certtool
--generate
-certificate
--load
-request request.pem \
409 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
410 --load
-ca
-privkey ca
-key.pem
413 To generate a certificate using the private key only
, use the command
:
415 $ certtool
--generate
-certificate
--load
-privkey key.pem \
416 --outfile cert.pem
--load
-ca
-certificate ca
-cert.pem \
417 --load
-ca
-privkey ca
-key.pem
420 @subheading Certificate information
421 To view the certificate information
, use
:
423 $ certtool
--certificate
-info
--infile cert.pem
426 @subheading PKCS #
12 structure generation
427 To generate a PKCS #
12 structure using the previous key and certificate
,
430 $ certtool
--load
-certificate cert.pem
--load
-privkey key.pem \
431 --to
-p12
--outder
--outfile key.p12
434 Some
tools (reportedly web browsers
) have problems with that file
435 because it does not contain the CA certificate for the certificate.
436 To work around that problem in the tool
, you can use the
437 --load
-ca
-certificate parameter as follows
:
440 $ certtool
--load
-ca
-certificate ca.pem \
441 --load
-certificate cert.pem
--load
-privkey key.pem \
442 --to
-p12
--outder
--outfile key.p12
445 @subheading Diffie
-Hellman parameter generation
446 To generate parameters for Diffie
-Hellman key exchange
, use the command
:
448 $ certtool
--generate
-dh
-params
--outfile dh.pem
--sec
-param normal
451 @subheading Proxy certificate generation
452 Proxy certificate can be used to delegate your credential to a
453 temporary
, typically short
-lived
, certificate. To create one from the
454 previously created certificate
, first create a temporary key and then
455 generate a proxy certificate for it
, using the commands
:
458 $ certtool
--generate
-privkey
> proxy
-key.pem
459 $ certtool
--generate
-proxy
--load
-ca
-privkey key.pem \
460 --load
-privkey proxy
-key.pem
--load
-certificate cert.pem \
461 --outfile proxy
-cert.pem
464 @subheading Certificate revocation list generation
465 To create an empty Certificate Revocation
List (CRL
) do
:
468 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
469 --load
-ca
-certificate x509
-ca.pem
472 To create a CRL that contains some revoked certificates
, place the
473 certificates in a file and use @code
{--load
-certificate
} as follows
:
476 $ certtool
--generate
-crl
--load
-ca
-privkey x509
-ca
-key.pem \
477 --load
-ca
-certificate x509
-ca.pem
--load
-certificate revoked
-certs.pem
480 To verify a Certificate Revocation
List (CRL
) do
:
483 $ certtool
--verify
-crl
--load
-ca
-certificate x509
-ca.pem
< crl.pem
493 @subheading Certtool
's template file format
494 A template file can be used to avoid the interactive questions of
495 certtool. Initially create a file named 'cert.cfg
' that contains the information
496 about the certificate. The template can be used as below:
499 $ certtool --generate-certificate cert.pem --load-privkey key.pem \
500 --template cert.cfg \
501 --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
504 An example certtool template file that can be used to generate a certificate
505 request or a self signed certificate follows.
508 # X.509 Certificate options
512 # The organization of the subject.
513 organization = "Koko inc."
515 # The organizational unit of the subject.
516 unit = "sleeping dept."
518 # The locality of the subject.
521 # The state of the certificate owner.
524 # The country of the subject. Two letter code.
527 # The common name of the certificate owner.
530 # A user id of the certificate owner.
533 # Set domain components
537 # If the supported DN OIDs are not adequate you can set
539 # For example set the X.520 Title and the X.520 Pseudonym
540 # by using OID and string pairs.
541 #dn_oid = 2.5.4.12 Dr.
542 #dn_oid = 2.5.4.65 jackal
544 # This is deprecated and should not be used in new
546 # pkcs9_email = "none@@none.org"
548 # The serial number of the certificate
551 # In how many days, counting from today, this certificate will expire.
552 expiration_days = 700
554 # X.509 v3 extensions
556 # A dnsname in case of a WWW server.
557 #dns_name = "www.none.org"
558 #dns_name = "www.morethanone.org"
560 # A subject alternative name URI
561 #uri = "http://www.example.com"
563 # An IP address in case of a server.
564 #ip_address = "192.168.1.1"
566 # An email in case of a person
567 email = "none@@none.org"
569 # Challenge password used in certificate requests
570 challenge_passwd = 123456
572 # An URL that has CRLs (certificate revocation lists)
573 # available. Needed in CA certificates.
574 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
576 # Whether this is a CA certificate or not
579 # for microsoft smart card logon
580 # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
582 ### Other predefined key purpose OIDs
584 # Whether this certificate will be used for a TLS client
587 # Whether this certificate will be used for a TLS server
590 # Whether this certificate will be used to sign data (needed
591 # in TLS DHE ciphersuites).
594 # Whether this certificate will be used to encrypt data (needed
595 # in TLS RSA ciphersuites). Note that it is preferred to use different
596 # keys for encryption and signing.
599 # Whether this key will be used to sign other certificates.
602 # Whether this key will be used to sign CRLs.
605 # Whether this key will be used to sign code.
608 # Whether this key will be used to sign OCSP data.
611 # Whether this key will be used for time stamping.
614 # Whether this key will be used for IPsec IKE operations.
617 ### end of key purpose OIDs
619 # When generating a certificate from a certificate
620 # request, then honor the extensions stored in the request
621 # and store them in the real certificate.
622 #honor_crq_extensions
624 # Path length contraint. Sets the maximum number of
625 # certificates that can be used to certify this certificate.
626 # (i.e. the certificate chain length)
631 # ocsp_uri = http://my.ocsp.server/ocsp
634 # ca_issuers_uri = http://my.ca.issuer
636 # Options for proxy certificates
637 # proxy_policy_language = 1.3.6.1.5.5.7.21.1
639 # Options for generating a CRL
641 # next CRL update will be in 43 days (wow)
642 #crl_next_update = 43
644 # this is the 5th CRL by this CA