I wonder if I do too much...
[openssl.git] / apps / x509.c
index 87123397173906f9b03ed5da59eaa76decb79119..de25790145dad2b8fab18150d7251df9f4af648e 100644 (file)
@@ -106,6 +106,7 @@ static char *x509_usage[]={
 " -fingerprint    - print the certificate fingerprint\n",
 " -alias          - output certificate alias\n",
 " -noout          - no certificate output\n",
+" -ocspid         - print OCSP hash values for the subject name and public key\n",
 " -trustout       - output a \"trusted\" certificate\n",
 " -clrtrust       - clear all trusted purposes\n",
 " -clrreject      - clear all rejected purposes\n",
@@ -163,6 +164,7 @@ int MAIN(int argc, char **argv)
        char *CAkeyfile=NULL,*CAserial=NULL;
        char *alias=NULL;
        int text=0,serial=0,hash=0,subject=0,issuer=0,startdate=0,enddate=0;
+       int ocspid=0;
        int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0;
        int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0;
        int C=0;
@@ -412,6 +414,8 @@ int MAIN(int argc, char **argv)
                        clrext = 1;
                        }
 #endif
+               else if (strcmp(*argv,"-ocspid") == 0)
+                       ocspid= ++num;
                else if ((md_alg=EVP_get_digestbyname(*argv + 1)))
                        {
                        /* ok */
@@ -849,7 +853,7 @@ bad:
                                if (Upkey == NULL)
                                        {
                                        Upkey=load_key(bio_err,
-                                               keyfile,keyformat, passin);
+                                               keyfile,keyformat, passin, e);
                                        if (Upkey == NULL) goto end;
                                        }
 #ifndef NO_DSA
@@ -867,7 +871,8 @@ bad:
                                if (CAkeyfile != NULL)
                                        {
                                        CApkey=load_key(bio_err,
-                                               CAkeyfile,CAkeyformat, passin);
+                                               CAkeyfile,CAkeyformat, passin,
+                                               e);
                                        if (CApkey == NULL) goto end;
                                        }
 #ifndef NO_DSA
@@ -894,7 +899,7 @@ bad:
                                else
                                        {
                                        pk=load_key(bio_err,
-                                               keyfile,FORMAT_PEM, passin);
+                                               keyfile,FORMAT_PEM, passin, e);
                                        if (pk == NULL) goto end;
                                        }
 
@@ -917,6 +922,10 @@ bad:
                                        }
                                noout=1;
                                }
+                       else if (ocspid == i)
+                               {
+                               X509_ocspid_print(out, x);
+                               }
                        }
                }