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

Add 'rsautl' low level RSA utility.

Add DER public key routines.

Add -passin argument to 'ca' utility.

Document sign and verify options to dgst.
parent 55ac5220
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@

 Changes between 0.9.5a and 0.9.6  [xx XXX 2000]

  *) New openssl application 'rsautl'. This utility can be
     used for low level RSA operations. DER public key
     BIO/fp routines also added.
     [Steve Henson]

  *) New Configure entry and patches for compiling on QNX 4.
     [Andreas Schneider <andreas@ds3.etech.fh-hamburg.de>]

+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ SCRIPTS=CA.sh CA.pl der_chop
EXE= $(PROGRAM)

E_EXE=	verify asn1pars req dgst dh dhparam enc passwd gendh errstr \
	ca crl rsa dsa dsaparam \
	ca crl rsa rsautl dsa dsaparam \
	x509 genrsa gendsa s_server s_client speed \
	s_time version pkcs7 crl2pkcs7 sess_id ciphers nseq pkcs12 \
	pkcs8 spkac smime rand
@@ -51,14 +51,14 @@ RAND_SRC=app_rand.c

E_OBJ=	verify.o asn1pars.o req.o dgst.o dh.o dhparam.o enc.o passwd.o gendh.o errstr.o \
	ca.o pkcs7.o crl2p7.o crl.o \
	rsa.o dsa.o dsaparam.o \
	rsa.o rsautl.o dsa.o dsaparam.o \
	x509.o genrsa.o gendsa.o s_server.o s_client.o speed.o \
	s_time.o $(A_OBJ) $(S_OBJ) $(RAND_OBJ) version.o sess_id.o \
	ciphers.o nseq.o pkcs12.o pkcs8.o spkac.o smime.o rand.o

E_SRC=	verify.c asn1pars.c req.c dgst.c dh.c enc.c passwd.c gendh.c errstr.c ca.c \
	pkcs7.c crl2p7.c crl.c \
	rsa.c dsa.c dsaparam.c \
	rsa.c rsautl.c dsa.c dsaparam.c \
	x509.c genrsa.c gendsa.c s_server.c s_client.c speed.c \
	s_time.c $(A_SRC) $(S_SRC) $(RAND_SRC) version.c sess_id.c \
	ciphers.c nseq.c pkcs12.c pkcs8.c spkac.c smime.c rand.c
+41 −0
Original line number Diff line number Diff line
@@ -592,6 +592,47 @@ EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass)
	return(pkey);
	}

EVP_PKEY *load_pubkey(BIO *err, char *file, int format)
	{
	BIO *key=NULL;
	EVP_PKEY *pkey=NULL;

	if (file == NULL)
		{
		BIO_printf(err,"no keyfile specified\n");
		goto end;
		}
	key=BIO_new(BIO_s_file());
	if (key == NULL)
		{
		ERR_print_errors(err);
		goto end;
		}
	if (BIO_read_filename(key,file) <= 0)
		{
		perror(file);
		goto end;
		}
	if (format == FORMAT_ASN1)
		{
		pkey=d2i_PUBKEY_bio(key, NULL);
		}
	else if (format == FORMAT_PEM)
		{
		pkey=PEM_read_bio_PUBKEY(key,NULL,NULL,NULL);
		}
	else
		{
		BIO_printf(err,"bad input format specified for key\n");
		goto end;
		}
 end:
	if (key != NULL) BIO_free(key);
	if (pkey == NULL)
		BIO_printf(err,"unable to load Public Key\n");
	return(pkey);
	}

STACK_OF(X509) *load_certs(BIO *err, char *file, int format)
	{
	BIO *certs;
+1 −0
Original line number Diff line number Diff line
@@ -152,6 +152,7 @@ int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
int add_oid_section(BIO *err, LHASH *conf);
X509 *load_cert(BIO *err, char *file, int format);
EVP_PKEY *load_key(BIO *err, char *file, int format, char *pass);
EVP_PKEY *load_pubkey(BIO *err, char *file, int format);
STACK_OF(X509) *load_certs(BIO *err, char *file, int format);

#define FORMAT_UNDEF    0
+11 −1
Original line number Diff line number Diff line
@@ -216,7 +216,7 @@ int MAIN(int, char **);

int MAIN(int argc, char **argv)
	{
	char *key=NULL;
	char *key=NULL,*passargin=NULL;
	int total=0;
	int total_done=0;
	int badops=0;
@@ -333,6 +333,11 @@ EF_ALIGNMENT=0;
			if (--argc < 1) goto bad;
			keyfile= *(++argv);
			}
		else if (strcmp(*argv,"-passin") == 0)
			{
			if (--argc < 1) goto bad;
			passargin= *(++argv);
			}
		else if (strcmp(*argv,"-key") == 0)
			{
			if (--argc < 1) goto bad;
@@ -526,6 +531,11 @@ bad:
		lookup_fail(section,ENV_PRIVATE_KEY);
		goto err;
		}
	if(!key && !app_passwd(bio_err, passargin, NULL, &key, NULL))
		{
		BIO_printf(bio_err,"Error getting password\n");
		goto err;
		}
	if (BIO_read_filename(in,keyfile) <= 0)
		{
		perror(keyfile);
Loading