Fix email address delete code.
[openssl.git] / apps / pkcs8.c
index 5e20a2be70b526eecff0c34082cca762ca7d37c9..c0becce9033776af57798a59529eb74cb8ba23ea 100644 (file)
@@ -62,7 +62,6 @@
 #include <openssl/err.h>
 #include <openssl/evp.h>
 #include <openssl/pkcs12.h>
-#include <openssl/engine.h>
 
 #include "apps.h"
 #define PROG pkcs8_main
@@ -217,21 +216,13 @@ int MAIN(int argc, char **argv)
                }
 #endif
        }
-       if (topk8) {
-               if(informat == FORMAT_PEM)
-                       pkey = PEM_read_bio_PrivateKey(in, NULL, NULL, passin);
-               else if(informat == FORMAT_ASN1)
-                       pkey = d2i_PrivateKey_bio(in, NULL);
-               else {
-                       BIO_printf(bio_err, "Bad format specified for key\n");
-                       return (1);
-               }
+       if (topk8)
+               {
+               BIO_free(in); /* Not needed in this section */
+               pkey = load_key(bio_err, infile, informat, passin, e, "key");
                if (!pkey) {
-                       BIO_printf(bio_err, "Error reading key\n", outfile);
-                       ERR_print_errors(bio_err);
                        return (1);
                }
-               BIO_free(in);
                if (!(p8inf = EVP_PKEY2PKCS8_broken(pkey, p8_broken))) {
                        BIO_printf(bio_err, "Error converting key\n", outfile);
                        ERR_print_errors(bio_err);