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#ifndef OPENSSL_NO_ENGINE
83 char *engine = NULL;
84#endif
85 int ret = 1;
86
87 if (bio_err == NULL)
88 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
89
90 if (!load_config(bio_err, NULL))
91 goto end;
92
--- 80 unchanged lines hidden (view full) ---
173 BIO_printf(bio_err,
174 "-passout arg output file pass phrase source\n");
175#ifndef OPENSSL_NO_ENGINE
176 BIO_printf(bio_err,
177 "-engine e use engine e, possibly a hardware device.\n");
178#endif
179 return 1;
180 }
181#ifndef OPENSSL_NO_ENGINE
182 e = setup_engine(bio_err, engine, 0);
183#endif
184
185 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
186 BIO_printf(bio_err, "Error getting passwords\n");
187 goto end;
188 }
189
190 if (outfile) {
191 if (!(out = BIO_new_file(outfile, "wb"))) {
--- 43 unchanged lines hidden (view full) ---
235 else
236 EVP_PKEY_print_private(out, pkey, 0, NULL);
237 }
238
239 ret = 0;
240
241 end:
242 EVP_PKEY_free(pkey);
243 BIO_free_all(out);
244 BIO_free(in);
245 if (passin)
246 OPENSSL_free(passin);
247 if (passout)
248 OPENSSL_free(passout);
249
250 return ret;
251}
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#ifndef OPENSSL_NO_ENGINE
83 char *engine = NULL;
84#endif
85 int ret = 1;
86
87 if (bio_err == NULL)
88 bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
89
90 if (!load_config(bio_err, NULL))
91 goto end;
92
--- 80 unchanged lines hidden (view full) ---
173 BIO_printf(bio_err,
174 "-passout arg output file pass phrase source\n");
175#ifndef OPENSSL_NO_ENGINE
176 BIO_printf(bio_err,
177 "-engine e use engine e, possibly a hardware device.\n");
178#endif
179 return 1;
180 }
181#ifndef OPENSSL_NO_ENGINE
182 e = setup_engine(bio_err, engine, 0);
183#endif
184
185 if (!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
186 BIO_printf(bio_err, "Error getting passwords\n");
187 goto end;
188 }
189
190 if (outfile) {
191 if (!(out = BIO_new_file(outfile, "wb"))) {
--- 43 unchanged lines hidden (view full) ---
235 else
236 EVP_PKEY_print_private(out, pkey, 0, NULL);
237 }
238
239 ret = 0;
240
241 end:
242 EVP_PKEY_free(pkey);
243 BIO_free_all(out);
244 BIO_free(in);
245 if (passin)
246 OPENSSL_free(passin);
247 if (passout)
248 OPENSSL_free(passout);
249
250 return ret;
251}