Jouni Malinen | ab7ddc7 | 2009-12-06 16:45:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Testing tool for X.509v3 routines |
| 3 | * Copyright (c) 2006-2009, Jouni Malinen <j@w1.fi> |
| 4 | * |
Jouni Malinen | 0f3d578 | 2012-02-11 16:46:35 +0200 | [diff] [blame] | 5 | * This software may be distributed under the terms of the BSD license. |
| 6 | * See README for more details. |
Jouni Malinen | ab7ddc7 | 2009-12-06 16:45:36 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include "includes.h" |
| 10 | |
| 11 | #include "common.h" |
| 12 | #include "tls/x509v3.h" |
| 13 | |
Jouni Malinen | ab7ddc7 | 2009-12-06 16:45:36 +0200 | [diff] [blame] | 14 | |
| 15 | int main(int argc, char *argv[]) |
| 16 | { |
| 17 | FILE *f; |
| 18 | u8 buf[3000]; |
| 19 | size_t len; |
| 20 | struct x509_certificate *cert; |
| 21 | |
| 22 | wpa_debug_level = 0; |
| 23 | |
| 24 | f = fopen(argv[1], "rb"); |
| 25 | if (f == NULL) |
| 26 | return -1; |
| 27 | len = fread(buf, 1, sizeof(buf), f); |
| 28 | fclose(f); |
| 29 | |
| 30 | cert = x509_certificate_parse(buf, len); |
| 31 | if (cert == NULL) |
| 32 | printf("Failed to parse X.509 certificate\n"); |
| 33 | x509_certificate_free(cert); |
| 34 | |
| 35 | return 0; |
| 36 | } |