From: Nikos Mavrogiannopoulos Date: Mon, 21 Jan 2013 08:37:35 +0000 (+0100) Subject: Added --cprint option to certtool X-Git-Tag: gnutls_3_1_7~99 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9ebf620efbcdfbabbcd1db38c67acb24eb356d87;p=thirdparty%2Fgnutls.git Added --cprint option to certtool --- diff --git a/src/Makefile.am b/src/Makefile.am index 3059dd1475..2794a1f654 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -127,7 +127,7 @@ libcmd_cli_debug_la_SOURCES = cli-debug-args.def cli-debug-args.c cli-debug-args #certtool -certtool_SOURCES = certtool.c dh.c certtool-common.c certtool-extras.c common.c +certtool_SOURCES = certtool.c certtool-common.c certtool-extras.c common.c certtool_LDADD = ../lib/libgnutls.la certtool_LDADD += libcmd-certtool.la ../gl/libgnu.la diff --git a/src/certtool-args.c b/src/certtool-args.c index 3f861b7bac..af12b72ed7 100644 --- a/src/certtool-args.c +++ b/src/certtool-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (certtool-args.c) * - * It has been AutoGen-ed January 15, 2013 at 11:30:45 PM by AutoGen 5.16 + * It has been AutoGen-ed January 21, 2013 at 09:27:02 AM by AutoGen 5.16 * From the definitions certtool-args.def * and the template file options * @@ -67,7 +67,7 @@ extern FILE * option_usage_fp; /* * certtool option static const strings */ -static char const certtool_opt_strs[4794] = +static char const certtool_opt_strs[4877] = /* 0 */ "certtool @VERSION@\n" "Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" @@ -159,117 +159,120 @@ static char const certtool_opt_strs[4794] = /* 2327 */ "Print big number in an easier format to parse\0" /* 2373 */ "HEX_NUMBERS\0" /* 2385 */ "hex-numbers\0" -/* 2397 */ "Enforce a NULL password\0" -/* 2421 */ "NULL_PASSWORD\0" -/* 2435 */ "null-password\0" -/* 2449 */ "Print information on the given certificate\0" -/* 2492 */ "CERTIFICATE_INFO\0" -/* 2509 */ "certificate-info\0" -/* 2526 */ "Print certificate's public key\0" -/* 2557 */ "CERTIFICATE_PUBKEY\0" -/* 2576 */ "certificate-pubkey\0" -/* 2595 */ "Print information on the given OpenPGP certificate\0" -/* 2646 */ "PGP_CERTIFICATE_INFO\0" -/* 2667 */ "pgp-certificate-info\0" -/* 2688 */ "Print information on the given OpenPGP keyring structure\0" -/* 2745 */ "PGP_RING_INFO\0" -/* 2759 */ "pgp-ring-info\0" -/* 2773 */ "Print information on the given CRL structure\0" -/* 2818 */ "CRL_INFO\0" -/* 2827 */ "crl-info\0" -/* 2836 */ "Print information on the given certificate request\0" -/* 2887 */ "CRQ_INFO\0" -/* 2896 */ "crq-info\0" -/* 2905 */ "Do not use extensions in certificate requests\0" -/* 2951 */ "NO_CRQ_EXTENSIONS\0" -/* 2969 */ "no-crq-extensions\0" -/* 2987 */ "Print information on a PKCS #12 structure\0" -/* 3029 */ "P12_INFO\0" -/* 3038 */ "p12-info\0" -/* 3047 */ "Print information on a PKCS #7 structure\0" -/* 3088 */ "P7_INFO\0" -/* 3096 */ "p7-info\0" -/* 3104 */ "Convert S/MIME to PKCS #7 structure\0" -/* 3140 */ "SMIME_TO_P7\0" -/* 3152 */ "smime-to-p7\0" -/* 3164 */ "Print information on a private key\0" -/* 3199 */ "KEY_INFO\0" -/* 3208 */ "key-info\0" -/* 3217 */ "Print information on an OpenPGP private key\0" -/* 3261 */ "PGP_KEY_INFO\0" -/* 3274 */ "pgp-key-info\0" -/* 3287 */ "Print information on a public key\0" -/* 3321 */ "PUBKEY_INFO\0" -/* 3333 */ "pubkey-info\0" -/* 3345 */ "Generate an X.509 version 1 certificate (with no extensions)\0" -/* 3406 */ "V1\0" -/* 3409 */ "v1\0" -/* 3412 */ "Generate a PKCS #12 structure\0" -/* 3442 */ "TO_P12\0" -/* 3449 */ "to-p12\0" -/* 3456 */ "Generate a PKCS #8 structure\0" -/* 3485 */ "TO_P8\0" -/* 3491 */ "to-p8\0" -/* 3497 */ "Use PKCS #8 format for private keys\0" -/* 3533 */ "PKCS8\0" -/* 3539 */ "pkcs8\0" -/* 3545 */ "Generate RSA key\0" -/* 3562 */ "RSA\0" -/* 3566 */ "rsa\0" -/* 3570 */ "Generate DSA key\0" -/* 3587 */ "DSA\0" -/* 3591 */ "dsa\0" -/* 3595 */ "Generate ECC (ECDSA) key\0" -/* 3620 */ "ECC\0" -/* 3624 */ "ecc\0" -/* 3628 */ "This is an alias for 'ecc'\0" -/* 3655 */ "ecdsa\0" -/* 3661 */ "Hash algorithm to use for signing.\0" -/* 3696 */ "HASH\0" -/* 3701 */ "hash\0" -/* 3706 */ "Use DER format for input certificates and private keys.\0" -/* 3762 */ "INDER\0" -/* 3768 */ "no-inder\0" -/* 3777 */ "no\0" -/* 3780 */ "This is an alias for 'inder'\0" -/* 3809 */ "inraw\0" -/* 3815 */ "Use DER format for output certificates and private keys\0" -/* 3871 */ "OUTDER\0" -/* 3878 */ "no-outder\0" -/* 3888 */ "This is an alias for 'outder'\0" -/* 3918 */ "outraw\0" -/* 3925 */ "Specify the number of bits for key generate\0" -/* 3969 */ "BITS\0" -/* 3974 */ "bits\0" -/* 3979 */ "Specify the security level [low, legacy, normal, high, ultra].\0" -/* 4042 */ "SEC_PARAM\0" -/* 4052 */ "sec-param\0" -/* 4062 */ "No effect\0" -/* 4072 */ "DISABLE_QUICK_RANDOM\0" -/* 4093 */ "disable-quick-random\0" -/* 4114 */ "Template file to use for non-interactive operation\0" -/* 4165 */ "TEMPLATE\0" -/* 4174 */ "template\0" -/* 4183 */ "Cipher to use for PKCS #8 and #12 operations\0" -/* 4228 */ "PKCS_CIPHER\0" -/* 4240 */ "pkcs-cipher\0" -/* 4252 */ "Display extended usage information and exit\0" -/* 4296 */ "help\0" -/* 4301 */ "Extended usage information passed thru pager\0" -/* 4346 */ "more-help\0" -/* 4356 */ "Output version information and exit\0" -/* 4392 */ "version\0" -/* 4400 */ "CERTTOOL\0" -/* 4409 */ "certtool - GnuTLS certificate tool - Ver. @VERSION@\n" +/* 2397 */ "In certain operations it prints the information is C-friendly format\0" +/* 2466 */ "CPRINT\0" +/* 2473 */ "cprint\0" +/* 2480 */ "Enforce a NULL password\0" +/* 2504 */ "NULL_PASSWORD\0" +/* 2518 */ "null-password\0" +/* 2532 */ "Print information on the given certificate\0" +/* 2575 */ "CERTIFICATE_INFO\0" +/* 2592 */ "certificate-info\0" +/* 2609 */ "Print certificate's public key\0" +/* 2640 */ "CERTIFICATE_PUBKEY\0" +/* 2659 */ "certificate-pubkey\0" +/* 2678 */ "Print information on the given OpenPGP certificate\0" +/* 2729 */ "PGP_CERTIFICATE_INFO\0" +/* 2750 */ "pgp-certificate-info\0" +/* 2771 */ "Print information on the given OpenPGP keyring structure\0" +/* 2828 */ "PGP_RING_INFO\0" +/* 2842 */ "pgp-ring-info\0" +/* 2856 */ "Print information on the given CRL structure\0" +/* 2901 */ "CRL_INFO\0" +/* 2910 */ "crl-info\0" +/* 2919 */ "Print information on the given certificate request\0" +/* 2970 */ "CRQ_INFO\0" +/* 2979 */ "crq-info\0" +/* 2988 */ "Do not use extensions in certificate requests\0" +/* 3034 */ "NO_CRQ_EXTENSIONS\0" +/* 3052 */ "no-crq-extensions\0" +/* 3070 */ "Print information on a PKCS #12 structure\0" +/* 3112 */ "P12_INFO\0" +/* 3121 */ "p12-info\0" +/* 3130 */ "Print information on a PKCS #7 structure\0" +/* 3171 */ "P7_INFO\0" +/* 3179 */ "p7-info\0" +/* 3187 */ "Convert S/MIME to PKCS #7 structure\0" +/* 3223 */ "SMIME_TO_P7\0" +/* 3235 */ "smime-to-p7\0" +/* 3247 */ "Print information on a private key\0" +/* 3282 */ "KEY_INFO\0" +/* 3291 */ "key-info\0" +/* 3300 */ "Print information on an OpenPGP private key\0" +/* 3344 */ "PGP_KEY_INFO\0" +/* 3357 */ "pgp-key-info\0" +/* 3370 */ "Print information on a public key\0" +/* 3404 */ "PUBKEY_INFO\0" +/* 3416 */ "pubkey-info\0" +/* 3428 */ "Generate an X.509 version 1 certificate (with no extensions)\0" +/* 3489 */ "V1\0" +/* 3492 */ "v1\0" +/* 3495 */ "Generate a PKCS #12 structure\0" +/* 3525 */ "TO_P12\0" +/* 3532 */ "to-p12\0" +/* 3539 */ "Generate a PKCS #8 structure\0" +/* 3568 */ "TO_P8\0" +/* 3574 */ "to-p8\0" +/* 3580 */ "Use PKCS #8 format for private keys\0" +/* 3616 */ "PKCS8\0" +/* 3622 */ "pkcs8\0" +/* 3628 */ "Generate RSA key\0" +/* 3645 */ "RSA\0" +/* 3649 */ "rsa\0" +/* 3653 */ "Generate DSA key\0" +/* 3670 */ "DSA\0" +/* 3674 */ "dsa\0" +/* 3678 */ "Generate ECC (ECDSA) key\0" +/* 3703 */ "ECC\0" +/* 3707 */ "ecc\0" +/* 3711 */ "This is an alias for 'ecc'\0" +/* 3738 */ "ecdsa\0" +/* 3744 */ "Hash algorithm to use for signing.\0" +/* 3779 */ "HASH\0" +/* 3784 */ "hash\0" +/* 3789 */ "Use DER format for input certificates and private keys.\0" +/* 3845 */ "INDER\0" +/* 3851 */ "no-inder\0" +/* 3860 */ "no\0" +/* 3863 */ "This is an alias for 'inder'\0" +/* 3892 */ "inraw\0" +/* 3898 */ "Use DER format for output certificates and private keys\0" +/* 3954 */ "OUTDER\0" +/* 3961 */ "no-outder\0" +/* 3971 */ "This is an alias for 'outder'\0" +/* 4001 */ "outraw\0" +/* 4008 */ "Specify the number of bits for key generate\0" +/* 4052 */ "BITS\0" +/* 4057 */ "bits\0" +/* 4062 */ "Specify the security level [low, legacy, normal, high, ultra].\0" +/* 4125 */ "SEC_PARAM\0" +/* 4135 */ "sec-param\0" +/* 4145 */ "No effect\0" +/* 4155 */ "DISABLE_QUICK_RANDOM\0" +/* 4176 */ "disable-quick-random\0" +/* 4197 */ "Template file to use for non-interactive operation\0" +/* 4248 */ "TEMPLATE\0" +/* 4257 */ "template\0" +/* 4266 */ "Cipher to use for PKCS #8 and #12 operations\0" +/* 4311 */ "PKCS_CIPHER\0" +/* 4323 */ "pkcs-cipher\0" +/* 4335 */ "Display extended usage information and exit\0" +/* 4379 */ "help\0" +/* 4384 */ "Extended usage information passed thru pager\0" +/* 4429 */ "more-help\0" +/* 4439 */ "Output version information and exit\0" +/* 4475 */ "version\0" +/* 4483 */ "CERTTOOL\0" +/* 4492 */ "certtool - GnuTLS certificate tool - Ver. @VERSION@\n" "USAGE: %s [ - [] | --[{=| }] ]...\n\0" -/* 4519 */ "bug-gnutls@gnu.org\0" -/* 4538 */ "\n\n\0" -/* 4541 */ "\n" +/* 4602 */ "bug-gnutls@gnu.org\0" +/* 4621 */ "\n\n\0" +/* 4624 */ "\n" "Tool to parse and generate X.509 certificates, requests and private keys.\n" "It can be used interactively or non interactively by specifying the\n" "template command line option.\n\0" -/* 4715 */ "certtool @VERSION@\0" -/* 4734 */ "certtool [options]\n" +/* 4798 */ "certtool @VERSION@\0" +/* 4817 */ "certtool [options]\n" "certtool --help for usage instructions.\n"; /* @@ -491,133 +494,141 @@ static int const aVerify_CrlMustList[] = { #define HEX_NUMBERS_name (certtool_opt_strs+2385) #define HEX_NUMBERS_FLAGS (OPTST_DISABLED) +/* + * cprint option description: + */ +#define CPRINT_DESC (certtool_opt_strs+2397) +#define CPRINT_NAME (certtool_opt_strs+2466) +#define CPRINT_name (certtool_opt_strs+2473) +#define CPRINT_FLAGS (OPTST_DISABLED) + /* * null-password option description: */ -#define NULL_PASSWORD_DESC (certtool_opt_strs+2397) -#define NULL_PASSWORD_NAME (certtool_opt_strs+2421) -#define NULL_PASSWORD_name (certtool_opt_strs+2435) +#define NULL_PASSWORD_DESC (certtool_opt_strs+2480) +#define NULL_PASSWORD_NAME (certtool_opt_strs+2504) +#define NULL_PASSWORD_name (certtool_opt_strs+2518) #define NULL_PASSWORD_FLAGS (OPTST_DISABLED) /* * certificate-info option description: */ -#define CERTIFICATE_INFO_DESC (certtool_opt_strs+2449) -#define CERTIFICATE_INFO_NAME (certtool_opt_strs+2492) -#define CERTIFICATE_INFO_name (certtool_opt_strs+2509) +#define CERTIFICATE_INFO_DESC (certtool_opt_strs+2532) +#define CERTIFICATE_INFO_NAME (certtool_opt_strs+2575) +#define CERTIFICATE_INFO_name (certtool_opt_strs+2592) #define CERTIFICATE_INFO_FLAGS (OPTST_DISABLED) /* * certificate-pubkey option description: */ -#define CERTIFICATE_PUBKEY_DESC (certtool_opt_strs+2526) -#define CERTIFICATE_PUBKEY_NAME (certtool_opt_strs+2557) -#define CERTIFICATE_PUBKEY_name (certtool_opt_strs+2576) +#define CERTIFICATE_PUBKEY_DESC (certtool_opt_strs+2609) +#define CERTIFICATE_PUBKEY_NAME (certtool_opt_strs+2640) +#define CERTIFICATE_PUBKEY_name (certtool_opt_strs+2659) #define CERTIFICATE_PUBKEY_FLAGS (OPTST_DISABLED) /* * pgp-certificate-info option description: */ -#define PGP_CERTIFICATE_INFO_DESC (certtool_opt_strs+2595) -#define PGP_CERTIFICATE_INFO_NAME (certtool_opt_strs+2646) -#define PGP_CERTIFICATE_INFO_name (certtool_opt_strs+2667) +#define PGP_CERTIFICATE_INFO_DESC (certtool_opt_strs+2678) +#define PGP_CERTIFICATE_INFO_NAME (certtool_opt_strs+2729) +#define PGP_CERTIFICATE_INFO_name (certtool_opt_strs+2750) #define PGP_CERTIFICATE_INFO_FLAGS (OPTST_DISABLED) /* * pgp-ring-info option description: */ -#define PGP_RING_INFO_DESC (certtool_opt_strs+2688) -#define PGP_RING_INFO_NAME (certtool_opt_strs+2745) -#define PGP_RING_INFO_name (certtool_opt_strs+2759) +#define PGP_RING_INFO_DESC (certtool_opt_strs+2771) +#define PGP_RING_INFO_NAME (certtool_opt_strs+2828) +#define PGP_RING_INFO_name (certtool_opt_strs+2842) #define PGP_RING_INFO_FLAGS (OPTST_DISABLED) /* * crl-info option description: */ -#define CRL_INFO_DESC (certtool_opt_strs+2773) -#define CRL_INFO_NAME (certtool_opt_strs+2818) -#define CRL_INFO_name (certtool_opt_strs+2827) +#define CRL_INFO_DESC (certtool_opt_strs+2856) +#define CRL_INFO_NAME (certtool_opt_strs+2901) +#define CRL_INFO_name (certtool_opt_strs+2910) #define CRL_INFO_FLAGS (OPTST_DISABLED) /* * crq-info option description: */ -#define CRQ_INFO_DESC (certtool_opt_strs+2836) -#define CRQ_INFO_NAME (certtool_opt_strs+2887) -#define CRQ_INFO_name (certtool_opt_strs+2896) +#define CRQ_INFO_DESC (certtool_opt_strs+2919) +#define CRQ_INFO_NAME (certtool_opt_strs+2970) +#define CRQ_INFO_name (certtool_opt_strs+2979) #define CRQ_INFO_FLAGS (OPTST_DISABLED) /* * no-crq-extensions option description: */ -#define NO_CRQ_EXTENSIONS_DESC (certtool_opt_strs+2905) -#define NO_CRQ_EXTENSIONS_NAME (certtool_opt_strs+2951) -#define NO_CRQ_EXTENSIONS_name (certtool_opt_strs+2969) +#define NO_CRQ_EXTENSIONS_DESC (certtool_opt_strs+2988) +#define NO_CRQ_EXTENSIONS_NAME (certtool_opt_strs+3034) +#define NO_CRQ_EXTENSIONS_name (certtool_opt_strs+3052) #define NO_CRQ_EXTENSIONS_FLAGS (OPTST_DISABLED) /* * p12-info option description: */ -#define P12_INFO_DESC (certtool_opt_strs+2987) -#define P12_INFO_NAME (certtool_opt_strs+3029) -#define P12_INFO_name (certtool_opt_strs+3038) +#define P12_INFO_DESC (certtool_opt_strs+3070) +#define P12_INFO_NAME (certtool_opt_strs+3112) +#define P12_INFO_name (certtool_opt_strs+3121) #define P12_INFO_FLAGS (OPTST_DISABLED) /* * p7-info option description: */ -#define P7_INFO_DESC (certtool_opt_strs+3047) -#define P7_INFO_NAME (certtool_opt_strs+3088) -#define P7_INFO_name (certtool_opt_strs+3096) +#define P7_INFO_DESC (certtool_opt_strs+3130) +#define P7_INFO_NAME (certtool_opt_strs+3171) +#define P7_INFO_name (certtool_opt_strs+3179) #define P7_INFO_FLAGS (OPTST_DISABLED) /* * smime-to-p7 option description: */ -#define SMIME_TO_P7_DESC (certtool_opt_strs+3104) -#define SMIME_TO_P7_NAME (certtool_opt_strs+3140) -#define SMIME_TO_P7_name (certtool_opt_strs+3152) +#define SMIME_TO_P7_DESC (certtool_opt_strs+3187) +#define SMIME_TO_P7_NAME (certtool_opt_strs+3223) +#define SMIME_TO_P7_name (certtool_opt_strs+3235) #define SMIME_TO_P7_FLAGS (OPTST_DISABLED) /* * key-info option description: */ -#define KEY_INFO_DESC (certtool_opt_strs+3164) -#define KEY_INFO_NAME (certtool_opt_strs+3199) -#define KEY_INFO_name (certtool_opt_strs+3208) +#define KEY_INFO_DESC (certtool_opt_strs+3247) +#define KEY_INFO_NAME (certtool_opt_strs+3282) +#define KEY_INFO_name (certtool_opt_strs+3291) #define KEY_INFO_FLAGS (OPTST_DISABLED) /* * pgp-key-info option description: */ -#define PGP_KEY_INFO_DESC (certtool_opt_strs+3217) -#define PGP_KEY_INFO_NAME (certtool_opt_strs+3261) -#define PGP_KEY_INFO_name (certtool_opt_strs+3274) +#define PGP_KEY_INFO_DESC (certtool_opt_strs+3300) +#define PGP_KEY_INFO_NAME (certtool_opt_strs+3344) +#define PGP_KEY_INFO_name (certtool_opt_strs+3357) #define PGP_KEY_INFO_FLAGS (OPTST_DISABLED) /* * pubkey-info option description: */ -#define PUBKEY_INFO_DESC (certtool_opt_strs+3287) -#define PUBKEY_INFO_NAME (certtool_opt_strs+3321) -#define PUBKEY_INFO_name (certtool_opt_strs+3333) +#define PUBKEY_INFO_DESC (certtool_opt_strs+3370) +#define PUBKEY_INFO_NAME (certtool_opt_strs+3404) +#define PUBKEY_INFO_name (certtool_opt_strs+3416) #define PUBKEY_INFO_FLAGS (OPTST_DISABLED) /* * v1 option description: */ -#define V1_DESC (certtool_opt_strs+3345) -#define V1_NAME (certtool_opt_strs+3406) -#define V1_name (certtool_opt_strs+3409) +#define V1_DESC (certtool_opt_strs+3428) +#define V1_NAME (certtool_opt_strs+3489) +#define V1_name (certtool_opt_strs+3492) #define V1_FLAGS (OPTST_DISABLED) /* * to-p12 option description with * "Must also have options" and "Incompatible options": */ -#define TO_P12_DESC (certtool_opt_strs+3412) -#define TO_P12_NAME (certtool_opt_strs+3442) -#define TO_P12_name (certtool_opt_strs+3449) +#define TO_P12_DESC (certtool_opt_strs+3495) +#define TO_P12_NAME (certtool_opt_strs+3525) +#define TO_P12_name (certtool_opt_strs+3532) static int const aTo_P12MustList[] = { INDEX_OPT_LOAD_CERTIFICATE, NO_EQUIVALENT }; #define TO_P12_FLAGS (OPTST_DISABLED) @@ -625,148 +636,148 @@ static int const aTo_P12MustList[] = { /* * to-p8 option description: */ -#define TO_P8_DESC (certtool_opt_strs+3456) -#define TO_P8_NAME (certtool_opt_strs+3485) -#define TO_P8_name (certtool_opt_strs+3491) +#define TO_P8_DESC (certtool_opt_strs+3539) +#define TO_P8_NAME (certtool_opt_strs+3568) +#define TO_P8_name (certtool_opt_strs+3574) #define TO_P8_FLAGS (OPTST_DISABLED) /* * pkcs8 option description: */ -#define PKCS8_DESC (certtool_opt_strs+3497) -#define PKCS8_NAME (certtool_opt_strs+3533) -#define PKCS8_name (certtool_opt_strs+3539) +#define PKCS8_DESC (certtool_opt_strs+3580) +#define PKCS8_NAME (certtool_opt_strs+3616) +#define PKCS8_name (certtool_opt_strs+3622) #define PKCS8_FLAGS (OPTST_DISABLED) /* * rsa option description: */ -#define RSA_DESC (certtool_opt_strs+3545) -#define RSA_NAME (certtool_opt_strs+3562) -#define RSA_name (certtool_opt_strs+3566) +#define RSA_DESC (certtool_opt_strs+3628) +#define RSA_NAME (certtool_opt_strs+3645) +#define RSA_name (certtool_opt_strs+3649) #define RSA_FLAGS (OPTST_DISABLED) /* * dsa option description: */ -#define DSA_DESC (certtool_opt_strs+3570) -#define DSA_NAME (certtool_opt_strs+3587) -#define DSA_name (certtool_opt_strs+3591) +#define DSA_DESC (certtool_opt_strs+3653) +#define DSA_NAME (certtool_opt_strs+3670) +#define DSA_name (certtool_opt_strs+3674) #define DSA_FLAGS (OPTST_DISABLED) /* * ecc option description: */ -#define ECC_DESC (certtool_opt_strs+3595) -#define ECC_NAME (certtool_opt_strs+3620) -#define ECC_name (certtool_opt_strs+3624) +#define ECC_DESC (certtool_opt_strs+3678) +#define ECC_NAME (certtool_opt_strs+3703) +#define ECC_name (certtool_opt_strs+3707) #define ECC_FLAGS (OPTST_DISABLED) /* * ecdsa option description: */ -#define ECDSA_DESC (certtool_opt_strs+3628) +#define ECDSA_DESC (certtool_opt_strs+3711) #define ECDSA_NAME NULL -#define ECDSA_name (certtool_opt_strs+3655) +#define ECDSA_name (certtool_opt_strs+3738) #define ECDSA_FLAGS (ECC_FLAGS | OPTST_ALIAS) /* * hash option description: */ -#define HASH_DESC (certtool_opt_strs+3661) -#define HASH_NAME (certtool_opt_strs+3696) -#define HASH_name (certtool_opt_strs+3701) +#define HASH_DESC (certtool_opt_strs+3744) +#define HASH_NAME (certtool_opt_strs+3779) +#define HASH_name (certtool_opt_strs+3784) #define HASH_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * inder option description: */ -#define INDER_DESC (certtool_opt_strs+3706) -#define INDER_NAME (certtool_opt_strs+3762) -#define NOT_INDER_name (certtool_opt_strs+3768) -#define NOT_INDER_PFX (certtool_opt_strs+3777) +#define INDER_DESC (certtool_opt_strs+3789) +#define INDER_NAME (certtool_opt_strs+3845) +#define NOT_INDER_name (certtool_opt_strs+3851) +#define NOT_INDER_PFX (certtool_opt_strs+3860) #define INDER_name (NOT_INDER_name + 3) #define INDER_FLAGS (OPTST_DISABLED) /* * inraw option description: */ -#define INRAW_DESC (certtool_opt_strs+3780) +#define INRAW_DESC (certtool_opt_strs+3863) #define INRAW_NAME NULL -#define INRAW_name (certtool_opt_strs+3809) +#define INRAW_name (certtool_opt_strs+3892) #define INRAW_FLAGS (INDER_FLAGS | OPTST_ALIAS) /* * outder option description: */ -#define OUTDER_DESC (certtool_opt_strs+3815) -#define OUTDER_NAME (certtool_opt_strs+3871) -#define NOT_OUTDER_name (certtool_opt_strs+3878) -#define NOT_OUTDER_PFX (certtool_opt_strs+3777) +#define OUTDER_DESC (certtool_opt_strs+3898) +#define OUTDER_NAME (certtool_opt_strs+3954) +#define NOT_OUTDER_name (certtool_opt_strs+3961) +#define NOT_OUTDER_PFX (certtool_opt_strs+3860) #define OUTDER_name (NOT_OUTDER_name + 3) #define OUTDER_FLAGS (OPTST_DISABLED) /* * outraw option description: */ -#define OUTRAW_DESC (certtool_opt_strs+3888) +#define OUTRAW_DESC (certtool_opt_strs+3971) #define OUTRAW_NAME NULL -#define OUTRAW_name (certtool_opt_strs+3918) +#define OUTRAW_name (certtool_opt_strs+4001) #define OUTRAW_FLAGS (OUTDER_FLAGS | OPTST_ALIAS) /* * bits option description: */ -#define BITS_DESC (certtool_opt_strs+3925) -#define BITS_NAME (certtool_opt_strs+3969) -#define BITS_name (certtool_opt_strs+3974) +#define BITS_DESC (certtool_opt_strs+4008) +#define BITS_NAME (certtool_opt_strs+4052) +#define BITS_name (certtool_opt_strs+4057) #define BITS_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) /* * sec-param option description: */ -#define SEC_PARAM_DESC (certtool_opt_strs+3979) -#define SEC_PARAM_NAME (certtool_opt_strs+4042) -#define SEC_PARAM_name (certtool_opt_strs+4052) +#define SEC_PARAM_DESC (certtool_opt_strs+4062) +#define SEC_PARAM_NAME (certtool_opt_strs+4125) +#define SEC_PARAM_name (certtool_opt_strs+4135) #define SEC_PARAM_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * disable-quick-random option description: */ -#define DISABLE_QUICK_RANDOM_DESC (certtool_opt_strs+4062) -#define DISABLE_QUICK_RANDOM_NAME (certtool_opt_strs+4072) -#define DISABLE_QUICK_RANDOM_name (certtool_opt_strs+4093) +#define DISABLE_QUICK_RANDOM_DESC (certtool_opt_strs+4145) +#define DISABLE_QUICK_RANDOM_NAME (certtool_opt_strs+4155) +#define DISABLE_QUICK_RANDOM_name (certtool_opt_strs+4176) #define DISABLE_QUICK_RANDOM_FLAGS (OPTST_DISABLED) /* * template option description: */ -#define TEMPLATE_DESC (certtool_opt_strs+4114) -#define TEMPLATE_NAME (certtool_opt_strs+4165) -#define TEMPLATE_name (certtool_opt_strs+4174) +#define TEMPLATE_DESC (certtool_opt_strs+4197) +#define TEMPLATE_NAME (certtool_opt_strs+4248) +#define TEMPLATE_name (certtool_opt_strs+4257) #define TEMPLATE_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE)) /* * pkcs-cipher option description: */ -#define PKCS_CIPHER_DESC (certtool_opt_strs+4183) -#define PKCS_CIPHER_NAME (certtool_opt_strs+4228) -#define PKCS_CIPHER_name (certtool_opt_strs+4240) +#define PKCS_CIPHER_DESC (certtool_opt_strs+4266) +#define PKCS_CIPHER_NAME (certtool_opt_strs+4311) +#define PKCS_CIPHER_name (certtool_opt_strs+4323) #define PKCS_CIPHER_FLAGS (OPTST_DISABLED \ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Help/More_Help/Version option descriptions: */ -#define HELP_DESC (certtool_opt_strs+4252) -#define HELP_name (certtool_opt_strs+4296) +#define HELP_DESC (certtool_opt_strs+4335) +#define HELP_name (certtool_opt_strs+4379) #ifdef HAVE_WORKING_FORK -#define MORE_HELP_DESC (certtool_opt_strs+4301) -#define MORE_HELP_name (certtool_opt_strs+4346) +#define MORE_HELP_DESC (certtool_opt_strs+4384) +#define MORE_HELP_name (certtool_opt_strs+4429) #define MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT) #else #define MORE_HELP_DESC NULL @@ -779,8 +790,8 @@ static int const aTo_P12MustList[] = { # define VER_FLAGS (OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT) #endif -#define VER_DESC (certtool_opt_strs+4356) -#define VER_name (certtool_opt_strs+4392) +#define VER_DESC (certtool_opt_strs+4439) +#define VER_name (certtool_opt_strs+4475) /* * Declare option callback procedures */ @@ -1102,8 +1113,20 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ HEX_NUMBERS_DESC, HEX_NUMBERS_NAME, HEX_NUMBERS_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 25, VALUE_OPT_NULL_PASSWORD, - /* equiv idx, value */ 25, VALUE_OPT_NULL_PASSWORD, + { /* entry idx, value */ 25, VALUE_OPT_CPRINT, + /* equiv idx, value */ 25, VALUE_OPT_CPRINT, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ CPRINT_FLAGS, 0, + /* last opt argumnt */ { NULL }, /* --cprint */ + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ CPRINT_DESC, CPRINT_NAME, CPRINT_name, + /* disablement strs */ NULL, NULL }, + + { /* entry idx, value */ 26, VALUE_OPT_NULL_PASSWORD, + /* equiv idx, value */ 26, VALUE_OPT_NULL_PASSWORD, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ NULL_PASSWORD_FLAGS, 0, @@ -1114,8 +1137,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ NULL_PASSWORD_DESC, NULL_PASSWORD_NAME, NULL_PASSWORD_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 26, VALUE_OPT_CERTIFICATE_INFO, - /* equiv idx, value */ 26, VALUE_OPT_CERTIFICATE_INFO, + { /* entry idx, value */ 27, VALUE_OPT_CERTIFICATE_INFO, + /* equiv idx, value */ 27, VALUE_OPT_CERTIFICATE_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ CERTIFICATE_INFO_FLAGS, 0, @@ -1126,8 +1149,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ CERTIFICATE_INFO_DESC, CERTIFICATE_INFO_NAME, CERTIFICATE_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 27, VALUE_OPT_CERTIFICATE_PUBKEY, - /* equiv idx, value */ 27, VALUE_OPT_CERTIFICATE_PUBKEY, + { /* entry idx, value */ 28, VALUE_OPT_CERTIFICATE_PUBKEY, + /* equiv idx, value */ 28, VALUE_OPT_CERTIFICATE_PUBKEY, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ CERTIFICATE_PUBKEY_FLAGS, 0, @@ -1138,8 +1161,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ CERTIFICATE_PUBKEY_DESC, CERTIFICATE_PUBKEY_NAME, CERTIFICATE_PUBKEY_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 28, VALUE_OPT_PGP_CERTIFICATE_INFO, - /* equiv idx, value */ 28, VALUE_OPT_PGP_CERTIFICATE_INFO, + { /* entry idx, value */ 29, VALUE_OPT_PGP_CERTIFICATE_INFO, + /* equiv idx, value */ 29, VALUE_OPT_PGP_CERTIFICATE_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PGP_CERTIFICATE_INFO_FLAGS, 0, @@ -1150,8 +1173,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ PGP_CERTIFICATE_INFO_DESC, PGP_CERTIFICATE_INFO_NAME, PGP_CERTIFICATE_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 29, VALUE_OPT_PGP_RING_INFO, - /* equiv idx, value */ 29, VALUE_OPT_PGP_RING_INFO, + { /* entry idx, value */ 30, VALUE_OPT_PGP_RING_INFO, + /* equiv idx, value */ 30, VALUE_OPT_PGP_RING_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PGP_RING_INFO_FLAGS, 0, @@ -1162,8 +1185,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ PGP_RING_INFO_DESC, PGP_RING_INFO_NAME, PGP_RING_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 30, VALUE_OPT_CRL_INFO, - /* equiv idx, value */ 30, VALUE_OPT_CRL_INFO, + { /* entry idx, value */ 31, VALUE_OPT_CRL_INFO, + /* equiv idx, value */ 31, VALUE_OPT_CRL_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ CRL_INFO_FLAGS, 0, @@ -1174,8 +1197,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ CRL_INFO_DESC, CRL_INFO_NAME, CRL_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 31, VALUE_OPT_CRQ_INFO, - /* equiv idx, value */ 31, VALUE_OPT_CRQ_INFO, + { /* entry idx, value */ 32, VALUE_OPT_CRQ_INFO, + /* equiv idx, value */ 32, VALUE_OPT_CRQ_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ CRQ_INFO_FLAGS, 0, @@ -1186,8 +1209,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ CRQ_INFO_DESC, CRQ_INFO_NAME, CRQ_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 32, VALUE_OPT_NO_CRQ_EXTENSIONS, - /* equiv idx, value */ 32, VALUE_OPT_NO_CRQ_EXTENSIONS, + { /* entry idx, value */ 33, VALUE_OPT_NO_CRQ_EXTENSIONS, + /* equiv idx, value */ 33, VALUE_OPT_NO_CRQ_EXTENSIONS, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ NO_CRQ_EXTENSIONS_FLAGS, 0, @@ -1198,8 +1221,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ NO_CRQ_EXTENSIONS_DESC, NO_CRQ_EXTENSIONS_NAME, NO_CRQ_EXTENSIONS_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 33, VALUE_OPT_P12_INFO, - /* equiv idx, value */ 33, VALUE_OPT_P12_INFO, + { /* entry idx, value */ 34, VALUE_OPT_P12_INFO, + /* equiv idx, value */ 34, VALUE_OPT_P12_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ P12_INFO_FLAGS, 0, @@ -1210,8 +1233,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ P12_INFO_DESC, P12_INFO_NAME, P12_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 34, VALUE_OPT_P7_INFO, - /* equiv idx, value */ 34, VALUE_OPT_P7_INFO, + { /* entry idx, value */ 35, VALUE_OPT_P7_INFO, + /* equiv idx, value */ 35, VALUE_OPT_P7_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ P7_INFO_FLAGS, 0, @@ -1222,8 +1245,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ P7_INFO_DESC, P7_INFO_NAME, P7_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 35, VALUE_OPT_SMIME_TO_P7, - /* equiv idx, value */ 35, VALUE_OPT_SMIME_TO_P7, + { /* entry idx, value */ 36, VALUE_OPT_SMIME_TO_P7, + /* equiv idx, value */ 36, VALUE_OPT_SMIME_TO_P7, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SMIME_TO_P7_FLAGS, 0, @@ -1234,8 +1257,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ SMIME_TO_P7_DESC, SMIME_TO_P7_NAME, SMIME_TO_P7_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 36, VALUE_OPT_KEY_INFO, - /* equiv idx, value */ 36, VALUE_OPT_KEY_INFO, + { /* entry idx, value */ 37, VALUE_OPT_KEY_INFO, + /* equiv idx, value */ 37, VALUE_OPT_KEY_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ KEY_INFO_FLAGS, 0, @@ -1246,8 +1269,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ KEY_INFO_DESC, KEY_INFO_NAME, KEY_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 37, VALUE_OPT_PGP_KEY_INFO, - /* equiv idx, value */ 37, VALUE_OPT_PGP_KEY_INFO, + { /* entry idx, value */ 38, VALUE_OPT_PGP_KEY_INFO, + /* equiv idx, value */ 38, VALUE_OPT_PGP_KEY_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PGP_KEY_INFO_FLAGS, 0, @@ -1258,8 +1281,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ PGP_KEY_INFO_DESC, PGP_KEY_INFO_NAME, PGP_KEY_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 38, VALUE_OPT_PUBKEY_INFO, - /* equiv idx, value */ 38, VALUE_OPT_PUBKEY_INFO, + { /* entry idx, value */ 39, VALUE_OPT_PUBKEY_INFO, + /* equiv idx, value */ 39, VALUE_OPT_PUBKEY_INFO, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PUBKEY_INFO_FLAGS, 0, @@ -1270,8 +1293,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ PUBKEY_INFO_DESC, PUBKEY_INFO_NAME, PUBKEY_INFO_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 39, VALUE_OPT_V1, - /* equiv idx, value */ 39, VALUE_OPT_V1, + { /* entry idx, value */ 40, VALUE_OPT_V1, + /* equiv idx, value */ 40, VALUE_OPT_V1, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ V1_FLAGS, 0, @@ -1282,8 +1305,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ V1_DESC, V1_NAME, V1_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 40, VALUE_OPT_TO_P12, - /* equiv idx, value */ 40, VALUE_OPT_TO_P12, + { /* entry idx, value */ 41, VALUE_OPT_TO_P12, + /* equiv idx, value */ 41, VALUE_OPT_TO_P12, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ TO_P12_FLAGS, 0, @@ -1294,8 +1317,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ TO_P12_DESC, TO_P12_NAME, TO_P12_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 41, VALUE_OPT_TO_P8, - /* equiv idx, value */ 41, VALUE_OPT_TO_P8, + { /* entry idx, value */ 42, VALUE_OPT_TO_P8, + /* equiv idx, value */ 42, VALUE_OPT_TO_P8, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ TO_P8_FLAGS, 0, @@ -1306,8 +1329,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ TO_P8_DESC, TO_P8_NAME, TO_P8_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 42, VALUE_OPT_PKCS8, - /* equiv idx, value */ 42, VALUE_OPT_PKCS8, + { /* entry idx, value */ 43, VALUE_OPT_PKCS8, + /* equiv idx, value */ 43, VALUE_OPT_PKCS8, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PKCS8_FLAGS, 0, @@ -1318,8 +1341,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ PKCS8_DESC, PKCS8_NAME, PKCS8_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 43, VALUE_OPT_RSA, - /* equiv idx, value */ 43, VALUE_OPT_RSA, + { /* entry idx, value */ 44, VALUE_OPT_RSA, + /* equiv idx, value */ 44, VALUE_OPT_RSA, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ RSA_FLAGS, 0, @@ -1330,8 +1353,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ RSA_DESC, RSA_NAME, RSA_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 44, VALUE_OPT_DSA, - /* equiv idx, value */ 44, VALUE_OPT_DSA, + { /* entry idx, value */ 45, VALUE_OPT_DSA, + /* equiv idx, value */ 45, VALUE_OPT_DSA, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ DSA_FLAGS, 0, @@ -1342,8 +1365,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ DSA_DESC, DSA_NAME, DSA_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 45, VALUE_OPT_ECC, - /* equiv idx, value */ 45, VALUE_OPT_ECC, + { /* entry idx, value */ 46, VALUE_OPT_ECC, + /* equiv idx, value */ 46, VALUE_OPT_ECC, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ ECC_FLAGS, 0, @@ -1354,8 +1377,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ ECC_DESC, ECC_NAME, ECC_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 46, VALUE_OPT_ECDSA, - /* equiv idx, value */ 46, VALUE_OPT_ECDSA, + { /* entry idx, value */ 47, VALUE_OPT_ECDSA, + /* equiv idx, value */ 47, VALUE_OPT_ECDSA, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ ECDSA_FLAGS, 0, @@ -1366,8 +1389,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ ECDSA_DESC, ECDSA_NAME, ECDSA_name, /* disablement strs */ 0, 0 }, - { /* entry idx, value */ 47, VALUE_OPT_HASH, - /* equiv idx, value */ 47, VALUE_OPT_HASH, + { /* entry idx, value */ 48, VALUE_OPT_HASH, + /* equiv idx, value */ 48, VALUE_OPT_HASH, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ HASH_FLAGS, 0, @@ -1378,8 +1401,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ HASH_DESC, HASH_NAME, HASH_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 48, VALUE_OPT_INDER, - /* equiv idx, value */ 48, VALUE_OPT_INDER, + { /* entry idx, value */ 49, VALUE_OPT_INDER, + /* equiv idx, value */ 49, VALUE_OPT_INDER, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ INDER_FLAGS, 0, @@ -1390,8 +1413,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ INDER_DESC, INDER_NAME, INDER_name, /* disablement strs */ NOT_INDER_name, NOT_INDER_PFX }, - { /* entry idx, value */ 49, VALUE_OPT_INRAW, - /* equiv idx, value */ 49, VALUE_OPT_INRAW, + { /* entry idx, value */ 50, VALUE_OPT_INRAW, + /* equiv idx, value */ 50, VALUE_OPT_INRAW, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ INRAW_FLAGS, 0, @@ -1402,8 +1425,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ INRAW_DESC, INRAW_NAME, INRAW_name, /* disablement strs */ 0, 0 }, - { /* entry idx, value */ 50, VALUE_OPT_OUTDER, - /* equiv idx, value */ 50, VALUE_OPT_OUTDER, + { /* entry idx, value */ 51, VALUE_OPT_OUTDER, + /* equiv idx, value */ 51, VALUE_OPT_OUTDER, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OUTDER_FLAGS, 0, @@ -1414,8 +1437,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ OUTDER_DESC, OUTDER_NAME, OUTDER_name, /* disablement strs */ NOT_OUTDER_name, NOT_OUTDER_PFX }, - { /* entry idx, value */ 51, VALUE_OPT_OUTRAW, - /* equiv idx, value */ 51, VALUE_OPT_OUTRAW, + { /* entry idx, value */ 52, VALUE_OPT_OUTRAW, + /* equiv idx, value */ 52, VALUE_OPT_OUTRAW, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ OUTRAW_FLAGS, 0, @@ -1426,8 +1449,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ OUTRAW_DESC, OUTRAW_NAME, OUTRAW_name, /* disablement strs */ 0, 0 }, - { /* entry idx, value */ 52, VALUE_OPT_BITS, - /* equiv idx, value */ 52, VALUE_OPT_BITS, + { /* entry idx, value */ 53, VALUE_OPT_BITS, + /* equiv idx, value */ 53, VALUE_OPT_BITS, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ BITS_FLAGS, 0, @@ -1438,8 +1461,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ BITS_DESC, BITS_NAME, BITS_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 53, VALUE_OPT_SEC_PARAM, - /* equiv idx, value */ 53, VALUE_OPT_SEC_PARAM, + { /* entry idx, value */ 54, VALUE_OPT_SEC_PARAM, + /* equiv idx, value */ 54, VALUE_OPT_SEC_PARAM, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ SEC_PARAM_FLAGS, 0, @@ -1450,8 +1473,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ SEC_PARAM_DESC, SEC_PARAM_NAME, SEC_PARAM_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 54, VALUE_OPT_DISABLE_QUICK_RANDOM, - /* equiv idx, value */ 54, VALUE_OPT_DISABLE_QUICK_RANDOM, + { /* entry idx, value */ 55, VALUE_OPT_DISABLE_QUICK_RANDOM, + /* equiv idx, value */ 55, VALUE_OPT_DISABLE_QUICK_RANDOM, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ DISABLE_QUICK_RANDOM_FLAGS, 0, @@ -1462,8 +1485,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ DISABLE_QUICK_RANDOM_DESC, DISABLE_QUICK_RANDOM_NAME, DISABLE_QUICK_RANDOM_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 55, VALUE_OPT_TEMPLATE, - /* equiv idx, value */ 55, VALUE_OPT_TEMPLATE, + { /* entry idx, value */ 56, VALUE_OPT_TEMPLATE, + /* equiv idx, value */ 56, VALUE_OPT_TEMPLATE, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ TEMPLATE_FLAGS, 0, @@ -1474,8 +1497,8 @@ static tOptDesc optDesc[OPTION_CT] = { /* desc, NAME, name */ TEMPLATE_DESC, TEMPLATE_NAME, TEMPLATE_name, /* disablement strs */ NULL, NULL }, - { /* entry idx, value */ 56, VALUE_OPT_PKCS_CIPHER, - /* equiv idx, value */ 56, VALUE_OPT_PKCS_CIPHER, + { /* entry idx, value */ 57, VALUE_OPT_PKCS_CIPHER, + /* equiv idx, value */ 57, VALUE_OPT_PKCS_CIPHER, /* equivalenced to */ NO_EQUIVALENT, /* min, max, act ct */ 0, 1, 0, /* opt state flags */ PKCS_CIPHER_FLAGS, 0, @@ -1530,14 +1553,14 @@ static tOptDesc optDesc[OPTION_CT] = { * * Define the certtool Option Environment */ -#define zPROGNAME (certtool_opt_strs+4400) -#define zUsageTitle (certtool_opt_strs+4409) +#define zPROGNAME (certtool_opt_strs+4483) +#define zUsageTitle (certtool_opt_strs+4492) #define zRcName NULL #define apzHomeList NULL -#define zBugsAddr (certtool_opt_strs+4519) -#define zExplain (certtool_opt_strs+4538) -#define zDetail (certtool_opt_strs+4541) -#define zFullVersion (certtool_opt_strs+4715) +#define zBugsAddr (certtool_opt_strs+4602) +#define zExplain (certtool_opt_strs+4621) +#define zDetail (certtool_opt_strs+4624) +#define zFullVersion (certtool_opt_strs+4798) /* extracted from optcode.tlib near line 350 */ #if defined(ENABLE_NLS) @@ -1551,7 +1574,7 @@ static tOptDesc optDesc[OPTION_CT] = { #define certtool_full_usage (NULL) -#define certtool_short_usage (certtool_opt_strs+4734) +#define certtool_short_usage (certtool_opt_strs+4817) #endif /* not defined __doxygen__ */ @@ -1784,7 +1807,7 @@ tOptions certtoolOptions = { NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 60 /* full option count */, 57 /* user option count */, + 61 /* full option count */, 58 /* user option count */, certtool_full_usage, certtool_short_usage, NULL, NULL, PKGDATADIR, certtool_packager_info diff --git a/src/certtool-args.def b/src/certtool-args.def index 8275359986..4eccdb19bf 100644 --- a/src/certtool-args.def +++ b/src/certtool-args.def @@ -157,6 +157,12 @@ flag = { doc = ""; }; +flag = { + name = cprint; + descrip = "In certain operations it prints the information is C-friendly format"; + doc = "In certain operations it prints the information is C-friendly format, suitable for including into C programs."; +}; + flag = { name = null-password; descrip = "Enforce a NULL password"; diff --git a/src/certtool-args.h b/src/certtool-args.h index 1fa15df473..9495fb12a2 100644 --- a/src/certtool-args.h +++ b/src/certtool-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (certtool-args.h) * - * It has been AutoGen-ed January 15, 2013 at 11:30:45 PM by AutoGen 5.16 + * It has been AutoGen-ed January 21, 2013 at 09:27:01 AM by AutoGen 5.16 * From the definitions certtool-args.def * and the template file options * @@ -92,44 +92,45 @@ typedef enum { INDEX_OPT_LOAD_CA_CERTIFICATE = 22, INDEX_OPT_PASSWORD = 23, INDEX_OPT_HEX_NUMBERS = 24, - INDEX_OPT_NULL_PASSWORD = 25, - INDEX_OPT_CERTIFICATE_INFO = 26, - INDEX_OPT_CERTIFICATE_PUBKEY = 27, - INDEX_OPT_PGP_CERTIFICATE_INFO = 28, - INDEX_OPT_PGP_RING_INFO = 29, - INDEX_OPT_CRL_INFO = 30, - INDEX_OPT_CRQ_INFO = 31, - INDEX_OPT_NO_CRQ_EXTENSIONS = 32, - INDEX_OPT_P12_INFO = 33, - INDEX_OPT_P7_INFO = 34, - INDEX_OPT_SMIME_TO_P7 = 35, - INDEX_OPT_KEY_INFO = 36, - INDEX_OPT_PGP_KEY_INFO = 37, - INDEX_OPT_PUBKEY_INFO = 38, - INDEX_OPT_V1 = 39, - INDEX_OPT_TO_P12 = 40, - INDEX_OPT_TO_P8 = 41, - INDEX_OPT_PKCS8 = 42, - INDEX_OPT_RSA = 43, - INDEX_OPT_DSA = 44, - INDEX_OPT_ECC = 45, - INDEX_OPT_ECDSA = 46, - INDEX_OPT_HASH = 47, - INDEX_OPT_INDER = 48, - INDEX_OPT_INRAW = 49, - INDEX_OPT_OUTDER = 50, - INDEX_OPT_OUTRAW = 51, - INDEX_OPT_BITS = 52, - INDEX_OPT_SEC_PARAM = 53, - INDEX_OPT_DISABLE_QUICK_RANDOM = 54, - INDEX_OPT_TEMPLATE = 55, - INDEX_OPT_PKCS_CIPHER = 56, - INDEX_OPT_VERSION = 57, - INDEX_OPT_HELP = 58, - INDEX_OPT_MORE_HELP = 59 + INDEX_OPT_CPRINT = 25, + INDEX_OPT_NULL_PASSWORD = 26, + INDEX_OPT_CERTIFICATE_INFO = 27, + INDEX_OPT_CERTIFICATE_PUBKEY = 28, + INDEX_OPT_PGP_CERTIFICATE_INFO = 29, + INDEX_OPT_PGP_RING_INFO = 30, + INDEX_OPT_CRL_INFO = 31, + INDEX_OPT_CRQ_INFO = 32, + INDEX_OPT_NO_CRQ_EXTENSIONS = 33, + INDEX_OPT_P12_INFO = 34, + INDEX_OPT_P7_INFO = 35, + INDEX_OPT_SMIME_TO_P7 = 36, + INDEX_OPT_KEY_INFO = 37, + INDEX_OPT_PGP_KEY_INFO = 38, + INDEX_OPT_PUBKEY_INFO = 39, + INDEX_OPT_V1 = 40, + INDEX_OPT_TO_P12 = 41, + INDEX_OPT_TO_P8 = 42, + INDEX_OPT_PKCS8 = 43, + INDEX_OPT_RSA = 44, + INDEX_OPT_DSA = 45, + INDEX_OPT_ECC = 46, + INDEX_OPT_ECDSA = 47, + INDEX_OPT_HASH = 48, + INDEX_OPT_INDER = 49, + INDEX_OPT_INRAW = 50, + INDEX_OPT_OUTDER = 51, + INDEX_OPT_OUTRAW = 52, + INDEX_OPT_BITS = 53, + INDEX_OPT_SEC_PARAM = 54, + INDEX_OPT_DISABLE_QUICK_RANDOM = 55, + INDEX_OPT_TEMPLATE = 56, + INDEX_OPT_PKCS_CIPHER = 57, + INDEX_OPT_VERSION = 58, + INDEX_OPT_HELP = 59, + INDEX_OPT_MORE_HELP = 60 } teOptIndex; -#define OPTION_CT 60 +#define OPTION_CT 61 #define CERTTOOL_VERSION "@VERSION@" #define CERTTOOL_FULL_VERSION "certtool @VERSION@" @@ -194,40 +195,41 @@ typedef enum { #define VALUE_OPT_LOAD_CA_CERTIFICATE 22 #define VALUE_OPT_PASSWORD 23 #define VALUE_OPT_HEX_NUMBERS 24 -#define VALUE_OPT_NULL_PASSWORD 25 +#define VALUE_OPT_CPRINT 25 +#define VALUE_OPT_NULL_PASSWORD 26 #define VALUE_OPT_CERTIFICATE_INFO 'i' -#define VALUE_OPT_CERTIFICATE_PUBKEY 27 -#define VALUE_OPT_PGP_CERTIFICATE_INFO 28 -#define VALUE_OPT_PGP_RING_INFO 29 +#define VALUE_OPT_CERTIFICATE_PUBKEY 28 +#define VALUE_OPT_PGP_CERTIFICATE_INFO 29 +#define VALUE_OPT_PGP_RING_INFO 30 #define VALUE_OPT_CRL_INFO 'l' -#define VALUE_OPT_CRQ_INFO 31 -#define VALUE_OPT_NO_CRQ_EXTENSIONS 32 -#define VALUE_OPT_P12_INFO 129 -#define VALUE_OPT_P7_INFO 130 -#define VALUE_OPT_SMIME_TO_P7 131 +#define VALUE_OPT_CRQ_INFO 32 +#define VALUE_OPT_NO_CRQ_EXTENSIONS 129 +#define VALUE_OPT_P12_INFO 130 +#define VALUE_OPT_P7_INFO 131 +#define VALUE_OPT_SMIME_TO_P7 132 #define VALUE_OPT_KEY_INFO 'k' -#define VALUE_OPT_PGP_KEY_INFO 133 -#define VALUE_OPT_PUBKEY_INFO 134 -#define VALUE_OPT_V1 135 -#define VALUE_OPT_TO_P12 136 -#define VALUE_OPT_TO_P8 137 +#define VALUE_OPT_PGP_KEY_INFO 134 +#define VALUE_OPT_PUBKEY_INFO 135 +#define VALUE_OPT_V1 136 +#define VALUE_OPT_TO_P12 137 +#define VALUE_OPT_TO_P8 138 #define VALUE_OPT_PKCS8 '8' -#define VALUE_OPT_RSA 139 -#define VALUE_OPT_DSA 140 -#define VALUE_OPT_ECC 141 -#define VALUE_OPT_ECDSA 142 -#define VALUE_OPT_HASH 143 -#define VALUE_OPT_INDER 144 -#define VALUE_OPT_INRAW 145 -#define VALUE_OPT_OUTDER 146 -#define VALUE_OPT_OUTRAW 147 -#define VALUE_OPT_BITS 148 +#define VALUE_OPT_RSA 140 +#define VALUE_OPT_DSA 141 +#define VALUE_OPT_ECC 142 +#define VALUE_OPT_ECDSA 143 +#define VALUE_OPT_HASH 144 +#define VALUE_OPT_INDER 145 +#define VALUE_OPT_INRAW 146 +#define VALUE_OPT_OUTDER 147 +#define VALUE_OPT_OUTRAW 148 +#define VALUE_OPT_BITS 149 #define OPT_VALUE_BITS (DESC(BITS).optArg.argInt) -#define VALUE_OPT_SEC_PARAM 149 -#define VALUE_OPT_DISABLE_QUICK_RANDOM 150 -#define VALUE_OPT_TEMPLATE 151 -#define VALUE_OPT_PKCS_CIPHER 152 +#define VALUE_OPT_SEC_PARAM 150 +#define VALUE_OPT_DISABLE_QUICK_RANDOM 151 +#define VALUE_OPT_TEMPLATE 152 +#define VALUE_OPT_PKCS_CIPHER 153 #define VALUE_OPT_HELP 'h' #define VALUE_OPT_MORE_HELP '!' #define VALUE_OPT_VERSION 'v' diff --git a/src/certtool-common.c b/src/certtool-common.c index a24f035d18..8d2414ec2c 100644 --- a/src/certtool-common.c +++ b/src/certtool-common.c @@ -40,6 +40,7 @@ #include #include #include "certtool-common.h" +#include "certtool-args.h" #include "certtool-cfg.h" /* Gnulib portability files. */ @@ -613,11 +614,26 @@ gnutls_sec_param_t str_to_sec_param (const char *str) } +#define SPACE "\t" static void -print_hex_datum (FILE* outfile, gnutls_datum_t * dat) +print_hex_datum (FILE* outfile, gnutls_datum_t * dat, int cprint) { unsigned int j; -#define SPACE "\t" + + if (cprint != 0) + { + fprintf (outfile, "\n" SPACE"\""); + for (j = 0; j < dat->size; j++) + { + fprintf (outfile, "\\x%.2x", (unsigned char) dat->data[j]); + if ((j + 1) % 15 == 0) + fprintf (outfile, "\"\n" SPACE); + } + fprintf (outfile, "\";\n\n"); + + return; + } + fprintf (outfile, "\n" SPACE); for (j = 0; j < dat->size; j++) { @@ -625,68 +641,100 @@ print_hex_datum (FILE* outfile, gnutls_datum_t * dat) if ((j + 1) % 15 == 0) fprintf (outfile, "\n" SPACE); } - fprintf (outfile, "\n"); + fprintf (outfile, "\n\n"); +} + +static void print_head(FILE* out, const char* txt, unsigned int size, int cprint) +{ +unsigned i; +char* p, * ntxt; + + if (cprint != 0) + { + if (size > 0) + asprintf(&ntxt, "const unsigned char %s[%u] =", txt, size); + else + asprintf(&ntxt, "const unsigned char %s[] =\n", txt); + + p = strstr(ntxt, "char"); + p += 5; + + for (i=0;isize, cprint); + print_hex_datum (outfile, x, cprint); + } + print_head (outfile, "public key", y->size, cprint); + print_hex_datum (outfile, y, cprint); + print_head (outfile, "p", p->size, cprint); + print_hex_datum (outfile, p, cprint); + print_head (outfile, "q", q->size, cprint); + print_hex_datum (outfile, q, cprint); + print_head (outfile, "g", g->size, cprint); + print_hex_datum (outfile, g, cprint); } void -print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, gnutls_datum_t * x, gnutls_datum_t * y) +print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, + gnutls_datum_t * x, gnutls_datum_t * y, int cprint) { - fprintf (outfile, "curve:\t%s\n", gnutls_ecc_curve_get_name(curve)); + if (cprint != 0) + fprintf (outfile, "/* curve: %s */\n", gnutls_ecc_curve_get_name(curve)); + else + fprintf (outfile, "curve:\t%s\n", gnutls_ecc_curve_get_name(curve)); + if (k) { - fprintf (outfile, "private key:"); - print_hex_datum (outfile, k); + print_head (outfile, "private key", k->size, cprint); + print_hex_datum (outfile, k, cprint); } - fprintf (outfile, "x:"); - print_hex_datum (outfile, x); - fprintf (outfile, "y:"); - print_hex_datum (outfile, y); + print_head (outfile, "x", x->size, cprint); + print_hex_datum (outfile, x, cprint); + print_head (outfile, "y", y->size, cprint); + print_hex_datum (outfile, y, cprint); } + void print_rsa_pkey (FILE* outfile, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, - gnutls_datum_t * exp1, gnutls_datum_t * exp2) + gnutls_datum_t * exp1, gnutls_datum_t * exp2, int cprint) { - fprintf (outfile, "modulus:"); - print_hex_datum (outfile, m); - fprintf (outfile, "public exponent:"); - print_hex_datum (outfile, e); + print_head (outfile, "modulus", m->size, cprint); + print_hex_datum (outfile, m, cprint); + print_head (outfile, "public exponent", e->size, cprint); + print_hex_datum (outfile, e, cprint); if (d) { - fprintf (outfile, "private exponent:"); - print_hex_datum (outfile, d); - fprintf (outfile, "prime1:"); - print_hex_datum (outfile, p); - fprintf (outfile, "prime2:"); - print_hex_datum (outfile, q); - fprintf (outfile, "coefficient:"); - print_hex_datum (outfile, u); + print_head (outfile, "private exponent", d->size, cprint); + print_hex_datum (outfile, d, cprint); + print_head (outfile, "prime1", p->size, cprint); + print_hex_datum (outfile, p, cprint); + print_head (outfile, "prime2", q->size, cprint); + print_hex_datum (outfile, q, cprint); + print_head (outfile, "coefficient", u->size, cprint); + print_hex_datum (outfile, u, cprint); if (exp1 && exp2) { - fprintf (outfile, "exp1:"); - print_hex_datum (outfile, exp1); - fprintf (outfile, "exp2:"); - print_hex_datum (outfile, exp2); + print_head (outfile, "exp1", exp1->size, cprint); + print_hex_datum (outfile, exp1, cprint); + print_head (outfile, "exp2", exp2->size, cprint); + print_hex_datum (outfile, exp2, cprint); } } } @@ -711,3 +759,191 @@ size_t size; fprintf (outfile, "\n%s\n", buffer); } + +static void +print_dh_info (FILE* outfile, gnutls_datum_t * p, gnutls_datum_t * g, unsigned int q_bits, int cprint) +{ + if (q_bits > 0) + { + if (cprint != 0) + fprintf (outfile, "\n /* recommended key length: %d bytes */\n\n", (7+q_bits)/8); + else + fprintf (outfile, "\nRecommended key length: %d bits\n\n", q_bits); + } + + print_head (outfile, "generator", g->size, cprint); + print_hex_datum (outfile, g, cprint); + + print_head (outfile, "prime", p->size, cprint); + print_hex_datum (outfile, p, cprint); + + +} + +void dh_info (FILE* infile, FILE* outfile, common_info_st * ci) +{ + gnutls_datum_t params; + size_t size; + int ret; + gnutls_dh_params_t dh_params; + gnutls_datum_t p, g; + unsigned int q_bits = 0; + + if (gnutls_dh_params_init (&dh_params) < 0) + { + fprintf (stderr, "Error in dh parameter initialization\n"); + exit (1); + } + + params.data = (void*)fread_file (infile, &size); + params.size = size; + + ret = + gnutls_dh_params_import_pkcs3 (dh_params, ¶ms, GNUTLS_X509_FMT_PEM); + if (ret < 0) + { + fprintf (stderr, "Error parsing dh params: %s\n", gnutls_strerror (ret)); + exit (1); + } + + ret = gnutls_dh_params_export_raw (dh_params, &p, &g, &q_bits); + if (ret < 0) + { + fprintf (stderr, "Error exporting parameters: %s\n", + gnutls_strerror (ret)); + exit (1); + } + + print_dh_info (outfile, &p, &g, q_bits, ci->cprint); + + if (!ci->cprint) + { /* generate a PKCS#3 structure */ + size_t len = buffer_size; + + ret = gnutls_dh_params_export_pkcs3 (dh_params, GNUTLS_X509_FMT_PEM, + buffer, &len); + + if (ret == 0) + { + fprintf (outfile, "\n%s", buffer); + } + else + { + fprintf (stderr, "Error: %s\n", gnutls_strerror (ret)); + } + } + + gnutls_dh_params_deinit(dh_params); +} + +/* If how is zero then the included parameters are used. + */ +int +generate_prime (FILE* outfile, int how, common_info_st * info) +{ + int ret; + gnutls_dh_params_t dh_params; + gnutls_datum_t p, g; + int bits = get_bits (GNUTLS_PK_DH, info->bits, info->sec_param, 1); + unsigned int q_bits = 0; + + gnutls_dh_params_init (&dh_params); + + if (how != 0) + { + fprintf (stderr, "Generating DH parameters (%d bits)...\n", bits); + fprintf (stderr, "(might take long time)\n"); + } + else + fprintf (stderr, "Retrieving DH parameters...\n"); + + if (how != 0) + { + ret = gnutls_dh_params_generate2 (dh_params, bits); + if (ret < 0) + { + fprintf (stderr, "Error generating parameters: %s\n", + gnutls_strerror (ret)); + exit (1); + } + + ret = gnutls_dh_params_export_raw (dh_params, &p, &g, &q_bits); + if (ret < 0) + { + fprintf (stderr, "Error exporting parameters: %s\n", + gnutls_strerror (ret)); + exit (1); + } + } + else + { +#ifdef ENABLE_SRP + if (bits <= 1024) + { + p = gnutls_srp_1024_group_prime; + g = gnutls_srp_1024_group_generator; + bits = 1024; + } + else if (bits <= 1536) + { + p = gnutls_srp_1536_group_prime; + g = gnutls_srp_1536_group_generator; + bits = 1536; + } + else if (bits <= 2048) + { + p = gnutls_srp_2048_group_prime; + g = gnutls_srp_2048_group_generator; + bits = 2048; + } + else if (bits <= 3072) + { + p = gnutls_srp_3072_group_prime; + g = gnutls_srp_3072_group_generator; + bits = 3072; + } + else + { + p = gnutls_srp_4096_group_prime; + g = gnutls_srp_4096_group_generator; + bits = 4096; + } + + ret = gnutls_dh_params_import_raw (dh_params, &p, &g); + if (ret < 0) + { + fprintf (stderr, "Error exporting parameters: %s\n", + gnutls_strerror (ret)); + exit (1); + } +#else + fprintf (stderr, "Parameters unavailable as SRP is disabled.\n"); + exit (1); +#endif + } + + print_dh_info (outfile, &p, &g, q_bits, info->cprint); + + if (!info->cprint) + { /* generate a PKCS#3 structure */ + size_t len = buffer_size; + + ret = gnutls_dh_params_export_pkcs3 (dh_params, GNUTLS_X509_FMT_PEM, + buffer, &len); + + if (ret == 0) + { + fprintf (outfile, "\n%s", buffer); + } + else + { + fprintf (stderr, "Error: %s\n", gnutls_strerror (ret)); + } + + } + + gnutls_dh_params_deinit(dh_params); + + return 0; +} + diff --git a/src/certtool-common.h b/src/certtool-common.h index ea296d5957..556a3cc27c 100644 --- a/src/certtool-common.h +++ b/src/certtool-common.h @@ -52,6 +52,8 @@ typedef struct common_info unsigned int crq_extensions; unsigned int v1_cert; + int cprint; + unsigned int verbose; } common_info_st; @@ -73,21 +75,22 @@ int get_bits (gnutls_pk_algorithm_t key_type, int info_bits, const char* info_se gnutls_sec_param_t str_to_sec_param (const char *str); /* prime.c */ -int generate_prime (int how, common_info_st * info); -void dh_info (common_info_st * ci); +int generate_prime (FILE* outfile, int how, common_info_st * info); +void dh_info (FILE* infile, FILE* outfile, common_info_st * ci); gnutls_x509_privkey_t * load_privkey_list (int mand, size_t * privkey_size, common_info_st * info); void _pubkey_info(FILE* outfile, gnutls_certificate_print_formats_t, gnutls_pubkey_t pubkey); void -print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, gnutls_datum_t * x, gnutls_datum_t * y); +print_ecc_pkey (FILE* outfile, gnutls_ecc_curve_t curve, gnutls_datum_t* k, gnutls_datum_t * x, + gnutls_datum_t * y, int cprint); void print_rsa_pkey (FILE* outfile, gnutls_datum_t * m, gnutls_datum_t * e, gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * u, - gnutls_datum_t * exp1, gnutls_datum_t * exp2); + gnutls_datum_t * exp1, gnutls_datum_t * exp2, int cprint); void print_dsa_pkey (FILE* outfile, gnutls_datum_t * x, gnutls_datum_t * y, gnutls_datum_t * p, - gnutls_datum_t * q, gnutls_datum_t * g); + gnutls_datum_t * q, gnutls_datum_t * g, int cprint); FILE *safe_open_rw (const char *file, int privkey_op); diff --git a/src/certtool.c b/src/certtool.c index 6230f76175..570c278c63 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -928,7 +928,7 @@ cmd_parser (int argc, char **argv) req_key_type = GNUTLS_PK_ECC; else req_key_type = GNUTLS_PK_RSA; - + default_dig = GNUTLS_DIG_UNKNOWN; if (HAVE_OPT(HASH)) { @@ -980,6 +980,8 @@ cmd_parser (int argc, char **argv) if (HAVE_OPT(VERBOSE)) cinfo.verbose = 1; + + cinfo.cprint = HAVE_OPT(CPRINT); if (HAVE_OPT(LOAD_PRIVKEY)) cinfo.privkey = OPT_ARG(LOAD_PRIVKEY); @@ -1055,7 +1057,7 @@ cmd_parser (int argc, char **argv) else if (HAVE_OPT(CERTIFICATE_INFO)) certificate_info (0, &cinfo); else if (HAVE_OPT(DH_INFO)) - dh_info (&cinfo); + dh_info (infile, outfile, &cinfo); else if (HAVE_OPT(CERTIFICATE_PUBKEY)) certificate_info (1, &cinfo); else if (HAVE_OPT(KEY_INFO)) @@ -1067,9 +1069,9 @@ cmd_parser (int argc, char **argv) else if (HAVE_OPT(P12_INFO)) pkcs12_info (&cinfo); else if (HAVE_OPT(GENERATE_DH_PARAMS)) - generate_prime (1, &cinfo); + generate_prime (outfile, 1, &cinfo); else if (HAVE_OPT(GET_DH_PARAMS)) - generate_prime (0, &cinfo); + generate_prime (outfile, 0, &cinfo); else if (HAVE_OPT(CRL_INFO)) crl_info (); else if (HAVE_OPT(P7_INFO)) @@ -1300,7 +1302,7 @@ pgp_privkey_info (void) fprintf (stderr, "Error in key RSA data export: %s\n", gnutls_strerror (ret)); else - print_rsa_pkey (outfile, &m, &e, &d, &p, &q, &u, NULL, NULL); + print_rsa_pkey (outfile, &m, &e, &d, &p, &q, &u, NULL, NULL, HAVE_OPT(CPRINT)); bits = m.size * 8; } @@ -1319,7 +1321,7 @@ pgp_privkey_info (void) fprintf (stderr, "Error in key DSA data export: %s\n", gnutls_strerror (ret)); else - print_dsa_pkey (outfile, &x, &y, &p, &q, &g); + print_dsa_pkey (outfile, &x, &y, &p, &q, &g, HAVE_OPT(CPRINT)); bits = y.size * 8; } @@ -1613,7 +1615,7 @@ const char *cprint; gnutls_strerror (ret)); else { - print_rsa_pkey (outfile, &m, &e, &d, &p, &q, &u, &exp1, &exp2); + print_rsa_pkey (outfile, &m, &e, &d, &p, &q, &u, &exp1, &exp2, HAVE_OPT(CPRINT)); gnutls_free (m.data); gnutls_free (e.data); @@ -1635,7 +1637,7 @@ const char *cprint; gnutls_strerror (ret)); else { - print_dsa_pkey (outfile, &x, &y, &p, &q, &g); + print_dsa_pkey (outfile, &x, &y, &p, &q, &g, HAVE_OPT(CPRINT)); gnutls_free (x.data); gnutls_free (y.data); @@ -1655,7 +1657,7 @@ const char *cprint; gnutls_strerror (ret)); else { - print_ecc_pkey (outfile, curve, &k, &x, &y); + print_ecc_pkey (outfile, curve, &k, &x, &y, HAVE_OPT(CPRINT)); gnutls_free (x.data); gnutls_free (y.data); diff --git a/src/dh.c b/src/dh.c deleted file mode 100644 index 2050d4f68c..0000000000 --- a/src/dh.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (C) 2001-2012 Free Software Foundation, Inc. - * - * This file is part of GnuTLS. - * - * GnuTLS is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * GnuTLS is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * . - */ - -#include - -#include -#include -#include -#include -#include -#include -#include - -/* Generates Diffie-Hellman parameters (a prime and a generator - * of the group). Exports them in PKCS #3 format. Used by certtool. - */ - -extern FILE *outfile; -extern FILE *infile; - -static void -print_dh_info (gnutls_datum_t * p, gnutls_datum_t * g, unsigned int q_bits) -{ -unsigned int i; - - fprintf (outfile, "\nGenerator (%d bits): ", g->size*8); - - for (i = 0; i < g->size; i++) - { - if (i != 0 && i % 12 == 0) - fprintf (outfile, "\n\t"); - else if (i != 0 && i != g->size) - fprintf (outfile, ":"); - - fprintf (outfile, "%.2x", g->data[i]); - } - - fprintf (outfile, "\n\n"); - - /* print prime */ - - fprintf (outfile, "Prime (%d bits):", p->size*8); - - for (i = 0; i < p->size; i++) - { - if (i % 12 == 0) - fprintf (outfile, "\n\t"); - else if (i != 0 && i != p->size) - fprintf (outfile, ":"); - fprintf (outfile, "%.2x", p->data[i]); - } - - if (q_bits > 0) - fprintf (outfile, "\n\nRecommended key length: %d bits\n", q_bits); - fprintf (outfile, "\n"); - -} - -void dh_info (common_info_st * ci) -{ - gnutls_datum_t params; - size_t size; - int ret; - gnutls_dh_params_t dh_params; - gnutls_datum_t p, g; - unsigned int q_bits = 0; - - if (gnutls_dh_params_init (&dh_params) < 0) - { - fprintf (stderr, "Error in dh parameter initialization\n"); - exit (1); - } - - params.data = (void*)fread_file (infile, &size); - params.size = size; - - ret = - gnutls_dh_params_import_pkcs3 (dh_params, ¶ms, GNUTLS_X509_FMT_PEM); - if (ret < 0) - { - fprintf (stderr, "Error parsing dh params: %s\n", gnutls_strerror (ret)); - exit (1); - } - - ret = gnutls_dh_params_export_raw (dh_params, &p, &g, &q_bits); - if (ret < 0) - { - fprintf (stderr, "Error exporting parameters: %s\n", - gnutls_strerror (ret)); - exit (1); - } - - print_dh_info (&p, &g, q_bits); - - { /* generate a PKCS#3 structure */ - size_t len = buffer_size; - - ret = gnutls_dh_params_export_pkcs3 (dh_params, GNUTLS_X509_FMT_PEM, - buffer, &len); - - if (ret == 0) - { - fprintf (outfile, "\n%s", buffer); - } - else - { - fprintf (stderr, "Error: %s\n", gnutls_strerror (ret)); - } - - } - - gnutls_dh_params_deinit(dh_params); -} - -/* If how is zero then the included parameters are used. - */ -int -generate_prime (int how, common_info_st * info) -{ - int ret; - gnutls_dh_params_t dh_params; - gnutls_datum_t p, g; - int bits = get_bits (GNUTLS_PK_DH, info->bits, info->sec_param, 1); - unsigned int q_bits = 0; - - gnutls_dh_params_init (&dh_params); - - if (how != 0) - { - fprintf (stderr, "Generating DH parameters (%d bits)...\n", bits); - fprintf (stderr, "(might take long time)\n"); - } - else - fprintf (stderr, "Retrieving DH parameters...\n"); - - if (how != 0) - { - ret = gnutls_dh_params_generate2 (dh_params, bits); - if (ret < 0) - { - fprintf (stderr, "Error generating parameters: %s\n", - gnutls_strerror (ret)); - exit (1); - } - - ret = gnutls_dh_params_export_raw (dh_params, &p, &g, &q_bits); - if (ret < 0) - { - fprintf (stderr, "Error exporting parameters: %s\n", - gnutls_strerror (ret)); - exit (1); - } - } - else - { -#ifdef ENABLE_SRP - if (bits <= 1024) - { - p = gnutls_srp_1024_group_prime; - g = gnutls_srp_1024_group_generator; - bits = 1024; - } - else if (bits <= 1536) - { - p = gnutls_srp_1536_group_prime; - g = gnutls_srp_1536_group_generator; - bits = 1536; - } - else if (bits <= 2048) - { - p = gnutls_srp_2048_group_prime; - g = gnutls_srp_2048_group_generator; - bits = 2048; - } - else if (bits <= 3072) - { - p = gnutls_srp_3072_group_prime; - g = gnutls_srp_3072_group_generator; - bits = 3072; - } - else - { - p = gnutls_srp_4096_group_prime; - g = gnutls_srp_4096_group_generator; - bits = 4096; - } - - ret = gnutls_dh_params_import_raw (dh_params, &p, &g); - if (ret < 0) - { - fprintf (stderr, "Error exporting parameters: %s\n", - gnutls_strerror (ret)); - exit (1); - } -#else - fprintf (stderr, "Parameters unavailable as SRP is disabled.\n"); - exit (1); -#endif - } - - print_dh_info (&p, &g, q_bits); - - { /* generate a PKCS#3 structure */ - size_t len = buffer_size; - - ret = gnutls_dh_params_export_pkcs3 (dh_params, GNUTLS_X509_FMT_PEM, - buffer, &len); - - if (ret == 0) - { - fprintf (outfile, "\n%s", buffer); - } - else - { - fprintf (stderr, "Error: %s\n", gnutls_strerror (ret)); - } - - } - - gnutls_dh_params_deinit(dh_params); - - return 0; -} -