Commit 36217a94 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Allow passwords to be included on command line for a few

more utilities.
parent 12aefe78
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4,6 +4,12 @@

 Changes between 0.9.4 and 0.9.5  [xx XXX 1999]

  *) Add a password callback function PEM_cb() which either prompts for
     a password if usr_data is NULL or otherwise assumes it is a null
     terminate password. Allow passwords to be passed on command line
     environment or config files in a few more utilities.
     [Steve Henson]

  *) Add a bunch of DER and PEM functions to handle PKCS#8 format private
     keys. Add some short names for PKCS#8 PBE algorithms and allow them
     to be specified on the command line for the pkcs8 and pkcs12 utilities.
+0 −11
Original line number Diff line number Diff line
@@ -325,17 +325,6 @@ int app_init(long mesgwin)
	}
#endif

int MS_CALLBACK key_cb(char *buf, int len, int verify, void *key)
	{
	int i;

	if (key == NULL) return(0);
	i=strlen(key);
	i=(i > len)?len:i;
	memcpy(buf,key,i);
	return(i);
	}

int dump_cert_text (BIO *out, X509 *x)
{
	char buf[256];
+0 −1
Original line number Diff line number Diff line
@@ -143,7 +143,6 @@ int args_from_file(char *file, int *argc, char **argv[]);
int str2fmt(char *s);
void program_name(char *in,char *out,int size);
int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
int MS_CALLBACK key_cb(char *buf,int len,int verify,void *u);
#ifdef HEADER_X509_H
int dump_cert_text(BIO *out, X509 *x);
#endif
+2 −7
Original line number Diff line number Diff line
@@ -528,13 +528,8 @@ bad:
		BIO_printf(bio_err,"trying to load CA private key\n");
		goto err;
		}
	if (key == NULL)
		pkey=PEM_read_bio_PrivateKey(in,NULL,NULL,NULL);
	else
		{
		pkey=PEM_read_bio_PrivateKey(in,NULL,key_cb,key);
		memset(key,0,strlen(key));
		}
		pkey=PEM_read_bio_PrivateKey(in,NULL,PEM_cb,key);
		if(key) memset(key,0,strlen(key));
	if (pkey == NULL)
		{
		BIO_printf(bio_err,"unable to load CA private key\n");
+3 −11
Original line number Diff line number Diff line
@@ -236,11 +236,7 @@ bad:
		else dsa=d2i_DSAPrivateKey_bio(in,NULL);
	} else if (informat == FORMAT_PEM) {
		if(pubin) dsa=PEM_read_bio_DSA_PUBKEY(in,NULL, NULL, NULL);
		else {
			if(passin) dsa=PEM_read_bio_DSAPrivateKey(in,NULL,
								key_cb,passin);
			else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,NULL,NULL);
		}
		else dsa=PEM_read_bio_DSAPrivateKey(in,NULL,PEM_cb,passin);
	} else
		{
		BIO_printf(bio_err,"bad input format specified for key\n");
@@ -287,12 +283,8 @@ bad:
	} else if (outformat == FORMAT_PEM) {
		if(pubin || pubout)
			i=PEM_write_bio_DSA_PUBKEY(out,dsa);
		else {
			if(passout) i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,
							NULL,0,key_cb, passout);
			i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,NULL,0,
								     NULL,NULL);
		}
		else i=PEM_write_bio_DSAPrivateKey(out,dsa,enc,
							NULL,0,PEM_cb, passout);
	} else {
		BIO_printf(bio_err,"bad output format specified for outfile\n");
		goto end;
Loading