]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added gnutls_certificate_set_x509_trust_dir()
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 21 Jul 2014 14:55:09 +0000 (16:55 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 21 Jul 2014 14:57:40 +0000 (16:57 +0200)
lib/gnutls_x509.c
lib/includes/gnutls/gnutls.h.in
lib/libgnutls.map

index 6649a356283516671be5029c1cd2d95aef3556fc..39898c5bf2d72eec5f8ac2c60f246a448acdd9d6 100644 (file)
@@ -1562,6 +1562,35 @@ int ret;
        return ret;
 }
 
+/**
+ * gnutls_certificate_set_x509_trust_dir:
+ * @cred: is a #gnutls_certificate_credentials_t structure.
+ * @ca_dir: is a directory containing the list of trusted CAs (DER or PEM list)
+ * @type: is PEM or DER
+ *
+ * This function adds the trusted CAs present in the directory in order to 
+ * verify client or server certificates. This function is identical
+ * to gnutls_certificate_set_x509_trust_file() but loads all certificates
+ * in a directory.
+ *
+ * Returns: number of certificates processed, or a negative error code on
+ * error.
+ **/
+int
+gnutls_certificate_set_x509_trust_dir(gnutls_certificate_credentials_t cred,
+                                     const char *ca_dir,
+                                     gnutls_x509_crt_fmt_t type)
+{
+int ret;
+
+       ret = gnutls_x509_trust_list_add_trust_dir(cred->tlist, ca_dir, NULL, 
+                                               type, GNUTLS_TL_USE_IN_TLS, 0);
+       if (ret == GNUTLS_E_NO_CERTIFICATE_FOUND)
+               return 0;
+
+       return ret;
+}
+
 /**
  * gnutls_certificate_set_x509_system_trust:
  * @cred: is a #gnutls_certificate_credentials_t structure.
index 4d45f1ea95b0dfc660e8d66e4374aa6cf8ea10d0..471fd7b65a8cb1b1e19d422070a3072847238b96 100644 (file)
@@ -1351,6 +1351,11 @@ int
 gnutls_certificate_set_x509_trust_file(gnutls_certificate_credentials_t
                                       cred, const char *cafile,
                                       gnutls_x509_crt_fmt_t type);
+int
+gnutls_certificate_set_x509_trust_dir(gnutls_certificate_credentials_t cred,
+                                     const char *ca_dir,
+                                     gnutls_x509_crt_fmt_t type);
+
 int gnutls_certificate_set_x509_trust_mem(gnutls_certificate_credentials_t
                                          res, const gnutls_datum_t * ca,
                                          gnutls_x509_crt_fmt_t type);
index 5399f6d6d04cb37ae230ac9dc7118bd89fa178de..94b64d37be9a4a59e0157d8d15b99617784a75e5 100644 (file)
@@ -1013,6 +1013,7 @@ GNUTLS_3_1_0 {
        gnutls_record_recv_packet;
        gnutls_packet_get;
        gnutls_x509_trust_list_add_trust_dir;
+       gnutls_certificate_set_x509_trust_dir;
 } GNUTLS_3_0_0;
 
 GNUTLS_FIPS140 {