diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-11-11 13:20:20 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2011-11-11 13:27:24 +0100 |
commit | 12a28f4fa86e8420bdaeafba0fddfbd028a446ee (patch) | |
tree | e0cacf49eb66762e2bf36b17265d70925db8fb4a /lib/x509/privkey.c | |
parent | 60004868649f8731603ed2803b1fb1336e5f42b1 (diff) | |
download | gnutls-12a28f4fa86e8420bdaeafba0fddfbd028a446ee.tar.gz |
Added gnutls_x509_privkey_verify_params() which verifies the parameters of a private key. Added test case for private key generation.
Diffstat (limited to 'lib/x509/privkey.c')
-rw-r--r-- | lib/x509/privkey.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c index 75e59bd497..8e42dd4c17 100644 --- a/lib/x509/privkey.c +++ b/lib/x509/privkey.c @@ -1306,12 +1306,10 @@ gnutls_x509_privkey_export_dsa_raw (gnutls_x509_privkey_t key, return 0; } - - /** * gnutls_x509_privkey_generate: * @key: should contain a #gnutls_x509_privkey_t structure - * @algo: is one of RSA or DSA. + * @algo: is one of the algorithms in #gnutls_pk_algorithm_t. * @bits: the size of the modulus * @flags: unused for now. Must be 0. * @@ -1366,6 +1364,30 @@ cleanup: } /** + * gnutls_x509_privkey_verify_params: + * @key: should contain a #gnutls_x509_privkey_t structure + * + * This function will verify the private key parameters. + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + **/ +int +gnutls_x509_privkey_verify_params (gnutls_x509_privkey_t key) +{ + int ret; + + ret = _gnutls_pk_verify_params (key->pk_algorithm, &key->params); + if (ret < 0) + { + gnutls_assert (); + return ret; + } + + return 0; +} + +/** * gnutls_x509_privkey_get_key_id: * @key: Holds the key * @flags: should be 0 for now |