]> git.ipfire.org Git - thirdparty/hostap.git/blob - tests/test-x509.c
P2P: Support multiple P2P SD Bonjour services with same key
[thirdparty/hostap.git] / tests / test-x509.c
1 /*
2 * Testing tool for X.509v3 routines
3 * Copyright (c) 2006-2009, Jouni Malinen <j@w1.fi>
4 *
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
7 */
8
9 #include "includes.h"
10
11 #include "common.h"
12 #include "tls/x509v3.h"
13
14 extern int wpa_debug_level;
15
16
17 int main(int argc, char *argv[])
18 {
19 FILE *f;
20 u8 buf[3000];
21 size_t len;
22 struct x509_certificate *cert;
23
24 wpa_debug_level = 0;
25
26 f = fopen(argv[1], "rb");
27 if (f == NULL)
28 return -1;
29 len = fread(buf, 1, sizeof(buf), f);
30 fclose(f);
31
32 cert = x509_certificate_parse(buf, len);
33 if (cert == NULL)
34 printf("Failed to parse X.509 certificate\n");
35 x509_certificate_free(cert);
36
37 return 0;
38 }