[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-66-g155bb9f
From: |
Nikos Mavrogiannopoulos |
Subject: |
[SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-66-g155bb9f |
Date: |
Sat, 15 Sep 2012 09:15:16 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".
http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=155bb9fac75701776f277f9b3de317243f576312
The branch, master has been updated
via 155bb9fac75701776f277f9b3de317243f576312 (commit)
from 48a440388526f239281aeac55d8a79c6a3ca80a3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 155bb9fac75701776f277f9b3de317243f576312
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Sat Sep 15 11:15:07 2012 +0200
Added gnutls_x509_privkey_get_pk_algorithm2(). Certtool prints the number
of bits in a private key.
-----------------------------------------------------------------------
Summary of changes:
lib/includes/gnutls/x509.h | 1 +
lib/libgnutls.map | 1 +
lib/x509/privkey.c | 32 ++++++++++++++++++++++++++++++++
src/certtool.c | 9 +++------
4 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/lib/includes/gnutls/x509.h b/lib/includes/gnutls/x509.h
index 3c86c34..6c06cd0 100644
--- a/lib/includes/gnutls/x509.h
+++ b/lib/includes/gnutls/x509.h
@@ -767,6 +767,7 @@ extern "C"
const gnutls_datum_t * x);
int gnutls_x509_privkey_get_pk_algorithm (gnutls_x509_privkey_t key);
+ int gnutls_x509_privkey_get_pk_algorithm2 (gnutls_x509_privkey_t key,
unsigned int *bits);
int gnutls_x509_privkey_get_key_id (gnutls_x509_privkey_t key,
unsigned int flags,
unsigned char *output_data,
diff --git a/lib/libgnutls.map b/lib/libgnutls.map
index 0bac577..032ee64 100644
--- a/lib/libgnutls.map
+++ b/lib/libgnutls.map
@@ -834,6 +834,7 @@ GNUTLS_3_1_0 {
gnutls_sign_get_pk_algorithm;
gnutls_sign_get_hash_algorithm;
gnutls_sign_algorithm_get;
+ gnutls_x509_privkey_get_pk_algorithm2;
} GNUTLS_3_0_0;
GNUTLS_PRIVATE {
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 98095aa..a88e332 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -985,6 +985,38 @@ gnutls_x509_privkey_get_pk_algorithm
(gnutls_x509_privkey_t key)
}
/**
+ * gnutls_x509_privkey_get_pk_algorithm2:
+ * @key: should contain a #gnutls_x509_privkey_t structure
+ * @bits: The number of bits in the public key algorithm
+ *
+ * This function will return the public key algorithm of a private
+ * key.
+ *
+ * Returns: a member of the #gnutls_pk_algorithm_t enumeration on
+ * success, or a negative error code on error.
+ **/
+int
+gnutls_x509_privkey_get_pk_algorithm2 (gnutls_x509_privkey_t key, unsigned int
*bits)
+{
+int ret;
+
+ if (key == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_INVALID_REQUEST;
+ }
+
+ if (bits)
+ {
+ ret = pubkey_to_bits(key->pk_algorithm, &key->params);
+ if (ret < 0) ret = 0;
+ *bits = ret;
+ }
+
+ return key->pk_algorithm;
+}
+
+/**
* gnutls_x509_privkey_export:
* @key: Holds the key
* @format: the format of output params. One of PEM or DER.
diff --git a/src/certtool.c b/src/certtool.c
index 4e027ed..1040bdc 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -1576,15 +1576,15 @@ const char *cprint;
/* Public key algorithm
*/
fprintf (outfile, "Public Key Info:\n");
- ret = gnutls_x509_privkey_get_pk_algorithm (key);
+ ret = gnutls_x509_privkey_get_pk_algorithm2 (key, &bits);
fprintf (outfile, "\tPublic Key Algorithm: ");
key_type = ret;
cprint = gnutls_pk_algorithm_get_name (key_type);
fprintf (outfile, "%s\n", cprint ? cprint : "Unknown");
- fprintf (outfile, "\tKey Security Level: %s\n\n",
- gnutls_sec_param_get_name (gnutls_x509_privkey_sec_param (key)));
+ fprintf (outfile, "\tKey Security Level: %s (%u bits)\n\n",
+ gnutls_sec_param_get_name (gnutls_x509_privkey_sec_param (key)),
bits);
/* Print the raw public and private keys
*/
@@ -1601,7 +1601,6 @@ const char *cprint;
else
{
print_rsa_pkey (outfile, &m, &e, &d, &p, &q, &u, &exp1, &exp2);
- bits = m.size * 8;
gnutls_free (m.data);
gnutls_free (e.data);
@@ -1624,7 +1623,6 @@ const char *cprint;
else
{
print_dsa_pkey (outfile, &x, &y, &p, &q, &g);
- bits = y.size * 8;
gnutls_free (x.data);
gnutls_free (y.data);
@@ -1645,7 +1643,6 @@ const char *cprint;
else
{
print_ecc_pkey (outfile, curve, &k, &x, &y);
- bits = gnutls_ecc_curve_get_size(curve) * 8;
gnutls_free (x.data);
gnutls_free (y.data);
hooks/post-receive
--
GNU gnutls
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU gnutls branch, master, updated. gnutls_3_1_0-66-g155bb9f,
Nikos Mavrogiannopoulos <=