Fix CVE-2017-6891 in minitasn1 code
[platform/upstream/gnutls.git] / src / certtool-args.def
1 AutoGen Definitions options;
2 prog-name     = certtool;
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
9 The tool accepts files or URLs supported by GnuTLS. In case PIN is required for the URL
10 access you can provide it using the environment variables GNUTLS_PIN and GNUTLS_SO_PIN.
11 ";
12 short-usage   = "certtool [options]\ncerttool --help for usage instructions.\n";
13 explain       = "";
14
15 #define  INFILE_OPT    1
16 #define  OUTFILE_OPT   1
17 #define  VERBOSE_OPT 1
18 #include args-std.def
19
20 flag = {
21     name      = generate-self-signed;
22     value     = s;
23     descrip   = "Generate a self-signed certificate";
24     doc = "";
25 };
26
27 flag = {
28     name      = generate-certificate;
29     value     = c;
30     descrip   = "Generate a signed certificate";
31     doc = "";
32 };
33
34 flag = {
35     name      = generate-proxy;
36     descrip   = "Generates a proxy certificate";
37     doc = "";
38 };
39
40 flag = {
41     name      = generate-crl;
42     descrip   = "Generate a CRL";
43     doc = "";
44 };
45
46 flag = {
47     name      = update-certificate;
48     value     = u;
49     descrip   = "Update a signed certificate";
50     doc = "";
51 };
52
53 flag = {
54     name      = generate-privkey;
55     value     = p;
56     descrip   = "Generate a private key";
57     doc = "";
58 };
59
60 flag = {
61     name      = generate-request;
62     value     = q;
63     descrip   = "Generate a PKCS #10 certificate request";
64     flags_cant = infile;
65     doc = "Will generate a PKCS #10 certificate request. To specify a private key use --load-privkey.";
66 };
67
68 flag = {
69     name      = verify-chain;
70     value     = e;
71     descrip   = "Verify a PEM encoded certificate chain";
72     doc = "The last certificate in the chain must be a self signed one.";
73 };
74
75 flag = {
76     name      = verify;
77     descrip   = "Verify a PEM encoded certificate chain using a trusted list";
78     doc = "The trusted certificate list can be loaded with --load-ca-certificate. If no
79 certificate list is provided, then the system's certificate list is used.";
80 };
81
82 flag = {
83     name      = verify-crl;
84     descrip   = "Verify a CRL using a trusted list";
85     doc = "The trusted certificate list must be loaded with --load-ca-certificate.";
86     flags-must = load-ca-certificate;
87 };
88
89 flag = {
90     name      = generate-dh-params;
91     descrip   = "Generate PKCS #3 encoded Diffie-Hellman parameters";
92     doc = "";
93 };
94
95 flag = {
96     name      = get-dh-params;
97     descrip   = "Get the included PKCS #3 encoded Diffie-Hellman parameters";
98     doc = "Returns stored DH parameters in GnuTLS. Those parameters are used in the SRP protocol. The parameters returned by fresh generation
99 are more efficient since GnuTLS 3.0.9.";
100 };
101
102 flag = {
103     name      = dh-info;
104     descrip   = "Print information PKCS #3 encoded Diffie-Hellman parameters";
105     doc = "";
106 };
107
108 flag = {
109     name      = load-privkey;
110     descrip   = "Loads a private key file";
111     arg-type  = string;
112     doc = "This can be either a file or a PKCS #11 URL";
113 };
114
115 flag = {
116     name      = load-pubkey;
117     descrip   = "Loads a public key file";
118     arg-type  = string;
119     doc = "This can be either a file or a PKCS #11 URL";
120 };
121
122 flag = {
123     name      = load-request;
124     descrip   = "Loads a certificate request file";
125     arg-type  = string;
126     doc = "This option can be used with a file";
127 };
128
129 flag = {
130     name      = load-certificate;
131     descrip   = "Loads a certificate file";
132     arg-type  = string;
133     doc = "This option can be used with a file";
134 };
135
136 flag = {
137     name      = load-ca-privkey;
138     descrip   = "Loads the certificate authority's private key file";
139     arg-type  = string;
140     doc = "This can be either a file or a PKCS #11 URL";
141 };
142
143 flag = {
144     name      = load-ca-certificate;
145     descrip   = "Loads the certificate authority's certificate file";
146     arg-type  = string;
147     doc = "This option can be used with a file";
148 };
149
150 flag = {
151     name      = password;
152     arg-type  = string;
153     descrip   = "Password to use";
154     doc   = "You can use this option to specify the password in the command line instead of reading it from the tty. Note, that the command line arguments are available for view in others in the system. Specifying password as '' is the same as specifying no password.";
155 };
156
157 flag = {
158     name      = null-password;
159     descrip   = "Enforce a NULL password";
160     doc   = "This option enforces a NULL password. This is different than the empty or no password in schemas like PKCS #8.";
161 };
162
163 flag = {
164     name      = empty-password;
165     descrip   = "Enforce an empty password";
166     doc   = "This option enforces an empty password. This is different than the NULL or no password in schemas like PKCS #8.";
167 };
168
169
170 flag = {
171     name      = hex-numbers;
172     descrip   = "Print big number in an easier format to parse";
173     doc   = "";
174 };
175
176 flag = {
177     name      = cprint;
178     descrip   = "In certain operations it prints the information in C-friendly format";
179     doc   = "In certain operations it prints the information in C-friendly format, suitable for including into C programs.";
180 };
181
182 flag = {
183     name      = certificate-info;
184     value     = i;
185     descrip   = "Print information on the given certificate";
186     doc       = "";
187 };
188
189 flag = {
190     name      = certificate-pubkey;
191     descrip   = "Print certificate's public key";
192     doc       = "";
193 };
194
195 flag = {
196     name      = pgp-certificate-info;
197     descrip   = "Print information on the given OpenPGP certificate";
198     doc       = "";
199 };
200
201 flag = {
202     name      = pgp-ring-info;
203     descrip   = "Print information on the given OpenPGP keyring structure";
204     doc       = "";
205 };
206
207 flag = {
208     name      = crl-info;
209     value     = l;
210     descrip   = "Print information on the given CRL structure";
211     doc       = "";
212 };
213
214 flag = {
215     name      = crq-info;
216     descrip   = "Print information on the given certificate request";
217     doc       = "";
218 };
219
220
221 flag = {
222     name      = no-crq-extensions;
223     descrip   = "Do not use extensions in certificate requests";
224     doc       = "";
225 };
226
227 flag = {
228     name      = p12-info;
229     descrip   = "Print information on a PKCS #12 structure";
230     doc       = "";
231 };
232
233 flag = {
234     name      = p12-name;
235     arg-type  = string;
236     descrip   = "The PKCS #12 friendly name to use";
237     doc = "The name to be used for the primary certificate and private key in a PKCS #12 file.";
238 };
239
240 flag = {
241     name      = p7-info;
242     descrip   = "Print information on a PKCS #7 structure";
243     doc       = "";
244 };
245
246 flag = {
247     name      = smime-to-p7;
248     descrip   = "Convert S/MIME to PKCS #7 structure";
249     doc       = "";
250 };
251
252 flag = {
253     name      = key-info;
254     value     = k;
255     descrip   = "Print information on a private key";
256     doc = "";
257 };
258
259 flag = {
260     name      = pgp-key-info;
261     descrip   = "Print information on an OpenPGP private key";
262     doc = "";
263 };
264
265 flag = {
266     name      = pubkey-info;
267     descrip   = "Print information on a public key";
268     doc = "The option combined with --load-request, --load-pubkey, --load-privkey and --load-certificate will extract the public key of the object in question.";
269 };
270
271 flag = {
272     name      = v1;
273     descrip   = "Generate an X.509 version 1 certificate (with no extensions)";
274     doc = "";
275 };
276
277 flag = {
278     name      = to-p12;
279     descrip   = "Generate a PKCS #12 structure";
280     doc = "It requires a certificate, a private key and possibly a CA certificate to be specified.";
281     flags-must = load-certificate;
282 };
283
284 flag = {
285     name      = to-p8;
286     descrip   = "Generate a PKCS #8 structure";
287     doc = "";
288 };
289
290 flag = {
291     name      = pkcs8;
292     value     = 8;
293     descrip   = "Use PKCS #8 format for private keys";
294     doc = "";
295 };
296
297 flag = {
298     name      = rsa;
299     descrip   = "Generate RSA key";
300     doc = "When combined with --generate-privkey generates an RSA private key.";
301 };
302
303 flag = {
304     name      = dsa;
305     descrip   = "Generate DSA key";
306     doc = "When combined with --generate-privkey generates a DSA private key.";
307 };
308
309 flag = {
310     name      = ecc;
311     descrip   = "Generate ECC (ECDSA) key";
312     doc = "When combined with --generate-privkey generates an elliptic curve private key to be used with ECDSA.";
313 };
314
315 flag = {
316     name      = ecdsa;
317     aliases   = ecc;
318 };
319
320 flag = {
321     name      = hash;
322     arg-type  = string;
323     descrip   = "Hash algorithm to use for signing";
324     doc = "Available hash functions are SHA1, RMD160, SHA256, SHA384, SHA512.";
325 };
326
327 flag = {
328     name      = inder;
329     descrip   = "Use DER format for input certificates, private keys, and DH parameters ";
330     disabled;
331     disable   = "no";
332     doc       = "The input files will be assumed to be in DER or RAW format. 
333 Unlike options that in PEM input would allow multiple input data (e.g. multiple 
334 certificates), when reading in DER format a single data structure is read.";
335 };
336
337 flag = {
338     name      = inraw;
339     aliases   = inder;
340 };
341
342 flag = {
343     name      = outder;
344     descrip   = "Use DER format for output certificates, private keys, and DH parameters";
345     disabled;
346     disable   = "no";
347     doc       = "The output will be in DER or RAW format.";
348 };
349
350 flag = {
351     name      = outraw;
352     aliases   = outder;
353 };
354
355 flag = {
356     name      = bits;
357     arg-type  = number;
358     descrip   = "Specify the number of bits for key generate";
359     doc      = "";
360 };
361
362 flag = {
363     name      = curve;
364     arg-type  = string;
365     descrip   = "Specify the curve used for EC key generation";
366     doc      = "Supported values are secp192r1, secp224r1, secp256r1, secp384r1 and secp521r1.";
367 };
368
369 flag = {
370     name      = sec-param;
371     arg-type  = string;
372     arg-name  = "Security parameter";
373     descrip   = "Specify the security level [low, legacy, medium, high, ultra]";
374     doc      = "This is alternative to the bits option.";
375 };
376
377 flag = {
378     name      = disable-quick-random;
379     descrip   = "No effect";
380     doc      = "";
381 };
382
383 flag = {
384     name      = template;
385     arg-type  = string;
386     descrip   = "Template file to use for non-interactive operation";
387     doc   = "";
388 };
389
390 flag = {
391     name      = stdout-info;
392     descrip   = "Print information to stdout instead of stderr";
393     doc = "";
394 };
395
396 flag = {
397     name      = ask-pass;
398     disabled;
399     descrip   = "Enable interaction for entering password when in batch mode.";
400     doc   = "This option will enable interaction to enter password when in batch mode. That is useful when the template option has been specified.";
401 };
402
403 flag = {
404     name      = pkcs-cipher;
405     arg-type  = string;
406     arg-name  = "Cipher";
407     descrip   = "Cipher to use for PKCS #8 and #12 operations";
408     doc   = "Cipher may be one of 3des, 3des-pkcs12, aes-128, aes-192, aes-256, rc2-40, arcfour.";
409 };
410
411 flag = {
412     name      = provider;
413     arg-type  = string;
414     descrip   = "Specify the PKCS #11 provider library";
415     doc      = "This will override the default options in /etc/gnutls/pkcs11.conf";
416 };
417
418 doc-section = {
419   ds-type = 'SEE ALSO';
420   ds-format = 'texi';
421   ds-text   = <<-_EOT_
422     p11tool (1)
423 _EOT_;
424 };
425
426 doc-section = {
427   ds-type = 'EXAMPLES';
428   ds-format = 'texi';
429   ds-text   = <<-_EOT_
430 @subheading Generating private keys
431 To create an RSA private key, run:
432 @example
433 $ certtool --generate-privkey --outfile key.pem --rsa
434 @end example
435
436 To create a DSA or elliptic curves (ECDSA) private key use the
437 above command combined with 'dsa' or 'ecc' options.
438
439 @subheading Generating certificate requests
440 To create a certificate request (needed when the certificate is  issued  by
441 another party), run:
442 @example
443 certtool --generate-request --load-privkey key.pem \
444    --outfile request.pem
445 @end example
446
447 If the private key is stored in a smart card you can generate
448 a request by specifying the private key object URL.
449 @example
450 $ ./certtool --generate-request --load-privkey "pkcs11:..." \
451   --load-pubkey "pkcs11:..." --outfile request.pem
452 @end example
453
454
455 @subheading Generating a self-signed certificate
456 To create a self signed certificate, use the command:
457 @example
458 $ certtool --generate-privkey --outfile ca-key.pem
459 $ certtool --generate-self-signed --load-privkey ca-key.pem \
460    --outfile ca-cert.pem
461 @end example
462
463 Note that a self-signed certificate usually belongs to a certificate
464 authority, that signs other certificates.
465
466 @subheading Generating a certificate
467 To generate a certificate using the previous request, use the command:
468 @example
469 $ certtool --generate-certificate --load-request request.pem \
470    --outfile cert.pem --load-ca-certificate ca-cert.pem \
471    --load-ca-privkey ca-key.pem
472 @end example
473
474 To generate a certificate using the private key only, use the command:
475 @example
476 $ certtool --generate-certificate --load-privkey key.pem \
477    --outfile cert.pem --load-ca-certificate ca-cert.pem \
478    --load-ca-privkey ca-key.pem
479 @end example
480
481 @subheading Certificate information
482 To view the certificate information, use:
483 @example
484 $ certtool --certificate-info --infile cert.pem
485 @end example
486
487 @subheading PKCS #12 structure generation
488 To generate a PKCS #12 structure using the previous key and certificate,
489 use the command:
490 @example
491 $ certtool --load-certificate cert.pem --load-privkey key.pem \
492    --to-p12 --outder --outfile key.p12
493 @end example
494
495 Some tools (reportedly web browsers) have problems with that file
496 because it does not contain the CA certificate for the certificate.
497 To work around that problem in the tool, you can use the
498 --load-ca-certificate parameter as follows:
499
500 @example
501 $ certtool --load-ca-certificate ca.pem \
502   --load-certificate cert.pem --load-privkey key.pem \
503   --to-p12 --outder --outfile key.p12
504 @end example
505
506 @subheading Diffie-Hellman parameter generation
507 To generate parameters for Diffie-Hellman key exchange, use the command:
508 @example
509 $ certtool --generate-dh-params --outfile dh.pem --sec-param medium
510 @end example
511
512 @subheading Proxy certificate generation
513 Proxy certificate can be used to delegate your credential to a
514 temporary, typically short-lived, certificate.  To create one from the
515 previously created certificate, first create a temporary key and then
516 generate a proxy certificate for it, using the commands:
517
518 @example
519 $ certtool --generate-privkey > proxy-key.pem
520 $ certtool --generate-proxy --load-ca-privkey key.pem \
521   --load-privkey proxy-key.pem --load-certificate cert.pem \
522   --outfile proxy-cert.pem
523 @end example
524
525 @subheading Certificate revocation list generation
526 To create an empty Certificate Revocation List (CRL) do:
527
528 @example
529 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
530            --load-ca-certificate x509-ca.pem
531 @end example
532
533 To create a CRL that contains some revoked certificates, place the
534 certificates in a file and use @code{--load-certificate} as follows:
535
536 @example
537 $ certtool --generate-crl --load-ca-privkey x509-ca-key.pem \
538   --load-ca-certificate x509-ca.pem --load-certificate revoked-certs.pem
539 @end example
540
541 To verify a Certificate Revocation List (CRL) do:
542
543 @example
544 $ certtool --verify-crl --load-ca-certificate x509-ca.pem < crl.pem
545 @end example
546 _EOT_;
547 };
548
549
550 doc-section = {
551   ds-type = 'FILES';
552   ds-format = 'texi';
553   ds-text   = <<-_EOT_
554 @subheading Certtool's template file format
555 A template file can be used to avoid the interactive questions of
556 certtool. Initially create a file named 'cert.cfg' that contains the information
557 about the certificate. The template can be used as below:
558
559 @example
560 $ certtool --generate-certificate --load-privkey key.pem  \
561    --template cert.cfg --outfile cert.pem \
562    --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem
563 @end example
564
565 An example certtool template file that can be used to generate a certificate
566 request or a self signed certificate follows.
567
568 @example
569 # X.509 Certificate options
570 #
571 # DN options
572
573 # The organization of the subject.
574 organization = "Koko inc."
575
576 # The organizational unit of the subject.
577 unit = "sleeping dept."
578
579 # The locality of the subject.
580 # locality =
581
582 # The state of the certificate owner.
583 state = "Attiki"
584
585 # The country of the subject. Two letter code.
586 country = GR
587
588 # The common name of the certificate owner.
589 cn = "Cindy Lauper"
590
591 # A user id of the certificate owner.
592 #uid = "clauper"
593
594 # Set domain components
595 #dc = "name"
596 #dc = "domain"
597
598 # If the supported DN OIDs are not adequate you can set
599 # any OID here.
600 # For example set the X.520 Title and the X.520 Pseudonym
601 # by using OID and string pairs.
602 #dn_oid = 2.5.4.12 Dr. 
603 #dn_oid = 2.5.4.65 jackal
604
605 # This is deprecated and should not be used in new
606 # certificates.
607 # pkcs9_email = "none@@none.org"
608
609 # An alternative way to set the certificate's distinguished name directly
610 # is with the "dn" option. The attribute names allowed are:
611 # C (country), street, O (organization), OU (unit), title, CN (common name),
612 # L (locality), ST (state), placeOfBirth, gender, countryOfCitizenship, 
613 # countryOfResidence, serialNumber, telephoneNumber, surName, initials, 
614 # generationQualifier, givenName, pseudonym, dnQualifier, postalCode, name, 
615 # businessCategory, DC, UID, jurisdictionOfIncorporationLocalityName, 
616 # jurisdictionOfIncorporationStateOrProvinceName,
617 # jurisdictionOfIncorporationCountryName, XmppAddr, and numeric OIDs.
618
619 #dn = "cn=Nik,st=Attiki,C=GR,surName=Mavrogiannopoulos,2.5.4.9=Arkadias"
620
621 # The serial number of the certificate
622 # Comment the field for a time-based serial number.
623 serial = 007
624
625 # In how many days, counting from today, this certificate will expire.
626 # Use -1 if there is no expiration date.
627 expiration_days = 700
628
629 # Alternatively you may set concrete dates and time. The GNU date string 
630 # formats are accepted. See:
631 # http://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html
632
633 #activation_date = "2004-02-29 16:21:42"
634 #expiration_date = "2025-02-29 16:24:41"
635
636 # X.509 v3 extensions
637
638 # A dnsname in case of a WWW server.
639 #dns_name = "www.none.org"
640 #dns_name = "www.morethanone.org"
641
642 # A subject alternative name URI
643 #uri = "http://www.example.com"
644
645 # An IP address in case of a server.
646 #ip_address = "192.168.1.1"
647
648 # An email in case of a person
649 email = "none@@none.org"
650
651 # Challenge password used in certificate requests
652 challenge_password = 123456
653
654 # Password when encrypting a private key
655 #password = secret
656
657 # An URL that has CRLs (certificate revocation lists)
658 # available. Needed in CA certificates.
659 #crl_dist_points = "http://www.getcrl.crl/getcrl/"
660
661 # Whether this is a CA certificate or not
662 #ca
663
664 # Subject Unique ID (in hex)
665 #subject_unique_id = 00153224
666
667 # Issuer Unique ID (in hex)
668 #issuer_unique_id = 00153225
669
670 # for microsoft smart card logon
671 # key_purpose_oid = 1.3.6.1.4.1.311.20.2.2
672
673 ### Other predefined key purpose OIDs
674
675 # Whether this certificate will be used for a TLS client
676 #tls_www_client
677
678 # Whether this certificate will be used for a TLS server
679 #tls_www_server
680
681 # Whether this certificate will be used to sign data (needed
682 # in TLS DHE ciphersuites).
683 signing_key
684
685 # Whether this certificate will be used to encrypt data (needed
686 # in TLS RSA ciphersuites). Note that it is preferred to use different
687 # keys for encryption and signing.
688 encryption_key
689
690 # Whether this key will be used to sign other certificates.
691 #cert_signing_key
692
693 # Whether this key will be used to sign CRLs.
694 #crl_signing_key
695
696 # Whether this key will be used to sign code.
697 #code_signing_key
698
699 # Whether this key will be used to sign OCSP data.
700 #ocsp_signing_key
701
702 # Whether this key will be used for time stamping.
703 #time_stamping_key
704
705 # Whether this key will be used for IPsec IKE operations.
706 #ipsec_ike_key
707
708 ### end of key purpose OIDs
709
710 # When generating a certificate from a certificate
711 # request, then honor the extensions stored in the request
712 # and store them in the real certificate.
713 #honor_crq_extensions
714
715 # Path length contraint. Sets the maximum number of
716 # certificates that can be used to certify this certificate.
717 # (i.e. the certificate chain length)
718 #path_len = -1
719 #path_len = 2
720
721 # OCSP URI
722 # ocsp_uri = http://my.ocsp.server/ocsp
723
724 # CA issuers URI
725 # ca_issuers_uri = http://my.ca.issuer
726
727 # Certificate policies
728 #policy1 = 1.3.6.1.4.1.5484.1.10.99.1.0
729 #policy1_txt = "This is a long policy to summarize"
730 #policy1_url = http://www.example.com/a-policy-to-read
731
732 #policy2 = 1.3.6.1.4.1.5484.1.10.99.1.1
733 #policy2_txt = "This is a short policy"
734 #policy2_url = http://www.example.com/another-policy-to-read
735
736 # Name constraints
737
738 # DNS
739 #nc_permit_dns = example.com
740 #nc_exclude_dns = test.example.com
741
742 # EMAIL
743 #nc_permit_email = "nmav@@ex.net"
744
745 # Exclude subdomains of example.com
746 #nc_exclude_email = .example.com
747
748 # Exclude all e-mail addresses of example.com
749 #nc_exclude_email = example.com
750
751
752 # Options for proxy certificates
753 #proxy_policy_language = 1.3.6.1.5.5.7.21.1
754
755
756 # Options for generating a CRL
757
758 # The number of days the next CRL update will be due.
759 # next CRL update will be in 43 days
760 #crl_next_update = 43
761
762 # this is the 5th CRL by this CA
763 # Comment the field for a time-based number.
764 #crl_number = 5
765
766 @end example
767
768 _EOT_;
769 };
770