--- embedaddon/strongswan/src/libstrongswan/tests/suites/test_identification.c 2020/06/03 09:46:44 1.1 +++ embedaddon/strongswan/src/libstrongswan/tests/suites/test_identification.c 2021/03/17 00:20:08 1.1.1.2 @@ -62,6 +62,23 @@ START_TEST(test_from_data) ck_assert(chunk_equals(expected, encoding)); a->destroy(a); + /* this is not actually ASN.1, even though it starts with 0x30 and the + * correct length (0x31=49) */ + expected = chunk_from_str("01234567-aaaa-bbbb-cccc-ddddeeeeffff@strongswan.org"); + a = identification_create_from_data(chunk_from_chars( + 0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, + 0x2d,0x61,0x61,0x61,0x61,0x2d,0x62,0x62, + 0x62,0x62,0x2d,0x63,0x63,0x63,0x63,0x2d, + 0x64,0x64,0x64,0x64,0x65,0x65,0x65,0x65, + 0x66,0x66,0x66,0x66,0x40,0x73,0x74,0x72, + 0x6f,0x6e,0x67,0x73,0x77,0x61,0x6e,0x2e, + 0x6f,0x72,0x67)); + ck_assert(ID_RFC822_ADDR == a->get_type(a)); + encoding = a->get_encoding(a); + ck_assert(expected.ptr != encoding.ptr); + ck_assert(chunk_equals(expected, encoding)); + a->destroy(a); + /* everything else is handled by the string parser */ expected = chunk_from_str("moon@strongswan.org"); a = identification_create_from_data(expected);