]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Added gnutls_pkcs12_bag_set_crl() and gnutls_pkcs12_bag_set_crt() functions.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 31 Oct 2003 12:44:29 +0000 (12:44 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 31 Oct 2003 12:44:29 +0000 (12:44 +0000)
lib/x509/pkcs12_bag.c

index 79d9d158238ad12df380138618455fbb7f1fc15e..63463c841b61fb8b0d881d9233864689d0a8f8ee 100644 (file)
@@ -315,6 +315,66 @@ int ret;
        return bag->bag_elements-1;
 }
 
+/**
+  * gnutls_pkcs12_bag_set_crt - This function inserts a certificate into the bag
+  * @bag: The bag
+  * @crt: the certificate to be copied.
+  *
+  * This function will insert the given certificate into the
+  * bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
+  *
+  * On success returns the index of the added bag, or a negative
+  * value on error.
+  *
+  **/
+int gnutls_pkcs12_bag_set_crt(gnutls_pkcs12_bag bag, gnutls_x509_crt crt)
+{
+int ret;
+gnutls_datum data;
+
+       ret = _gnutls_x509_der_encode( crt->cert, "", &data, 0);
+       if (ret < 0) {
+               gnutls_assert();
+               return ret;
+       }
+       
+       ret = gnutls_pkcs12_bag_set_data( bag, GNUTLS_BAG_CERTIFICATE, &data);
+
+       _gnutls_free_datum( &data);
+       
+       return ret;
+}
+
+/**
+  * gnutls_pkcs12_bag_set_crl - This function inserts the CRL into the bag
+  * @bag: The bag
+  * @crl: the CRL to be copied.
+  *
+  * This function will insert the given CRL into the
+  * bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
+  *
+  * On success returns the index of the added bag, or a negative
+  * value on error.
+  *
+  **/
+int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag bag, gnutls_x509_crl crl)
+{
+int ret;
+gnutls_datum data;
+
+       ret = _gnutls_x509_der_encode( crl->crl, "", &data, 0);
+       if (ret < 0) {
+               gnutls_assert();
+               return ret;
+       }
+       
+       ret = gnutls_pkcs12_bag_set_data( bag, GNUTLS_BAG_CRL, &data);
+
+       _gnutls_free_datum( &data);
+       
+       return ret;
+}
+
 /**
   * gnutls_pkcs12_bag_set_key_id - This function sets a key ID into the bag element
   * @bag: The bag