diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-13 21:16:07 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-07-13 21:21:52 +0200 |
commit | 21080193e5d7b9da46bea1e30212ccbf206a1474 (patch) | |
tree | 2b5618d4e5c914d5460611abb89fee5ba1ccb775 /lib/gnutls_pubkey.c | |
parent | a6824de916dafe17bc72042ba4b7a741b8703c63 (diff) | |
download | gnutls-21080193e5d7b9da46bea1e30212ccbf206a1474.tar.gz |
Added functions that import any kind of URL into abstract public and private keys.
Added:
gnutls_pubkey_import_url()
gnutls_privkey_import_url()
Diffstat (limited to 'lib/gnutls_pubkey.c')
-rw-r--r-- | lib/gnutls_pubkey.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/gnutls_pubkey.c b/lib/gnutls_pubkey.c index c8cc31905f..267896aab7 100644 --- a/lib/gnutls_pubkey.c +++ b/lib/gnutls_pubkey.c @@ -1048,6 +1048,35 @@ cleanup: #endif /* ENABLE_PKCS11 */ /** + * gnutls_pubkey_import_url: + * @key: A key of type #gnutls_pubkey_t + * @url: A PKCS 11 url + * @flags: One of GNUTLS_PKCS11_OBJ_* flags + * + * This function will import a PKCS11 certificate or a TPM key + * as a public key. + * + * Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a + * negative error value. + * + * Since: 3.1.0 + **/ +int +gnutls_pubkey_import_url (gnutls_pubkey_t key, const char *url, + unsigned int flags) +{ +#ifdef ENABLE_PKCS11 + if (strstr(url, "pkcs11:") != NULL) + return gnutls_pubkey_import_pkcs11_url(key, url, flags); +#endif +#ifdef HAVE_TROUSERS + if (strstr(url, "tpmkey:") != NULL) + return gnutls_pubkey_import_tpm_url(key, url, NULL, 0); +#endif + return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST); +} + +/** * gnutls_pubkey_import_rsa_raw: * @key: Is a structure will hold the parameters * @m: holds the modulus |