diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gnutls_cert.c | 31 | ||||
-rw-r--r-- | lib/includes/gnutls/gnutls.h.in | 4 | ||||
-rw-r--r-- | lib/libgnutls.map | 1 |
3 files changed, 36 insertions, 0 deletions
diff --git a/lib/gnutls_cert.c b/lib/gnutls_cert.c index 72887e5e1e..d7ef9fdb25 100644 --- a/lib/gnutls_cert.c +++ b/lib/gnutls_cert.c @@ -87,6 +87,37 @@ gnutls_certificate_free_keys (gnutls_certificate_credentials_t sc) } /** + * gnutls_certificate_get_issuer: + * @sc: is a #gnutls_certificate_credentials_t structure. + * @cert: is the certificate to find issuer for + * @issuer: Will hold the issuer if any. Should be treated as constant. + * @flags: Use zero. + * + * This function will return the issuer of a given certificate. + * + * Returns: On success, %GNUTLS_E_SUCCESS is returned, otherwise a + * negative error value. + **/ +int +gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc, + gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, unsigned int flags) +{ +int i, ret; + + for (i=0;i<sc->x509_ncas;i++) + { + ret = gnutls_x509_crt_check_issuer(cert, sc->x509_ca_list[i]); + if (ret > 0) + { + *issuer = sc->x509_ca_list[i]; + return 0; + } + } + + return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE; +} + +/** * gnutls_certificate_free_cas: * @sc: is a #gnutls_certificate_credentials_t structure. * diff --git a/lib/includes/gnutls/gnutls.h.in b/lib/includes/gnutls/gnutls.h.in index e28a6661fe..20e5c502e6 100644 --- a/lib/includes/gnutls/gnutls.h.in +++ b/lib/includes/gnutls/gnutls.h.in @@ -1084,6 +1084,10 @@ extern "C" struct gnutls_openpgp_keyring_int; typedef struct gnutls_openpgp_keyring_int *gnutls_openpgp_keyring_t; + int + gnutls_certificate_get_issuer (gnutls_certificate_credentials_t sc, + gnutls_x509_crt_t cert, gnutls_x509_crt_t* issuer, unsigned int flags); + int gnutls_certificate_set_x509_key (gnutls_certificate_credentials_t res, gnutls_x509_crt_t * cert_list, int cert_list_size, diff --git a/lib/libgnutls.map b/lib/libgnutls.map index 68ba398f01..2fc197a274 100644 --- a/lib/libgnutls.map +++ b/lib/libgnutls.map @@ -689,6 +689,7 @@ GNUTLS_2_12 gnutls_openpgp_crt_verify_hash; gnutls_pubkey_import_privkey; gnutls_pubkey_verify_data; + gnutls_certificate_get_issuer; } GNUTLS_2_10; GNUTLS_PRIVATE { |