1/* apps/pkey.c */
2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4 * 2006
5 */
6/* ====================================================================
7 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
8 *
--- 65 unchanged lines hidden (view full) ---
74 char *passargin = NULL, *passargout = NULL;
75 BIO *in = NULL, *out = NULL;
76 const EVP_CIPHER *cipher = NULL;
77 int informat, outformat;
78 int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;
79 EVP_PKEY *pkey = NULL;
80 char *passin = NULL, *passout = NULL;
81 int badarg = 0;
82 char *engine = NULL;
83 int ret = 1;
84
85 if (bio_err == NULL)
86 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
87
88 if (!load_config(bio_err, NULL))
89 goto end;
90
--- 80 unchanged lines hidden (view full) ---
171 BIO_printf(bio_err,
172 "-passout arg output file pass phrase source\n");
173#ifndef OPENSSL_NO_ENGINE
174 BIO_printf(bio_err,
175 "-engine e use engine e, possibly a hardware device.\n");
176#endif
177 return 1;
178 }
179 e = setup_engine(bio_err, engine, 0);
180
181 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
182 BIO_printf(bio_err, "Error getting passwords\n");
183 goto end;
184 }
185
186 if (outfile) {
187 if (!(out = BIO_new_file(outfile, "wb"))) {
--- 43 unchanged lines hidden (view full) ---
231 else
232 EVP_PKEY_print_private(out, pkey, 0, NULL);
233 }
234
235 ret = 0;
236
237 end:
238 EVP_PKEY_free(pkey);
239 release_engine(e);
240 BIO_free_all(out);
241 BIO_free(in);
242 if (passin)
243 OPENSSL_free(passin);
244 if (passout)
245 OPENSSL_free(passout);
246
247 return ret;
248}
2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
4 * 2006
5 */
6/* ====================================================================
7 * Copyright (c) 2006 The OpenSSL Project. All rights reserved.
8 *
--- 65 unchanged lines hidden (view full) ---
74 char *passargin = NULL, *passargout = NULL;
75 BIO *in = NULL, *out = NULL;
76 const EVP_CIPHER *cipher = NULL;
77 int informat, outformat;
78 int pubin = 0, pubout = 0, pubtext = 0, text = 0, noout = 0;
79 EVP_PKEY *pkey = NULL;
80 char *passin = NULL, *passout = NULL;
81 int badarg = 0;
82 char *engine = NULL;
83 int ret = 1;
84
85 if (bio_err == NULL)
86 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
87
88 if (!load_config(bio_err, NULL))
89 goto end;
90
--- 80 unchanged lines hidden (view full) ---
171 BIO_printf(bio_err,
172 "-passout arg output file pass phrase source\n");
173#ifndef OPENSSL_NO_ENGINE
174 BIO_printf(bio_err,
175 "-engine e use engine e, possibly a hardware device.\n");
176#endif
177 return 1;
178 }
179 e = setup_engine(bio_err, engine, 0);
180
181 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
182 BIO_printf(bio_err, "Error getting passwords\n");
183 goto end;
184 }
185
186 if (outfile) {
187 if (!(out = BIO_new_file(outfile, "wb"))) {
--- 43 unchanged lines hidden (view full) ---
231 else
232 EVP_PKEY_print_private(out, pkey, 0, NULL);
233 }
234
235 ret = 0;
236
237 end:
238 EVP_PKEY_free(pkey);
239 release_engine(e);
240 BIO_free_all(out);
241 BIO_free(in);
242 if (passin)
243 OPENSSL_free(passin);
244 if (passout)
245 OPENSSL_free(passout);
246
247 return ret;
248}