- /* Make a shrouded key bag */
- p8 = EVP_PKEY2PKCS8 (key);
- if(keytype) PKCS8_add_keyusage(p8, keytype);
- bag = PKCS12_MAKE_SHKEYBAG(key_pbe, cpass, -1, NULL, 0, iter, p8);
- PKCS8_PRIV_KEY_INFO_free(p8);
- p8 = NULL;
- if (name) PKCS12_add_friendlyname (bag, name, -1);
- PKCS12_add_localkeyid (bag, keyid, keyidlen);
- bags = sk_PKCS12_SAFEBAG_new_null();
- sk_PKCS12_SAFEBAG_push (bags, bag);
-
-#ifdef CRYPTO_MDEBUG
- CRYPTO_pop_info();
- CRYPTO_push_info("encrypting shrouded key bag");
-#endif
-
- /* Turn it into unencrypted safe bag */
- authsafe = PKCS12_pack_p7data (bags);
- sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
- bags = NULL;
- sk_PKCS7_push (safes, authsafe);
+ if(!noprompt &&
+ EVP_read_pw_string(pass, sizeof pass, "Enter Export Password:", 1))
+ {
+ BIO_printf (bio_err, "Can't read Password\n");
+ goto export_end;
+ }
+ if (!twopass) BUF_strlcpy(macpass, pass, sizeof macpass);