pkcs8.c (109998) | pkcs8.c (111147) |
---|---|
1/* pkcs8.c */ 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL 3 * project 1999. 4 */ 5/* ==================================================================== 6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 71 unchanged lines hidden (view full) --- 80 int informat, outformat; 81 int p8_broken = PKCS8_OK; 82 int nocrypt = 0; 83 X509_SIG *p8; 84 PKCS8_PRIV_KEY_INFO *p8inf; 85 EVP_PKEY *pkey=NULL; 86 char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; 87 int badarg = 0; | 1/* pkcs8.c */ 2/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL 3 * project 1999. 4 */ 5/* ==================================================================== 6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 71 unchanged lines hidden (view full) --- 80 int informat, outformat; 81 int p8_broken = PKCS8_OK; 82 int nocrypt = 0; 83 X509_SIG *p8; 84 PKCS8_PRIV_KEY_INFO *p8inf; 85 EVP_PKEY *pkey=NULL; 86 char pass[50], *passin = NULL, *passout = NULL, *p8pass = NULL; 87 int badarg = 0; |
88#ifndef OPENSSL_NO_ENGINE |
|
88 char *engine=NULL; | 89 char *engine=NULL; |
90#endif |
|
89 90 if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); 91 92 if (!load_config(bio_err, NULL)) 93 goto end; 94 95 informat=FORMAT_PEM; 96 outformat=FORMAT_PEM; --- 43 unchanged lines hidden (view full) --- 140 if (!args[1]) goto bad; 141 passargin= *(++args); 142 } 143 else if (!strcmp(*args,"-passout")) 144 { 145 if (!args[1]) goto bad; 146 passargout= *(++args); 147 } | 91 92 if (bio_err == NULL) bio_err = BIO_new_fp (stderr, BIO_NOCLOSE); 93 94 if (!load_config(bio_err, NULL)) 95 goto end; 96 97 informat=FORMAT_PEM; 98 outformat=FORMAT_PEM; --- 43 unchanged lines hidden (view full) --- 142 if (!args[1]) goto bad; 143 passargin= *(++args); 144 } 145 else if (!strcmp(*args,"-passout")) 146 { 147 if (!args[1]) goto bad; 148 passargout= *(++args); 149 } |
150#ifndef OPENSSL_NO_ENGINE |
|
148 else if (strcmp(*args,"-engine") == 0) 149 { 150 if (!args[1]) goto bad; 151 engine= *(++args); 152 } | 151 else if (strcmp(*args,"-engine") == 0) 152 { 153 if (!args[1]) goto bad; 154 engine= *(++args); 155 } |
156#endif |
|
153 else if (!strcmp (*args, "-in")) { 154 if (args[1]) { 155 args++; 156 infile = *args; 157 } else badarg = 1; 158 } else if (!strcmp (*args, "-out")) { 159 if (args[1]) { 160 args++; --- 16 unchanged lines hidden (view full) --- 177 BIO_printf(bio_err, "-topk8 output PKCS8 file\n"); 178 BIO_printf(bio_err, "-nooct use (nonstandard) no octet format\n"); 179 BIO_printf(bio_err, "-embed use (nonstandard) embedded DSA parameters format\n"); 180 BIO_printf(bio_err, "-nsdb use (nonstandard) DSA Netscape DB format\n"); 181 BIO_printf(bio_err, "-noiter use 1 as iteration count\n"); 182 BIO_printf(bio_err, "-nocrypt use or expect unencrypted private key\n"); 183 BIO_printf(bio_err, "-v2 alg use PKCS#5 v2.0 and cipher \"alg\"\n"); 184 BIO_printf(bio_err, "-v1 obj use PKCS#5 v1.5 and cipher \"alg\"\n"); | 157 else if (!strcmp (*args, "-in")) { 158 if (args[1]) { 159 args++; 160 infile = *args; 161 } else badarg = 1; 162 } else if (!strcmp (*args, "-out")) { 163 if (args[1]) { 164 args++; --- 16 unchanged lines hidden (view full) --- 181 BIO_printf(bio_err, "-topk8 output PKCS8 file\n"); 182 BIO_printf(bio_err, "-nooct use (nonstandard) no octet format\n"); 183 BIO_printf(bio_err, "-embed use (nonstandard) embedded DSA parameters format\n"); 184 BIO_printf(bio_err, "-nsdb use (nonstandard) DSA Netscape DB format\n"); 185 BIO_printf(bio_err, "-noiter use 1 as iteration count\n"); 186 BIO_printf(bio_err, "-nocrypt use or expect unencrypted private key\n"); 187 BIO_printf(bio_err, "-v2 alg use PKCS#5 v2.0 and cipher \"alg\"\n"); 188 BIO_printf(bio_err, "-v1 obj use PKCS#5 v1.5 and cipher \"alg\"\n"); |
189#ifndef OPENSSL_NO_ENGINE |
|
185 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); | 190 BIO_printf(bio_err," -engine e use engine e, possibly a hardware device.\n"); |
191#endif |
|
186 return (1); 187 } 188 | 192 return (1); 193 } 194 |
195#ifndef OPENSSL_NO_ENGINE |
|
189 e = setup_engine(bio_err, engine, 0); | 196 e = setup_engine(bio_err, engine, 0); |
197#endif |
|
190 191 if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 192 BIO_printf(bio_err, "Error getting passwords\n"); 193 return (1); 194 } 195 196 if ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC; 197 --- 165 unchanged lines hidden --- | 198 199 if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) { 200 BIO_printf(bio_err, "Error getting passwords\n"); 201 return (1); 202 } 203 204 if ((pbe_nid == -1) && !cipher) pbe_nid = NID_pbeWithMD5AndDES_CBC; 205 --- 165 unchanged lines hidden --- |