aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2000-05-18 00:33:00 +0000
committerDr. Stephen Henson <steve@openssl.org>2000-05-18 00:33:00 +0000
commit439df5087f012e65b80c13ade8953778cc0b4704 (patch)
treeed0aa5c1d53f8b9b24b7c3923624a64067d68c7f /apps
parent0d3b0afe9e59962f92b0cc6c63fc65a8e8dbc0de (diff)
downloadopenssl-439df5087f012e65b80c13ade8953778cc0b4704.tar.gz
Fix c_rehash script, add -fingerprint option to crl.
Diffstat (limited to 'apps')
-rw-r--r--apps/Makefile.ssl2
-rw-r--r--apps/crl.c29
2 files changed, 30 insertions, 1 deletions
diff --git a/apps/Makefile.ssl b/apps/Makefile.ssl
index fef670db23..0d0cd888b4 100644
--- a/apps/Makefile.ssl
+++ b/apps/Makefile.ssl
@@ -135,7 +135,7 @@ $(DLIBCRYPTO):
$(PROGRAM): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL)
$(RM) $(PROGRAM)
$(CC) -o $(PROGRAM) $(CFLAGS) $(PROGRAM).o $(E_OBJ) $(PEX_LIBS) $(LIBSSL) $(LIBCRYPTO) $(EX_LIBS)
- @(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; sh tools/c_rehash certs)
+ @(cd ..; OPENSSL="`pwd`/apps/openssl"; export OPENSSL; $(PERL) tools/c_rehash certs)
progs.h: progs.pl
$(PERL) progs.pl $(E_EXE) >progs.h
diff --git a/apps/crl.c b/apps/crl.c
index 338f46d97c..b1c3325f21 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -104,6 +104,7 @@ int MAIN(int argc, char **argv)
int informat,outformat;
char *infile=NULL,*outfile=NULL;
int hash=0,issuer=0,lastupdate=0,nextupdate=0,noout=0,text=0;
+ int fingerprint = 0;
char **pp,buf[256];
X509_STORE *store = NULL;
X509_STORE_CTX ctx;
@@ -111,6 +112,7 @@ int MAIN(int argc, char **argv)
X509_OBJECT xobj;
EVP_PKEY *pkey;
int do_ver = 0;
+ const EVP_MD *md_alg,*digest=EVP_md5();
apps_startup();
@@ -183,6 +185,13 @@ int MAIN(int argc, char **argv)
nextupdate= ++num;
else if (strcmp(*argv,"-noout") == 0)
noout= ++num;
+ else if (strcmp(*argv,"-fingerprint") == 0)
+ fingerprint= ++num;
+ else if ((md_alg=EVP_get_digestbyname(*argv + 1)))
+ {
+ /* ok */
+ digest=md_alg;
+ }
else
{
BIO_printf(bio_err,"unknown option %s\n",*argv);
@@ -274,6 +283,26 @@ bad:
BIO_printf(bio_out,"NONE");
BIO_printf(bio_out,"\n");
}
+ if (fingerprint == i)
+ {
+ int j;
+ unsigned int n;
+ unsigned char md[EVP_MAX_MD_SIZE];
+
+ if (!X509_CRL_digest(x,digest,md,&n))
+ {
+ BIO_printf(bio_err,"out of memory\n");
+ goto end;
+ }
+ BIO_printf(bio_out,"%s Fingerprint=",
+ OBJ_nid2sn(EVP_MD_type(digest)));
+ for (j=0; j<(int)n; j++)
+ {
+ BIO_printf(bio_out,"%02X%c",md[j],
+ (j+1 == (int)n)
+ ?'\n':':');
+ }
+ }
}
}