summaryrefslogtreecommitdiffstats
path: root/apps/x509.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>1999-11-21 22:28:31 +0000
committerDr. Stephen Henson <steve@openssl.org>1999-11-21 22:28:31 +0000
commit52664f5081939c96c5867fd02278f7575f1cab2d (patch)
treef2a5a01dcf50d2f54aa8114adf8ed59867754ed6 /apps/x509.c
parenta716d727347d6cd81534327901b509c6f5763f83 (diff)
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.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/apps/x509.c b/apps/x509.c
index f56244c5c7..a6b5deb114 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;