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