summaryrefslogtreecommitdiff
path: root/lib/gnutls_pubkey.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-16 22:16:19 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2010-12-16 22:16:19 +0100
commit70084689899074009015d16ed6aca1261b6523e4 (patch)
treea99f4f87e0a8b95a4a255bd87d7b35268b3166e0 /lib/gnutls_pubkey.c
parent6eb6bbfe8e504a611145f454f4045e8f49fd5e44 (diff)
downloadgnutls-70084689899074009015d16ed6aca1261b6523e4.tar.gz
Added gnutls_pubkey_verify_data and test vectors.
Diffstat (limited to 'lib/gnutls_pubkey.c')
-rw-r--r--lib/gnutls_pubkey.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c
index a169871b74..d903a60020 100644
--- a/lib/gnutls_pubkey.c
+++ b/lib/gnutls_pubkey.c
@@ -970,6 +970,43 @@ gnutls_pubkey_import_dsa_raw (gnutls_pubkey_t key,
}
/**
+ * gnutls_pubkey_verify_data:
+ * @pubkey: Holds the public key
+ * @flags: should be 0 for now
+ * @data: holds the data to be signed
+ * @signature: contains the signature
+ *
+ * This function will verify the given signed data, using the
+ * parameters from the certificate.
+ *
+ * Returns: In case of a verification failure 0 is returned, and 1 on
+ * success.
+ **/
+int
+gnutls_pubkey_verify_data (gnutls_pubkey_t pubkey, unsigned int flags,
+ const gnutls_datum_t * data,
+ const gnutls_datum_t * signature)
+{
+ int ret;
+
+ if (pubkey == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_INVALID_REQUEST;
+ }
+
+ ret = pubkey_verify_sig( data, NULL, signature, pubkey->pk_algorithm,
+ pubkey->params, pubkey->params_size);
+ if (ret < 0)
+ {
+ gnutls_assert();
+ }
+
+ return ret;
+}
+
+
+/**
* gnutls_pubkey_verify_hash:
* @key: Holds the certificate
* @flags: should be 0 for now