aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-x509.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-12-06 14:45:36 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-06 14:45:36 (GMT)
commitab7ddc74ad39ab11de2b3082fc78a3549781aa24 (patch)
tree5dbb629b43a63d9cc5f3353fa50eabed5a53448d /tests/test-x509.c
parent0e574b07f83c0595a71267e273de28c64187b1b6 (diff)
downloadhostap-ab7ddc74ad39ab11de2b3082fc78a3549781aa24.zip
hostap-ab7ddc74ad39ab11de2b3082fc78a3549781aa24.tar.gz
hostap-ab7ddc74ad39ab11de2b3082fc78a3549781aa24.tar.bz2
Move asn1_test.c into tests subdirectory and split it in two
The new test-asn1 and test-x509 tools are built using libraries from src/{utils,crypto,tls}. Currently, cross dependencies between crypto and tls are still preventing the test-x509 from being linked properly.
Diffstat (limited to 'tests/test-x509.c')
-rw-r--r--tests/test-x509.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test-x509.c b/tests/test-x509.c
new file mode 100644
index 0000000..96181c2
--- /dev/null
+++ b/tests/test-x509.c
@@ -0,0 +1,44 @@
+/*
+ * Testing tool for X.509v3 routines
+ * Copyright (c) 2006-2009, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Alternatively, this software may be distributed under the terms of BSD
+ * license.
+ *
+ * See README and COPYING for more details.
+ */
+
+#include "includes.h"
+
+#include "common.h"
+#include "tls/x509v3.h"
+
+extern int wpa_debug_level;
+
+
+int main(int argc, char *argv[])
+{
+ FILE *f;
+ u8 buf[3000];
+ size_t len;
+ struct x509_certificate *cert;
+
+ wpa_debug_level = 0;
+
+ f = fopen(argv[1], "rb");
+ if (f == NULL)
+ return -1;
+ len = fread(buf, 1, sizeof(buf), f);
+ fclose(f);
+
+ cert = x509_certificate_parse(buf, len);
+ if (cert == NULL)
+ printf("Failed to parse X.509 certificate\n");
+ x509_certificate_free(cert);
+
+ return 0;
+}