3
#include "polarssl/x509_crt.h"
5
char *test_SSL_verify_cert()
9
memset( &crt, 0, sizeof( x509_crt ) );
12
memset( &ca_crt, 0, sizeof( x509_crt ) );
15
memset( &crl, 0, sizeof( x509_crl ) );
19
ret =x509_crt_parse_file( &crt, "tests/ca/certs/m2-cert.pem" );
21
mu_assert(ret == 0, "failed to parse cert m2-cert.pem");
23
ret =x509_crt_parse_file( &ca_crt, "tests/ca/none.pem" );
25
mu_assert(ret != 0, "failed to fail on non-existent pem none.pem");
27
ret =x509_crt_parse_file( &ca_crt, "tests/ca/cacert.pem" );
29
mu_assert(ret == 0, "failed to parse cert cacert.pem");
31
ret =x509_crl_parse_file( &crl, "tests/ca/crl.pem" );
33
mu_assert(ret == 0, "failed to parse cert crl.pem");
36
ret =x509_crt_verify( &crt, &ca_crt, NULL, NULL, &flags, NULL, NULL);
38
mu_assert(ret == 0, "failed to verify cert m2-cert.pem");
40
x509_crt_free( &crt );
41
x509_crt_free( &ca_crt );
42
x509_crl_free( &crl );
50
mu_run_test(test_SSL_verify_cert);