diff options
author | AnotherTest <ali.mpfard@gmail.com> | 2020-10-29 11:55:41 +0330 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-30 23:42:03 +0100 |
commit | 1746e6f9ca913aada1db7fb91dc0f83885b50973 (patch) | |
tree | 19936dd036466f677e3e6fa7860847162e733425 /Libraries/LibTLS | |
parent | a2186fd64a2d38bbba8602bef630c7685a7cc9ca (diff) | |
download | serenity-1746e6f9ca913aada1db7fb91dc0f83885b50973.zip |
LibTLS: Also read out the Organisational Unit from the certificate
This needs to be read out if we want to actually verify the cert chain.
Diffstat (limited to 'Libraries/LibTLS')
-rw-r--r-- | Libraries/LibTLS/TLSv12.cpp | 4 | ||||
-rw-r--r-- | Libraries/LibTLS/TLSv12.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Libraries/LibTLS/TLSv12.cpp b/Libraries/LibTLS/TLSv12.cpp index 13bf311d6b..fd78dd74ad 100644 --- a/Libraries/LibTLS/TLSv12.cpp +++ b/Libraries/LibTLS/TLSv12.cpp @@ -339,6 +339,8 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* cert.issuer_entity = String { (const char*)buffer + position, length }; } else if (_asn1_is_oid(oid, Constants::subject_oid)) { cert.issuer_subject = String { (const char*)buffer + position, length }; + } else if (_asn1_is_oid(oid, Constants::unit_oid)) { + cert.issuer_unit = String { (const char*)buffer + position, length }; } } else if (_asn1_is_field_present(fields, Constants::owner_id)) { if (_asn1_is_oid(oid, Constants::country_oid)) { @@ -351,6 +353,8 @@ static ssize_t _parse_asn1(const Context& context, Certificate& cert, const u8* cert.entity = String { (const char*)buffer + position, length }; } else if (_asn1_is_oid(oid, Constants::subject_oid)) { cert.subject = String { (const char*)buffer + position, length }; + } else if (_asn1_is_oid(oid, Constants::unit_oid)) { + cert.unit = String { (const char*)buffer + position, length }; } } break; diff --git a/Libraries/LibTLS/TLSv12.h b/Libraries/LibTLS/TLSv12.h index c263917c40..08abdc0832 100644 --- a/Libraries/LibTLS/TLSv12.h +++ b/Libraries/LibTLS/TLSv12.h @@ -463,6 +463,7 @@ constexpr static const u8 state_oid[] { 0x55, 0x04, 0x08, 0x00 }; constexpr static const u8 location_oid[] { 0x55, 0x04, 0x07, 0x00 }; constexpr static const u8 entity_oid[] { 0x55, 0x04, 0x0A, 0x00 }; constexpr static const u8 subject_oid[] { 0x55, 0x04, 0x03, 0x00 }; +constexpr static const u8 unit_oid[] { 0x55, 0x04, 0x0B, 0x00 }; constexpr static const u8 san_oid[] { 0x55, 0x1D, 0x11, 0x00 }; constexpr static const u8 ocsp_oid[] { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x30, 0x01, 0x00 }; |