[gcr: 1/5] test-certificate: test otherName parsing



commit 4ec5842e59df71b83379be1cb2d4c2dfc3483284
Author: Dmitry Baryshkov <dbaryshkov gmail com>
Date:   Wed Jan 29 20:17:56 2020 +0300

    test-certificate: test otherName parsing
    
    Add tests for parsing otherName, which implies converting ANY to
    BMPString and UTF8String.
    
    Signed-off-by: Dmitry Baryshkov <dbaryshkov gmail com>

 gcr/test-certificate.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/gcr/test-certificate.c b/gcr/test-certificate.c
index 09c1fa2..5325565 100644
--- a/gcr/test-certificate.c
+++ b/gcr/test-certificate.c
@@ -269,7 +269,13 @@ test_basic_constraints (Test *test,
 static void
 test_subject_alt_name (void)
 {
-       const guint8 extension[] = { 0x30, 0x18, 0x87, 0x04, 0xC0, 0x00, 0x02, 0x01, 0x82, 0x10, 0x74, 0x65, 
0x73, 0x74, 0x2E, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 0x63, 0x6F, 0x6D };
+       const guint8 extension[] = {
+               0x30, 0x40,
+               0x87, 0x04, 0xC0, 0x00, 0x02, 0x01,
+               0x82, 0x10, 0x74, 0x65, 0x73, 0x74, 0x2E, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x2E, 
0x63, 0x6F, 0x6D,
+               0xA0, 0x13, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x08, 0x05, 0xA0, 0x07, 0x0C, 
0x05, 0x63, 0x40, 0x61, 0x2E, 0x62,
+               0xA0, 0x11, 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x08, 0x07, 0xA0, 0x05, 0x16, 
0x03, 0x61, 0x2E, 0x62
+       };
        GBytes *bytes;
        GArray *result;
        GcrGeneralName *general_name;
@@ -279,11 +285,15 @@ test_subject_alt_name (void)
        g_bytes_unref (bytes);
 
        g_assert_nonnull (result);
-       g_assert_cmpint (result->len, ==, 2);
+       g_assert_cmpint (result->len, ==, 4);
        general_name = &g_array_index (result, GcrGeneralName, 0);
        g_assert_cmpint (general_name->type, ==, GCR_GENERAL_NAME_IP);
        general_name = &g_array_index (result, GcrGeneralName, 1);
        g_assert_cmpint (general_name->type, ==, GCR_GENERAL_NAME_DNS);
+       general_name = &g_array_index (result, GcrGeneralName, 2);
+       g_assert_cmpint (general_name->type, ==, GCR_GENERAL_NAME_OTHER);
+       general_name = &g_array_index (result, GcrGeneralName, 3);
+       g_assert_cmpint (general_name->type, ==, GCR_GENERAL_NAME_OTHER);
        _gcr_general_names_free (result);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]