@@ -95,12 +95,12 @@
Loading
95 95
/*
96 96
* Convert from ISO 8859-1 to UTF-8
97 97
*/
98 -
std::string latin1_to_utf8(const std::string& iso8859)
98 +
std::string latin1_to_utf8(const uint8_t chars[], size_t len)
99 99
   {
100 100
   std::string utf8;
101 -
   for(size_t i = 0; i != iso8859.size(); ++i)
101 +
   for(size_t i = 0; i != len; ++i)
102 102
      {
103 -
      const uint8_t c = static_cast<uint8_t>(iso8859[i]);
103 +
      const uint8_t c = static_cast<uint8_t>(chars[i]);
104 104
105 105
      if(c <= 0x7F)
106 106
         utf8 += static_cast<char>(c);

@@ -562,6 +562,30 @@
Loading
562 562
   return result;
563 563
   }
564 564
565 +
Test::Result test_x509_teletex()
566 +
   {
567 +
   Test::Result result("X509 with TeletexString encoded fields");
568 +
569 +
   try
570 +
      {
571 +
      Botan::X509_Certificate teletex_cert(Test::data_file("x509/misc/teletex_dn.der"));
572 +
573 +
      const Botan::X509_DN& issuer_dn = teletex_cert.issuer_dn();
574 +
575 +
      const std::string common_name =
576 +
         "neam Gesellschaft f\xc3\xbcr Kommunikationsl\xc3\xb6sungen mbH";
577 +
578 +
      result.test_eq("O",  issuer_dn.get_first_attribute("O"), "neam CA");
579 +
      result.test_eq("CN", issuer_dn.get_first_attribute("CN"), common_name);
580 +
      }
581 +
   catch (const Botan::Decoding_Error &ex)
582 +
      {
583 +
      result.test_failure(ex.what());
584 +
      }
585 +
586 +
   return result;
587 +
   }
588 +
565 589
Test::Result test_x509_authority_info_access_extension()
566 590
   {
567 591
   Test::Result result("X509 with PKIX.AuthorityInformationAccess extension");
@@ -1715,6 +1739,7 @@
Loading
1715 1739
#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
1716 1740
         results.push_back(test_x509_utf8());
1717 1741
         results.push_back(test_x509_bmpstring());
1742 +
         results.push_back(test_x509_teletex());
1718 1743
         results.push_back(test_crl_dn_name());
1719 1744
         results.push_back(test_x509_decode_list());
1720 1745
         results.push_back(test_rsa_oaep());

@@ -760,7 +760,7 @@
Loading
760 760
            }
761 761
         else if(type == "LATIN1-UTF8")
762 762
            {
763 -
            converted = Botan::latin1_to_utf8(in_str);
763 +
            converted = Botan::latin1_to_utf8(in.data(), in.size());
764 764
            }
765 765
         else
766 766
            {

@@ -62,7 +62,7 @@
Loading
62 62
   return (tag == ASN1_Type::NumericString ||
63 63
           tag == ASN1_Type::PrintableString ||
64 64
           tag == ASN1_Type::VisibleString ||
65 -
           tag == ASN1_Type::T61String ||
65 +
           tag == ASN1_Type::TeletexString ||
66 66
           tag == ASN1_Type::Ia5String ||
67 67
           tag == ASN1_Type::Utf8String ||
68 68
           tag == ASN1_Type::BmpString ||
@@ -121,6 +121,14 @@
Loading
121 121
      {
122 122
      m_utf8_str = ucs4_to_utf8(m_data.data(), m_data.size());
123 123
      }
124 +
   else if(m_tag == ASN1_Type::TeletexString)
125 +
      {
126 +
      /*
127 +
      TeletexString is nominally ITU T.61 not ISO-8859-1 but it seems
128 +
      the majority of implementations actually used that charset here.
129 +
      */
130 +
      m_utf8_str = latin1_to_utf8(m_data.data(), m_data.size());
131 +
      }
124 132
   else
125 133
      {
126 134
      // All other supported string types are UTF-8 or some subset thereof

@@ -124,7 +124,7 @@
Loading
124 124
      case ASN1_Type::Ia5String:
125 125
         return "IA5 STRING";
126 126
127 -
      case ASN1_Type::T61String:
127 +
      case ASN1_Type::TeletexString:
128 128
         return "T61 STRING";
129 129
130 130
      case ASN1_Type::Utf8String:
Files Coverage
src 92.42%
Project Totals (565 files) 92.42%
1
---
2

3
# Documentation
4
# https://github.com/codecov/support/wiki/Codecov-Yaml#full-yaml
5
#
6
# Validate this file
7
# curl --data-binary @codecov.yml https://codecov.io/validate
8

9
coverage:
10
  status:
11
    project:
12
      default:
13
        # Random seeds in tests lead to a +/-0.05% coverage span even for PRs
14
        # that do not change source code
15
        threshold: 0.05
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading