summaryrefslogtreecommitdiff
path: root/libextra
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-08-13 12:58:50 +0200
committerSimon Josefsson <simon@josefsson.org>2007-08-13 12:58:50 +0200
commita3f44aff0835ffe917ef64437cde20448056e4d9 (patch)
treeb8aa434b23d5e938282074b9ff480c65ecd1c0d0 /libextra
parente835cfda700ed3d1c88e2c72a15dd445573d1b37 (diff)
downloadgnutls-a3f44aff0835ffe917ef64437cde20448056e4d9.tar.gz
Add gnutls_openpgp_privkey_sign_hash.
Diffstat (limited to 'libextra')
-rw-r--r--libextra/gnutls_openpgp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c
index 344b245ab9..f114fb8a11 100644
--- a/libextra/gnutls_openpgp.c
+++ b/libextra/gnutls_openpgp.c
@@ -1269,3 +1269,38 @@ gnutls_certificate_set_openpgp_key (gnutls_certificate_credentials_t
return 0;
}
+
+/**
+ * gnutls_openpgp_privkey_sign_hash - This function will sign the given data using the private key params
+ * @key: Holds the key
+ * @hash: holds the data to be signed
+ * @signature: will contain newly allocated signature
+ *
+ * This function will sign the given hash using the private key.
+ *
+ * Return value: In case of failure a negative value will be returned,
+ * and 0 on success.
+ **/
+int
+gnutls_openpgp_privkey_sign_hash (gnutls_openpgp_privkey_t key,
+ const gnutls_datum_t * hash,
+ gnutls_datum_t * signature)
+{
+ int result;
+
+ if (key == NULL)
+ {
+ gnutls_assert ();
+ return GNUTLS_E_INVALID_REQUEST;
+ }
+
+ result = _gnutls_sign (key->pkey.pk_algorithm, key->pkey.params,
+ key->pkey.params_size, hash, signature);
+ if (result < 0)
+ {
+ gnutls_assert ();
+ return result;
+ }
+
+ return 0;
+}