aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/test_asn1.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-11-09 16:56:04 -0500
committerJack Lloyd <[email protected]>2017-11-09 16:56:04 -0500
commit1f093d2e26d46c98234a1d633e950f02e6614bb9 (patch)
tree2d8fb82c49b53472e917135e76505967ef6d91e2 /src/tests/test_asn1.cpp
parentb08f26d3658db3213d98932cbc6dd3e6efdc8b85 (diff)
Switch test code to use big-endian UCS2/UCS4
Specifications are somewhat unclear but as best I can tell only big-endian codepoints are allowed and that follows OpenSSL and GnuTLS behavior.
Diffstat (limited to 'src/tests/test_asn1.cpp')
-rw-r--r--src/tests/test_asn1.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/tests/test_asn1.cpp b/src/tests/test_asn1.cpp
index 0c1b6ce5e..c99fa41d9 100644
--- a/src/tests/test_asn1.cpp
+++ b/src/tests/test_asn1.cpp
@@ -109,14 +109,13 @@ Test::Result test_asn1_ucs2_parsing()
try
{
// \x1E - ASN1 tag for 'BMP (UCS-2) string'
- // \x0E - 14 characters of payload (includes BOM)
- // \xFF\xFE - Byte Order Mark (BOM)
+ // \x0C - 12 characters of payload
// ... - UCS-2 encoding for Moscow in cyrillic script
const std::string moscow =
- "\x1E\x0E\xFF\xFE\x1C\x04\x3E\x04"
- "\x41\x04\x3A\x04\x32\x04\x30\x04";
- const std::string moscow_plain = // with BOM (EF BB BF)
- "\xEF\xBB\xBF\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0";
+ "\x1E\x0C\x04\x1C\x04\x3E\x04\x41\x04\x3A\x04\x32\x04\x30";
+ const std::string moscow_plain =
+ "\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0";
+
Botan::DataSource_Memory input(moscow.data());
Botan::BER_Decoder dec(input);
@@ -135,18 +134,17 @@ Test::Result test_asn1_ucs2_parsing()
Test::Result test_asn1_ucs4_parsing()
{
- Test::Result result("ASN.1 universal string (UTF-32 LE) parsing");
+ Test::Result result("ASN.1 universal string (UCS-4) parsing");
try
{
// \x1C - ASN1 tag for 'universal string'
- // \x1C - 28 characters of payload (with BOM - FF FE 00 00)
- // ... - UTF-32 LE encoding for Moscow in cyrillic script
+ // \x18 - 24 characters of payload
+ // ... - UCS-4 encoding for Moscow in cyrillic script
const Botan::byte moscow[] =
- "\x1C\x1C\xFF\xFE\x00\x00\x1C\x04\x00\x00\x3E\x04\x00\x00\x41"
- "\x04\x00\x00\x3A\x04\x00\x00\x32\x04\x00\x00\x30\x04\x00\x00";
- const std::string moscow_plain = // with BOM (EF BB BF)
- "\xEF\xBB\xBF\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0";
+ "\x1C\x18\x00\x00\x04\x1C\x00\x00\x04\x3E\x00\x00\x04\x41\x00\x00\x04\x3A\x00\x00\x04\x32\x00\x00\x04\x30";
+ const std::string moscow_plain =
+ "\xD0\x9C\xD0\xBE\xD1\x81\xD0\xBA\xD0\xB2\xD0\xB0";
Botan::DataSource_Memory input(moscow, sizeof(moscow));
Botan::BER_Decoder dec(input);