diff options
author | steve <steve> | 1999-11-21 22:28:00 +0000 |
---|---|---|
committer | steve <steve> | 1999-11-21 22:28:00 +0000 |
commit | 28c9b86d611182125d29fb2d96459a4fb3995b1a (patch) | |
tree | e2a280961880048be21ab59c0abd42222ebc3784 /apps/x509.c | |
parent | 49196957d0eb5ffb2af31ca5fed8a22aa9cefeba (diff) | |
download | openssl-28c9b86d611182125d29fb2d96459a4fb3995b1a.tar.gz |
Transparent support for PKCS#8 private keys in RSA/DSA.
New universal public key format.
Fix CRL+cert load problem in by_file.c
Make verify report errors when loading files or dirs
Diffstat (limited to 'apps/x509.c')
-rw-r--r-- | apps/x509.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/x509.c b/apps/x509.c index f56244c5c..a6b5deb11 100644 --- a/apps/x509.c +++ b/apps/x509.c @@ -101,6 +101,7 @@ static char *x509_usage[]={ " -purpose - print out certificate purposes\n", " -dates - both Before and After dates\n", " -modulus - print the RSA key modulus\n", +" -pubkey - output the public key\n", " -fingerprint - print the certificate fingerprint\n", " -alias - output certificate alias\n", " -noout - no certificate output\n", @@ -161,7 +162,7 @@ int MAIN(int argc, char **argv) int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0; int trustout=0,clrtrust=0,clrnotrust=0,aliasout=0; int C=0; - int x509req=0,days=DEF_DAYS,modulus=0; + int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; int pprint = 0; char **pp; X509_STORE *ctx=NULL; @@ -324,6 +325,8 @@ int MAIN(int argc, char **argv) serial= ++num; else if (strcmp(*argv,"-modulus") == 0) modulus= ++num; + else if (strcmp(*argv,"-pubkey") == 0) + pubkey= ++num; else if (strcmp(*argv,"-x509toreq") == 0) x509req= ++num; else if (strcmp(*argv,"-text") == 0) @@ -640,6 +643,21 @@ bad: EVP_PKEY_free(pkey); } else + if (pubkey == i) + { + EVP_PKEY *pkey; + + pkey=X509_get_pubkey(x); + if (pkey == NULL) + { + BIO_printf(bio_err,"Error getting public key\n"); + ERR_print_errors(bio_err); + goto end; + } + PEM_write_bio_PUBKEY(STDout, pkey); + EVP_PKEY_free(pkey); + } + else if (C == i) { unsigned char *d; |