summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2007-05-02 09:24:34 +0000
committerSimon Josefsson <simon@josefsson.org>2007-05-02 09:24:34 +0000
commit11a524b75b3a8194b2242273dd290d15b09755fd (patch)
treeea517c143e1484e50b3cd29b11e45e84b1f0e4df
parent33e5a84a1e5ef46bb44e4daf252a58ed6982cc5b (diff)
downloadgnutls-11a524b75b3a8194b2242273dd290d15b09755fd.tar.gz
New file.
-rw-r--r--tests/pkcs11/pkcs11-ca.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/pkcs11/pkcs11-ca.c b/tests/pkcs11/pkcs11-ca.c
new file mode 100644
index 0000000000..7de6a6d2cf
--- /dev/null
+++ b/tests/pkcs11/pkcs11-ca.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2007 Free Software Foundation
+ *
+ * Author: Simon Josefsson
+ *
+ * This file is part of GNUTLS.
+ *
+ * GNUTLS is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GNUTLS is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNUTLS; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdlib.h>
+
+#include <gnutls/pkcs11.h>
+
+#include "utils.h"
+
+void
+doit (void)
+{
+ int ret;
+ gnutls_x509_crt_t *ca_list;
+ unsigned int ncas;
+
+ ret = gnutls_global_init ();
+ if (ret < 0)
+ fail ("gnutls_global_init failed %d\n", ret);
+
+ ret = gnutls_pkcs11_get_ca_certificates (&ca_list, &ncas);
+ if (ret < 0)
+ fail ("Error getting CAs from PKCS#11: %d\n", ret);
+
+ gnutls_global_deinit ();
+}