Skip to content
Merged
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
8 changes: 2 additions & 6 deletions src/electronic-ids/x509.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ inline CertificateType certificateType(const pcsc_cpp::byte_vector& cert)
}
auto keyUsage = SCOPE_GUARD(ASN1_BIT_STRING, extension(x509.get(), NID_key_usage));
if (!keyUsage) {
THROW(SmartCardChangeRequiredError, "Failed to find key usage extension from certificate");
return electronic_id::CertificateType::NONE;
}

static const int KEY_USAGE_NON_REPUDIATION = 1;
Expand All @@ -47,11 +47,7 @@ inline CertificateType certificateType(const pcsc_cpp::byte_vector& cert)
if (ASN1_BIT_STRING_get_bit(keyUsage.get(), KEY_USAGE_DIGITAL_SIGNATURE)) {
auto extKeyUsage =
SCOPE_GUARD(EXTENDED_KEY_USAGE, extension(x509.get(), NID_ext_key_usage));
if (!extKeyUsage) {
THROW(SmartCardChangeRequiredError,
"Failed to find extended key usage extension from certificate");
}
if (hasClientAuthExtendedKeyUsage(extKeyUsage.get())) {
if (extKeyUsage && hasClientAuthExtendedKeyUsage(extKeyUsage.get())) {
return electronic_id::CertificateType::AUTHENTICATION;
}
}
Expand Down