diff options
author | Martin Willi <martin@strongswan.org> | 2006-04-19 11:40:48 +0000 |
---|---|---|
committer | Martin Willi <martin@strongswan.org> | 2006-04-19 11:40:48 +0000 |
commit | ec6582ccaa59e38cb83650c7c6b8312dc9768e87 (patch) | |
tree | 62fd80d2251aae22e40a38ada08ea9e59b602629 /Source/testing | |
parent | 4a93d6bafd543284b2fd77a7c29f1a526758fbca (diff) | |
download | strongswan-ec6582ccaa59e38cb83650c7c6b8312dc9768e87.tar.bz2 strongswan-ec6582ccaa59e38cb83650c7c6b8312dc9768e87.tar.xz |
- x509 certificate loading with pluto asn1 code
- x509 needs a lot more attention!
Diffstat (limited to 'Source/testing')
-rw-r--r-- | Source/testing/Makefile.testcases | 7 | ||||
-rw-r--r-- | Source/testing/certificate_test.c | 2 | ||||
-rw-r--r-- | Source/testing/der_decoder_test.c | 139 | ||||
-rw-r--r-- | Source/testing/der_decoder_test.h | 42 | ||||
-rw-r--r-- | Source/testing/rsa_test.c | 2 | ||||
-rw-r--r-- | Source/testing/testcases.c | 4 |
6 files changed, 4 insertions, 192 deletions
diff --git a/Source/testing/Makefile.testcases b/Source/testing/Makefile.testcases index 9a450de79..2a0dbf234 100644 --- a/Source/testing/Makefile.testcases +++ b/Source/testing/Makefile.testcases @@ -130,15 +130,10 @@ TEST_OBJS+= $(BUILD_DIR)child_sa_test.o $(BUILD_DIR)child_sa_test.o : $(TESTCASES_DIR)child_sa_test.c $(TESTCASES_DIR)child_sa_test.h $(CC) $(CFLAGS) -c -o $@ $< -TEST_OBJS+= $(BUILD_DIR)der_decoder_test.o -$(BUILD_DIR)der_decoder_test.o : $(TESTCASES_DIR)der_decoder_test.c $(TESTCASES_DIR)der_decoder_test.h - $(CC) $(CFLAGS) -c -o $@ $< - TEST_OBJS+= $(BUILD_DIR)certificate_test.o $(BUILD_DIR)certificate_test.o : $(TESTCASES_DIR)certificate_test.c $(TESTCASES_DIR)certificate_test.h $(CC) $(CFLAGS) -c -o $@ $< TEST_OBJS+= $(BUILD_DIR)leak_detective_test.o $(BUILD_DIR)leak_detective_test.o : $(TESTCASES_DIR)leak_detective_test.c $(TESTCASES_DIR)leak_detective_test.h - $(CC) $(CFLAGS) -c -o $@ $< -
\ No newline at end of file + $(CC) $(CFLAGS) -c -o $@ $<
\ No newline at end of file diff --git a/Source/testing/certificate_test.c b/Source/testing/certificate_test.c index 24143aeff..025893c0b 100644 --- a/Source/testing/certificate_test.c +++ b/Source/testing/certificate_test.c @@ -86,7 +86,7 @@ void test_certificate(protected_tester_t *tester) { chunk_t certificate = {certificate_buffer, sizeof(certificate_buffer)}; - certificate_t *cert = certificate_create_from_chunk(certificate); + x509_t *cert = x509_create_from_chunk(certificate); //certificate_t *cert = certificate_create_from_file("myCert.der"); diff --git a/Source/testing/der_decoder_test.c b/Source/testing/der_decoder_test.c deleted file mode 100644 index fc07cc141..000000000 --- a/Source/testing/der_decoder_test.c +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @file der_decoder_test.c - * - * @brief Tests for the der_decoder_t class. - * - */ - -/* - * Copyright (C) 2006 Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - -#include "der_decoder_test.h" - -#include <daemon.h> -#include <asn1/der_decoder.h> -#include <utils/logger.h> - - - -static char private_key_buffer[] = { - 0x30,0x82,0x04,0xa2,0x02,0x00,0x02,0x82,0x01,0x01,0x00,0x9b,0x28,0x10,0x02,0xd2, - 0x43,0x5b,0x2b,0x7c,0x81,0xce,0x2b,0x77,0xb4,0xbf,0x5f,0x2a,0x9a,0x96,0xc9,0xa4, - 0xd7,0xbb,0xb3,0xfb,0xc1,0x8a,0xad,0xbe,0x21,0x4e,0xd7,0x15,0xc4,0x8c,0x0a,0x88, - 0x5b,0x02,0xa9,0xcd,0x2e,0xee,0xd3,0x5e,0xb9,0xfd,0x27,0x0b,0xdb,0xf6,0xe7,0xb7, - 0x39,0xc1,0xfa,0x34,0x3f,0xa7,0xe4,0x04,0xaf,0xa8,0xc2,0x36,0x4e,0xf5,0x0c,0xf1, - 0x9b,0x92,0x26,0x32,0x20,0xdb,0x04,0xf5,0xb8,0x2e,0xf5,0xfc,0x47,0xd3,0x2a,0xa1, - 0x2d,0x5b,0x68,0x2c,0x5e,0xc6,0xc9,0x35,0x57,0x7b,0x65,0x17,0xd7,0x5d,0x10,0x5c, - 0x51,0xfb,0xcb,0x95,0xd1,0x17,0x42,0xa9,0xfd,0xd1,0xc4,0x32,0x1f,0x13,0xf2,0xeb, - 0x6b,0x91,0x01,0xe9,0x89,0x19,0x3a,0x2b,0x6d,0xae,0x91,0x27,0xe2,0x5e,0x06,0x5b, - 0x99,0xfb,0x20,0x3c,0xc4,0x92,0x20,0xc4,0x68,0x24,0x6b,0x74,0xdc,0x6d,0xf7,0xa8, - 0x10,0x1b,0xdf,0x20,0xed,0x4e,0x90,0x0e,0x3d,0xf6,0xef,0x3a,0x94,0x8b,0x12,0x61, - 0xac,0xed,0x95,0xbc,0xe2,0xed,0xb9,0x22,0xc2,0xdd,0xc7,0x19,0x68,0x09,0x14,0x71, - 0xb0,0x37,0xf7,0xbd,0x65,0x11,0x31,0x9d,0x89,0x6e,0x21,0xcf,0x60,0xc1,0x8d,0xbe, - 0x31,0x96,0xd2,0xdd,0x0e,0x20,0x38,0x07,0xd5,0xea,0xda,0xc8,0x9a,0x47,0x5b,0x05, - 0xce,0x7d,0xf7,0x4e,0xcd,0xbb,0x89,0xdd,0x46,0x16,0x8f,0x39,0x9d,0x32,0x19,0xaf, - 0x6e,0xc4,0xb3,0x6c,0x79,0x5a,0x70,0x11,0x8f,0xe2,0x75,0x33,0x09,0xc8,0xf6,0xd7, - 0x40,0x25,0xe7,0xa3,0xf0,0x6f,0x9a,0xdb,0x35,0x74,0xc1,0x02,0x03,0x01,0x00,0x01, - 0x02,0x82,0x01,0x00,0x12,0x42,0x38,0x58,0x21,0xfc,0x51,0x34,0xa0,0x8b,0x4f,0x58, - 0x28,0x2c,0x7a,0x14,0xd8,0x98,0xfb,0xee,0x5b,0x85,0x69,0x0e,0x63,0x83,0x16,0xd9, - 0xc9,0x5f,0xcc,0x12,0x5d,0xa5,0x15,0x41,0xd6,0xb8,0x0c,0x6b,0xda,0x67,0x3a,0x83, - 0x09,0xf3,0xb8,0x89,0xd4,0x1d,0xc7,0x99,0x8f,0x23,0x59,0xe3,0x78,0x2b,0x41,0x8b, - 0xab,0x78,0x2c,0x7e,0x3b,0xbb,0xe0,0xf4,0x96,0xa8,0xd3,0x1d,0xc6,0xea,0x67,0x91, - 0x2c,0x30,0x1c,0xe9,0x4f,0xb8,0xa2,0xc3,0x5d,0x2c,0xf9,0x99,0x1c,0x6c,0xee,0xd7, - 0x16,0x28,0x3c,0x5a,0x32,0x35,0xb8,0x3a,0xf3,0xa7,0xa6,0x35,0x02,0xba,0xbf,0x67, - 0xab,0x44,0xe1,0x09,0x9b,0x48,0x5d,0xa5,0x9e,0xf4,0xb7,0xf4,0xd1,0xfc,0x68,0x9e, - 0x98,0x26,0x69,0x28,0xcc,0x19,0x75,0xf2,0x61,0x0e,0x23,0xeb,0xf9,0x6d,0x2c,0x2b, - 0x01,0x3f,0x4d,0x18,0x41,0xc5,0x31,0x9d,0x1c,0x20,0x81,0x4e,0x38,0x92,0xd5,0xbb, - 0xd7,0xe7,0x49,0x0c,0x3a,0xf3,0x8f,0x9e,0xf0,0xb3,0x32,0x1e,0xa7,0x77,0xe8,0x9c, - 0xf3,0xce,0x88,0x66,0xcc,0xe8,0x16,0xbb,0xfd,0xbc,0x62,0xc7,0xc3,0xeb,0x0a,0xf5, - 0xd8,0x53,0x02,0x6c,0x45,0xcb,0x1d,0xa3,0x96,0xfb,0xa5,0x26,0x18,0x7f,0x04,0x9f, - 0x80,0x4a,0xdb,0x3b,0x74,0xcf,0x0d,0x45,0xf4,0xd5,0x49,0xe9,0x27,0x54,0x9c,0x57, - 0x92,0x48,0x78,0x52,0xb6,0x40,0x89,0x3f,0xf3,0x95,0x06,0x3d,0x90,0xab,0xa0,0x8a, - 0xc7,0x54,0xf1,0x63,0xcf,0xa6,0xd2,0x83,0x1e,0x69,0x54,0xe0,0x77,0x2c,0x9e,0x3a, - 0x4f,0xdd,0x14,0x6d,0x02,0x81,0x81,0x00,0xd9,0x40,0x76,0x90,0x7c,0xe7,0x3b,0xa3, - 0x59,0x23,0x14,0x6b,0xf3,0x5f,0x6e,0x6b,0x82,0x34,0xf6,0xbd,0x3e,0xfb,0x65,0xac, - 0x2f,0x46,0xd5,0x6e,0x9b,0xb8,0x62,0x80,0xc3,0x0c,0xa9,0xa6,0x00,0xd6,0xb8,0x1c, - 0x12,0x8d,0x4d,0xd0,0x64,0x29,0x4c,0xac,0x38,0xe8,0x6c,0xe4,0x82,0x02,0x4e,0x10, - 0xd5,0x39,0x19,0x29,0x0c,0x58,0x3f,0x68,0xa0,0x11,0x0e,0x11,0x74,0x22,0x2b,0x7e, - 0xc2,0xa7,0x88,0xe3,0x33,0xe8,0xb4,0x50,0x6e,0x0c,0x54,0xc5,0x3f,0xb7,0x16,0xcb, - 0x39,0xed,0x23,0xd0,0x66,0x26,0x57,0xf9,0xcb,0xc9,0xac,0xe2,0xa4,0xb8,0xba,0xd8, - 0xd2,0x1f,0x4a,0xed,0x73,0x89,0xda,0x42,0x27,0x5a,0x26,0x30,0x33,0xc8,0x42,0x2a, - 0x3d,0xc5,0xf3,0xc2,0x29,0x3d,0x58,0x67,0x02,0x81,0x81,0x00,0xb6,0xd4,0x61,0x05, - 0x49,0xcb,0xf4,0x29,0x8a,0x22,0xd3,0xa3,0x7c,0x9c,0xd2,0x07,0xa4,0x66,0xe4,0x36, - 0xfa,0x5e,0xf6,0x64,0xb7,0x59,0x74,0x2f,0x36,0x6d,0x12,0xd0,0xc9,0x4d,0xf8,0xd1, - 0xba,0xd1,0xee,0xd2,0x78,0xcd,0x51,0x69,0x33,0x6a,0x03,0xff,0xc2,0x35,0x1d,0x0d, - 0x9c,0x0a,0x87,0x5e,0x09,0xa3,0x23,0x4c,0xab,0xc3,0x4c,0x4a,0x1c,0xa4,0xc5,0xe2, - 0x70,0x42,0x1c,0xcf,0xea,0x79,0xfb,0xb9,0x87,0x67,0x4d,0xc3,0xfc,0xcc,0x86,0x9d, - 0xfa,0xea,0x99,0xa5,0x1b,0xc1,0x96,0xf4,0x79,0x4d,0x66,0x12,0x8f,0x90,0x98,0xb4, - 0xa1,0x3b,0xd6,0x2f,0x64,0xb4,0x5f,0x8f,0x47,0x7f,0x43,0xa5,0x6d,0xeb,0x06,0x58, - 0xfb,0x04,0x9e,0xef,0xaf,0x88,0x35,0x88,0xa1,0x15,0x30,0x97,0x02,0x81,0x80,0x59, - 0xbe,0xe0,0x7b,0xc5,0xad,0x3c,0x1c,0xb9,0x98,0xdd,0x39,0xce,0xfa,0xd0,0x41,0x87, - 0x33,0x5b,0xee,0x47,0x93,0x50,0xa7,0xf5,0x8b,0xbc,0x65,0x89,0xdc,0x7c,0x8c,0x96, - 0x86,0xa7,0x9a,0x54,0xe4,0x5e,0x7f,0xf2,0x45,0xff,0x2c,0x24,0x04,0x4f,0x91,0x21, - 0x9d,0x1a,0x46,0xb7,0x52,0x3e,0x6f,0x83,0xb5,0xa7,0xa8,0x26,0x5a,0x5a,0x2f,0x5d, - 0x58,0x4e,0x48,0x75,0x82,0x1c,0x17,0xac,0x4f,0xcb,0x23,0x98,0x70,0xfb,0xf3,0xf1, - 0xd2,0x14,0x3e,0xbb,0x98,0x65,0xc9,0x24,0x2f,0xcb,0x48,0xae,0xba,0x0e,0x43,0xb9, - 0xa4,0xa1,0x4f,0xab,0x1e,0x48,0xc9,0x82,0xdb,0xbc,0x77,0x24,0xf0,0x80,0x82,0x2d, - 0x81,0x77,0x1f,0x18,0x75,0x14,0xa8,0x20,0x86,0xa2,0xb0,0xc5,0x9a,0x7a,0xe7,0x02, - 0x81,0x80,0x1b,0x6d,0xb1,0x40,0x81,0xd9,0xbf,0x3f,0x9c,0x21,0xad,0x6e,0x91,0x7b, - 0x55,0x67,0x20,0x1a,0xef,0x91,0xef,0xed,0xdf,0x39,0x2c,0xe8,0x96,0xad,0x9e,0x94, - 0xae,0x85,0xf4,0x2d,0x66,0x6e,0xd0,0x80,0x3e,0x3c,0x05,0x33,0x88,0x4b,0x28,0x13, - 0x77,0x96,0x1f,0x24,0xa8,0xbf,0x29,0xf1,0xca,0x6d,0x29,0x34,0xf8,0x4e,0xc0,0x56, - 0x04,0x53,0xfa,0x08,0x1e,0x47,0xe2,0x5f,0x88,0xc3,0x08,0x82,0x54,0x69,0x79,0x0e, - 0xde,0x73,0xd0,0xb1,0x3e,0x60,0xe5,0x0b,0xdd,0x11,0x10,0x20,0xf2,0xec,0xaa,0x66, - 0x1a,0x32,0x1e,0xa7,0xaa,0xc1,0x2e,0x8f,0x33,0x8a,0xd8,0xa8,0xd6,0xcd,0x40,0x04, - 0xaf,0xb9,0x59,0xcc,0x30,0x9f,0x98,0xc9,0x10,0xaf,0x14,0xbe,0x72,0x89,0x94,0xe1, - 0x00,0xf1,0x02,0x81,0x81,0x00,0xd6,0xac,0x26,0xd2,0x42,0x5b,0x16,0xa9,0x39,0x02, - 0x63,0x76,0xa4,0xf5,0x40,0x3a,0xde,0xfa,0xea,0xd8,0xd3,0x12,0xee,0x44,0x00,0xfe, - 0xcb,0xa1,0x78,0x18,0xaa,0xa7,0x08,0xea,0x5e,0x36,0x52,0x28,0x0d,0x02,0x5a,0x9e, - 0x2d,0xc1,0x22,0x29,0x08,0x4f,0xed,0xff,0xa9,0xa6,0x08,0x8d,0x77,0xa4,0x5c,0xae, - 0xa7,0x8a,0x19,0x90,0xc2,0x12,0xc8,0x0f,0xb8,0x24,0xb5,0xba,0x45,0x2f,0xa6,0xc2, - 0x10,0x4c,0x0d,0x7e,0xf2,0xfd,0x11,0x26,0x16,0x34,0xbe,0x08,0x25,0x41,0x8b,0xcc, - 0x60,0xe7,0x02,0x3e,0x6a,0x54,0x05,0x80,0x66,0x2d,0x55,0x06,0xe6,0xbe,0x9b,0x15, - 0x9d,0xd3,0x5d,0xc4,0x6b,0x3f,0x74,0xa6,0x24,0xbc,0x7f,0x13,0xdf,0xe3,0x51,0x86, - 0x64,0x0f,0x1d,0x1f,0xf2,0x1e, -}; - -asn1_rule_t private_key_rules[] = { - {ASN1_SEQUENCE, 0, 0, 0}, - { ASN1_INTEGER, 0, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - { ASN1_INTEGER, ASN1_MPZ, 0, 0}, - {ASN1_END, 0, 0, 0}, -}; - -/** - * Described in header. - */ -void test_der_decoder(protected_tester_t *tester) -{ - chunk_t private_key = {private_key_buffer, sizeof(private_key_buffer)}; - - der_decoder_t *dd = der_decoder_create(private_key_rules); - - dd->decode(dd, private_key, NULL); - - dd->destroy(dd); - -} - - - diff --git a/Source/testing/der_decoder_test.h b/Source/testing/der_decoder_test.h deleted file mode 100644 index e7a7b7b62..000000000 --- a/Source/testing/der_decoder_test.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file der_decoder_test.h - * - * @brief Tests for the der_decoder_t class. - * - */ - -/* - * Copyright (C) 2006 Martin Willi - * Hochschule fuer Technik Rapperswil - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * for more details. - */ - - -#ifndef DER_DECODER_TEST_H_ -#define DER_DECODER_TEST_H_ - -#include <utils/tester.h> - -/** - * @brief Test function used to test the der_decoder_t functionality. - * - * @param tester associated protected_tester_t object - * - * @ingroup testcases - */ -void test_der_decoder(protected_tester_t *tester); - -#endif /* DER_DECODER_TEST_H_ */ - - - - diff --git a/Source/testing/rsa_test.c b/Source/testing/rsa_test.c index e0c601ea8..a3ab3e4ea 100644 --- a/Source/testing/rsa_test.c +++ b/Source/testing/rsa_test.c @@ -137,7 +137,7 @@ void test_rsa(protected_tester_t *tester) { rsa_private_key_t *private_key; rsa_public_key_t *public_key; - certificate_t *certificate; + x509_t *certificate; chunk_t data, signature; chunk_t der_private_key = {private_key_buffer, sizeof(private_key_buffer)}; chunk_t der_public_key = {public_key_buffer, sizeof(public_key_buffer)}; diff --git a/Source/testing/testcases.c b/Source/testing/testcases.c index 61eba694a..0f4201b42 100644 --- a/Source/testing/testcases.c +++ b/Source/testing/testcases.c @@ -61,7 +61,6 @@ #include "rsa_test.h" #include "kernel_interface_test.h" #include "child_sa_test.h" -#include "der_decoder_test.h" #include "certificate_test.h" #include "leak_detective_test.h" @@ -130,7 +129,6 @@ test_t proposal_test = {test_proposal, "proposal_t test"}; test_t rsa_test = {test_rsa, "RSA private/public key test"}; test_t kernel_interface_test = {test_kernel_interface, "Kernel Interface"}; test_t child_sa_test = {test_child_sa, "Child SA"}; -test_t der_decoder_test = {test_der_decoder, "DER decoder"}; test_t certificate_test = {test_certificate, "X509 Certificate"}; test_t leak_detective_test = {test_leak_detective, "LEAK detective"}; @@ -255,7 +253,7 @@ int main() tester_t *tester = tester_create(test_output, FALSE); //tester->perform_tests(tester,all_tests); - tester->perform_test(tester,&leak_detective_test); + tester->perform_test(tester,&certificate_test); tester->destroy(tester); |