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.
This commit is contained in:
AnotherTest 2020-10-29 11:55:41 +03:30 committed by Andreas Kling
parent a2186fd64a
commit 1746e6f9ca
Notes: sideshowbarker 2024-07-19 01:37:54 +09:00
2 changed files with 5 additions and 0 deletions

View file

@ -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;

View file

@ -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 };