]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Revert last patch.
authorSimon Josefsson <simon@josefsson.org>
Thu, 21 Sep 2006 12:25:09 +0000 (12:25 +0000)
committerSimon Josefsson <simon@josefsson.org>
Thu, 21 Sep 2006 12:25:09 +0000 (12:25 +0000)
src/certtool.c

index 180a7c996e6840f6f1b6a5dd20516ea9e99e1087..52c7a26d55e734edece30704e2a1499fc7c7f342 100644 (file)
@@ -288,7 +288,7 @@ generate_certificate (gnutls_x509_privkey * ret_key, gnutls_x509_crt ca_crt)
   unsigned int usage = 0, server;
   gnutls_x509_crq crq;         /* request */
 
 ret = gnutls_x509_crt_init (&crt);
+ ret = gnutls_x509_crt_init (&crt);
   if (ret < 0)
     {
       fprintf (stderr, "crt_init: %s\n", gnutls_strerror (ret));
@@ -296,20 +296,13 @@ generate_certificate (gnutls_x509_privkey * ret_key, gnutls_x509_crt ca_crt)
     }
 
 
-  key = load_private_key (1);
-
-  result = gnutls_x509_crt_set_key (crt, key);
-  if (result < 0)
-    {
-      fprintf (stderr, "set_key: %s\n", gnutls_strerror (result));
-      exit (1);
-    }
-
   crq = load_request ();
 
   if (crq == NULL)
     {
 
+      key = load_private_key (1);
+
       if (!batch)
        fprintf (stderr,
                 "Please enter the details of the certificate's distinguished name. "
@@ -332,6 +325,13 @@ generate_certificate (gnutls_x509_privkey * ret_key, gnutls_x509_crt ca_crt)
 
       get_pkcs9_email_crt_set (crt);
 
+      result = gnutls_x509_crt_set_key (crt, key);
+      if (result < 0)
+       {
+         fprintf (stderr, "set_key: %s\n", gnutls_strerror (result));
+         exit (1);
+       }
+
     }
   else
     {