int badarg = 0;
int flags = PKCS7_DETACHED;
char *to = NULL, *from = NULL, *subject = NULL;
- char *CAfile = NULL, *CApath = NULL, *passin = NULL;
+ char *CAfile = NULL, *CApath = NULL;
+ char *passargin = NULL, *passin = NULL;
char *inrand = NULL;
int need_rand = 0;
args = argv + 1;
} else if (!strcmp(*args,"-passin")) {
if (args[1]) {
args++;
- passin = *args;
- } else badarg = 1;
- } else if (!strcmp(*argv,"-envpassin")) {
- if (args[1]) {
- args++;
- if(!(passin= getenv(*args))) {
- BIO_printf(bio_err,
- "Can't read environment variable %s\n",
- *args);
- badarg = 1;
- }
+ passargin = *args;
} else badarg = 1;
} else if (!strcmp (*args, "-to")) {
if (args[1]) {
BIO_printf (bio_err, "-text include or delete text MIME headers\n");
BIO_printf (bio_err, "-CApath dir trusted certificates directory\n");
BIO_printf (bio_err, "-CAfile file trusted certificates file\n");
- BIO_printf(bio_err, "-rand file:file:...\n");
+ BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
BIO_printf(bio_err, " the random number generator\n");
BIO_printf (bio_err, "cert.pem recipient certificate(s) for encryption\n");
goto end;
}
+ if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
+ BIO_printf(bio_err, "Error getting password\n");
+ goto end;
+ }
+
if (need_rand) {
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
if (inrand != NULL)
}
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
- CRYPTO_push_info("PKCS7_iget_signers");
+ CRYPTO_push_info("PKCS7_get0_signers");
#endif
- signers = PKCS7_iget_signers(p7, other, flags);
+ signers = PKCS7_get0_signers(p7, other, flags);
#ifdef CRYPTO_MDEBUG
CRYPTO_pop_info();
CRYPTO_push_info("save_certs");
BIO_free(in);
BIO_free(indata);
BIO_free(out);
+ if(passin) Free(passin);
return (ret);
}
BIO *in;
EVP_PKEY *key;
if(!(in = BIO_new_file(file, "r"))) return NULL;
- key = PEM_read_bio_PrivateKey(in, NULL,PEM_cb,pass);
+ key = PEM_read_bio_PrivateKey(in, NULL,NULL,pass);
BIO_free(in);
return key;
}
return NULL;
}
-int save_certs(char *signerfile, STACK_OF(X509) *signers)
+static int save_certs(char *signerfile, STACK_OF(X509) *signers)
{
int i;
BIO *tmp;