]> git.ipfire.org Git - thirdparty/hostap.git/blame - tests/test-x509.c
P2P: Allow p2p_cancel to be used to stop p2p_connect-join operation
[thirdparty/hostap.git] / tests / test-x509.c
CommitLineData
ab7ddc74
JM
1/*
2 * Testing tool for X.509v3 routines
3 * Copyright (c) 2006-2009, Jouni Malinen <j@w1.fi>
4 *
0f3d578e
JM
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
ab7ddc74
JM
7 */
8
9#include "includes.h"
10
11#include "common.h"
12#include "tls/x509v3.h"
13
14extern int wpa_debug_level;
15
16
17int 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}