diff options
author | Simon Josefsson <simon@josefsson.org> | 2006-08-27 14:39:00 +0000 |
---|---|---|
committer | Simon Josefsson <simon@josefsson.org> | 2006-08-27 14:39:00 +0000 |
commit | afc8e0c0caea143ee50d7763935014d43e4f1d63 (patch) | |
tree | ee4770cb2276b24be16bc5ce1ec30031464739e2 | |
parent | d1d319819b9a1940bfbcf800aaeaed77152216c7 (diff) | |
download | gnutls-afc8e0c0caea143ee50d7763935014d43e4f1d63.tar.gz |
(generate_certificate): Load private key when --load-request is used,
based on report from Sascha Ziemann <sascha.ziemann@secunet.com>.
-rw-r--r-- | src/certtool.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/certtool.c b/src/certtool.c index 4894752f57..b1d2f5729b 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004,2005 Free Software Foundation + * Copyright (C) 2004,2005,2006 Free Software Foundation * Copyright (C) 2004 Simon Josefsson * Copyright (C) 2003 Nikos Mavroyanopoulos * @@ -288,21 +288,27 @@ 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)); exit (1); } + 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. " @@ -325,13 +331,6 @@ 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 { |