diff options
author | Martin Willi <martin@strongswan.org> | 2006-04-24 10:40:10 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-04-24 10:40:10 +0000 |
commit | a8c09d8cc0044fbff6c89c2e8966427ee7ed1ef0 (patch) | |
tree | 91b37f9344855204233631622d5b13a7056084b1 /Source/testing/certificate_test.c | |
parent | fcfeb3220fbd4e25b0ac63c541c18e8ae1f30766 (diff) | |
download | strongswan-a8c09d8cc0044fbff6c89c2e8966427ee7ed1ef0.tar.bz2 strongswan-a8c09d8cc0044fbff6c89c2e8966427ee7ed1ef0.tar.xz |
- identification_t supports now almost all id types
- x509 certificates work with identification_t now
- fixes here, fixes there
Diffstat (limited to 'Source/testing/certificate_test.c')
-rw-r--r-- | Source/testing/certificate_test.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/Source/testing/certificate_test.c b/Source/testing/certificate_test.c index 025893c0b..be8a8f7cf 100644 --- a/Source/testing/certificate_test.c +++ b/Source/testing/certificate_test.c @@ -20,14 +20,15 @@ * for more details. */ +#include <string.h> + #include "certificate_test.h" #include <daemon.h> -#include <crypto/certificate.h> +#include <crypto/x509.h> #include <utils/logger.h> - static char certificate_buffer[] = { 0x30,0x82,0x02,0xf9,0x30,0x82,0x01,0xe1,0xa0,0x03,0x02,0x01,0x02,0x02,0x11,0x00, 0xfe,0xae,0xe3,0xcf,0x00,0x27,0x8d,0xa0,0xe1,0xfa,0xb2,0x07,0xd4,0x15,0x40,0x93, @@ -85,10 +86,27 @@ static char certificate_buffer[] = { void test_certificate(protected_tester_t *tester) { chunk_t certificate = {certificate_buffer, sizeof(certificate_buffer)}; + identification_t *id; + x509_t *cert; - x509_t *cert = x509_create_from_chunk(certificate); - - //certificate_t *cert = certificate_create_from_file("myCert.der"); - + cert = x509_create_from_chunk(certificate); + id = cert->get_subject(cert); + tester->assert_true(tester, strcmp(id->get_string(id), "C=CH, O=Linux strongSwan, CN=maeno") == 0, "subject"); + id = cert->get_issuer(cert); + tester->assert_true(tester, strcmp(id->get_string(id), "C=CH, O=Linux strongSwan, CN=maeno") == 0, "issuer"); + cert->destroy(cert); + /* + cert = x509_create_from_file("scripts/complex1.der"); + id = cert->get_subject(cert); + printf("Subject: %s\n", id->get_string(id)); + id = cert->get_issuer(cert); + printf("Issuer: %s\n", id->get_string(id)); cert->destroy(cert); + + cert = x509_create_from_file("scripts/complex2.der"); + id = cert->get_subject(cert); + printf("Subject: %s\n", id->get_string(id)); + id = cert->get_issuer(cert); + printf("Issuer: %s\n", id->get_string(id)); + cert->destroy(cert);*/ } |