summaryrefslogtreecommitdiffstats
path: root/apps/pkcs8.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-03-04 03:48:39 +0000
committerDr. Stephen Henson <steve@openssl.org>2016-03-07 17:11:21 +0000
commit54dbf42398e23349b59f258a3dd60387bbc5ba13 (patch)
tree4de8d56f6662ebb120d4bf15df140be8460d69b4 /apps/pkcs8.c
parent1e61392296d15b1edb89e346e1f75d0235aba2e7 (diff)
Make PKCS8_PRIV_KEY_INFO opaque.
Make PKCS8_PRIV_KEY_INFO opaque. Several accessor functions already exist for this structure. Two new ones were added to handle attributes. The old handling of broken formats has been removed and the corresponding structures simplified. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps/pkcs8.c')
-rw-r--r--apps/pkcs8.c44
1 files changed, 3 insertions, 41 deletions
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index 0968fef946..8a4d5423d1 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -67,7 +67,7 @@
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_INFORM, OPT_OUTFORM, OPT_ENGINE, OPT_IN, OPT_OUT,
- OPT_TOPK8, OPT_NOITER, OPT_NOCRYPT, OPT_NOOCT, OPT_NSDB, OPT_EMBED,
+ OPT_TOPK8, OPT_NOITER, OPT_NOCRYPT,
#ifndef OPENSSL_NO_SCRYPT
OPT_SCRYPT, OPT_SCRYPT_N, OPT_SCRYPT_R, OPT_SCRYPT_P,
#endif
@@ -83,10 +83,6 @@ OPTIONS pkcs8_options[] = {
{"topk8", OPT_TOPK8, '-', "Output PKCS8 file"},
{"noiter", OPT_NOITER, '-', "Use 1 as iteration count"},
{"nocrypt", OPT_NOCRYPT, '-', "Use or expect unencrypted private key"},
- {"nooct", OPT_NOOCT, '-', "Use (nonstandard) no octet format"},
- {"nsdb", OPT_NSDB, '-', "Use (nonstandard) DSA Netscape DB format"},
- {"embed", OPT_EMBED, '-',
- "Use (nonstandard) embedded DSA parameters format"},
{"v2", OPT_V2, 's', "Use PKCS#5 v2.0 and cipher"},
{"v1", OPT_V1, 's', "Use PKCS#5 v1.5 and cipher"},
{"v2prf", OPT_V2PRF, 's'},
@@ -117,7 +113,7 @@ int pkcs8_main(int argc, char **argv)
char *passinarg = NULL, *passoutarg = NULL, *prog;
char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL;
OPTION_CHOICE o;
- int nocrypt = 0, ret = 1, iter = PKCS12_DEFAULT_ITER, p8_broken = PKCS8_OK;
+ int nocrypt = 0, ret = 1, iter = PKCS12_DEFAULT_ITER;
int informat = FORMAT_PEM, outformat = FORMAT_PEM, topk8 = 0, pbe_nid = -1;
int private = 0;
#ifndef OPENSSL_NO_SCRYPT
@@ -159,15 +155,6 @@ int pkcs8_main(int argc, char **argv)
case OPT_NOCRYPT:
nocrypt = 1;
break;
- case OPT_NOOCT:
- p8_broken = PKCS8_NO_OCTET;
- break;
- case OPT_NSDB:
- p8_broken = PKCS8_NS_DB;
- break;
- case OPT_EMBED:
- p8_broken = PKCS8_EMBEDDED_PARAM;
- break;
case OPT_V2:
if (!opt_cipher(opt_arg(), &cipher))
goto opthelp;
@@ -249,7 +236,7 @@ int pkcs8_main(int argc, char **argv)
pkey = load_key(infile, informat, 1, passin, e, "key");
if (!pkey)
goto end;
- if ((p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken)) == NULL) {
+ if ((p8inf = EVP_PKEY2PKCS8(pkey)) == NULL) {
BIO_printf(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
goto end;
@@ -362,31 +349,6 @@ int pkcs8_main(int argc, char **argv)
goto end;
}
- if (p8inf->broken) {
- BIO_printf(bio_err, "Warning: broken key encoding: ");
- switch (p8inf->broken) {
- case PKCS8_NO_OCTET:
- BIO_printf(bio_err, "No Octet String in PrivateKey\n");
- break;
-
- case PKCS8_EMBEDDED_PARAM:
- BIO_printf(bio_err, "DSA parameters included in PrivateKey\n");
- break;
-
- case PKCS8_NS_DB:
- BIO_printf(bio_err, "DSA public key include in PrivateKey\n");
- break;
-
- case PKCS8_NEG_PRIVKEY:
- BIO_printf(bio_err, "DSA private key value is negative\n");
- break;
-
- default:
- BIO_printf(bio_err, "Unknown broken type\n");
- break;
- }
- }
-
assert(private);
if (outformat == FORMAT_PEM)
PEM_write_bio_PrivateKey(out, pkey, NULL, NULL, 0, NULL, passout);