Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/lib/x509/cert_status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const char* to_string(Certificate_Status_Code code) {
return "Trusted certificate has expired";
case Certificate_Status_Code::OCSP_ISSUER_NOT_TRUSTED:
return "OCSP issuer is not trustworthy";
case Certificate_Status_Code::EMPTY_DIRECTORYNAME:
return "DirectoryName was empty";
Comment on lines +36 to +37

case Certificate_Status_Code::NO_REVOCATION_DATA:
return "No revocation data";
Expand Down
1 change: 1 addition & 0 deletions src/lib/x509/pkix_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum class Certificate_Status_Code : uint16_t {
OCSP_SERVER_NOT_AVAILABLE = 503,
TRUSTED_CERT_HAS_EXPIRED = 504,
TRUSTED_CERT_NOT_YET_VALID = 505,
EMPTY_DIRECTORYNAME = 506,

Comment on lines 38 to 41
// Errors
FIRST_ERROR_STATUS = 1000,
Expand Down
6 changes: 5 additions & 1 deletion src/lib/x509/x509path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,12 @@ CertificatePathStatusCodes PKIX::check_chain(const std::vector<X509_Certificate>

for(const auto& rdn : subject.subject_dn().rdns()) {
for(const auto& ava : rdn) {
const size_t dn_len = ava.second.size();
const size_t dn_ub = X509_DN::lookup_ub(ava.first);
if(dn_ub > 0 && ava.second.size() > dn_ub) {
if(dn_len == 0) {
// RFC 5280 DirectoryStrings are supposed to be non-empty
status.insert(Certificate_Status_Code::EMPTY_DIRECTORYNAME);
} else if(dn_ub > 0 && dn_len > dn_ub) {
Comment on lines +380 to +383
status.insert(Certificate_Status_Code::DN_TOO_LONG);
}
}
Expand Down
Loading