synchronize with engine branch (some changes were done only
[oweals/openssl.git] / apps / x509.c
index de25790145dad2b8fab18150d7251df9f4af648e..9d09d7588905522dcad47849c221c03ea9157c9f 100644 (file)
@@ -73,7 +73,6 @@
 #include <openssl/x509v3.h>
 #include <openssl/objects.h>
 #include <openssl/pem.h>
-#include <openssl/engine.h>
 
 #undef PROG
 #define PROG x509_main
@@ -106,7 +105,6 @@ 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",
@@ -131,8 +129,6 @@ static char *x509_usage[]={
 " -extensions     - section from config file with X509V3 extensions to add\n",
 " -clrext         - delete extensions before signing and input certificate\n",
 " -nameopt arg    - various certificate name options\n",
-" -engine e       - use engine e, possibly a hardware device.\n",
-" -certopt arg    - various certificate text options\n",
 NULL
 };
 
@@ -149,7 +145,6 @@ int MAIN(int, char **);
 
 int MAIN(int argc, char **argv)
        {
-       ENGINE *e = NULL;
        int ret=1;
        X509_REQ *req=NULL;
        X509 *x=NULL,*xca=NULL;
@@ -164,7 +159,6 @@ 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;
@@ -180,8 +174,7 @@ int MAIN(int argc, char **argv)
        char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
        int need_rand = 0;
        int checkend=0,checkoffset=0;
-       unsigned long nmflag = 0, certflag = 0;
-       char *engine=NULL;
+       unsigned long nmflag = 0;
 
        reqfile=0;
 
@@ -333,11 +326,6 @@ int MAIN(int argc, char **argv)
                        alias= *(++argv);
                        trustout = 1;
                        }
-               else if (strcmp(*argv,"-certopt") == 0)
-                       {
-                       if (--argc < 1) goto bad;
-                       if (!set_cert_ex(&certflag, *(++argv))) goto bad;
-                       }
                else if (strcmp(*argv,"-nameopt") == 0)
                        {
                        if (--argc < 1) goto bad;
@@ -349,11 +337,6 @@ int MAIN(int argc, char **argv)
                        alias= *(++argv);
                        trustout = 1;
                        }
-               else if (strcmp(*argv,"-engine") == 0)
-                       {
-                       if (--argc < 1) goto bad;
-                       engine= *(++argv);
-                       }
                else if (strcmp(*argv,"-C") == 0)
                        C= ++num;
                else if (strcmp(*argv,"-email") == 0)
@@ -414,8 +397,6 @@ 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 */
@@ -439,24 +420,6 @@ bad:
                goto end;
                }
 
-       if (engine != NULL)
-               {
-               if((e = ENGINE_by_id(engine)) == NULL)
-                       {
-                       BIO_printf(bio_err,"invalid engine \"%s\"\n",
-                               engine);
-                       goto end;
-                       }
-               if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
-                       {
-                       BIO_printf(bio_err,"can't use that engine\n");
-                       goto end;
-                       }
-               BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
-               /* Free our "structural" reference. */
-               ENGINE_free(e);
-               }
-
        if (need_rand)
                app_RAND_load_file(NULL, bio_err, 0);
 
@@ -811,7 +774,7 @@ bad:
                                }
                        else if (text == i)
                                {
-                               X509_print_ex(out,x,nmflag, certflag);
+                               X509_print(out,x);
                                }
                        else if (startdate == i)
                                {
@@ -853,7 +816,7 @@ bad:
                                if (Upkey == NULL)
                                        {
                                        Upkey=load_key(bio_err,
-                                               keyfile,keyformat, passin, e);
+                                               keyfile,keyformat, passin);
                                        if (Upkey == NULL) goto end;
                                        }
 #ifndef NO_DSA
@@ -871,8 +834,7 @@ bad:
                                if (CAkeyfile != NULL)
                                        {
                                        CApkey=load_key(bio_err,
-                                               CAkeyfile,CAkeyformat, passin,
-                                               e);
+                                               CAkeyfile,CAkeyformat, passin);
                                        if (CApkey == NULL) goto end;
                                        }
 #ifndef NO_DSA
@@ -899,14 +861,16 @@ bad:
                                else
                                        {
                                        pk=load_key(bio_err,
-                                               keyfile,FORMAT_PEM, passin, e);
+                                               keyfile,FORMAT_PEM, passin);
                                        if (pk == NULL) goto end;
                                        }
 
                                BIO_printf(bio_err,"Generating certificate request\n");
 
+#ifndef NO_DSA
                                if (pk->type == EVP_PKEY_DSA)
                                        digest=EVP_dss1();
+#endif
 
                                rq=X509_to_X509_REQ(x,pk,digest);
                                EVP_PKEY_free(pk);
@@ -922,10 +886,6 @@ bad:
                                        }
                                noout=1;
                                }
-                       else if (ocspid == i)
-                               {
-                               X509_ocspid_print(out, x);
-                               }
                        }
                }