RFC 4158 states that Subject Key Identifiers and Authority Key Identifiers may not be used to eliminate certificates. Here is the relevant blurb:
[3.5.12] Matching Key Identifiers (KIDs)
May be used to eliminate certificates: No
...
NOTE: Although required to be present by [[RFC3280](https://www.rfc-editor.org/rfc/rfc3280)], it is extremely
important that KIDs be used only as sorting criteria or as hints
during certification path building. KIDs are not required to match
during certification path validation and cannot be used to eliminate
certificates. This is of critical importance for interoperating
across domains and multi-vendor implementations where the KIDs may
not be calculated in the same fashion.
found at: https://www.rfc-editor.org/rfc/rfc4158.html
However, various CertPathValidatorUtilities.findIssuerCerts copies I can see in this repo, as well as org.bouncycastle.jcajce.provider.CertPathValidatorUtilities in bc-fips:2.1.1, contain this block of code which eventually leads to the elimination of certificates where AKIDs and SKIDs don't match:
try
{
byte[] akiExtensionValue = cert.getExtensionValue(AUTHORITY_KEY_IDENTIFIER);
if (akiExtensionValue != null)
{
ASN1OctetString aki = ASN1OctetString.getInstance(akiExtensionValue);
byte[] authorityKeyIdentifier = AuthorityKeyIdentifier.getInstance(aki.getOctets()).getKeyIdentifier();
if (authorityKeyIdentifier != null)
{
selector.setSubjectKeyIdentifier(new DEROctetString(authorityKeyIdentifier).getEncoded());
}
}
}
The consequence of this is, if an end-entity certificate contains an AKID, and an intermediate certificate contains a non-matching SKID, then the intermediate certificate gets eliminated and the chain becomes untrusted.
Is this intended behavior? Why does it not match RFC 4158?
RFC 4158 states that Subject Key Identifiers and Authority Key Identifiers may not be used to eliminate certificates. Here is the relevant blurb:
found at: https://www.rfc-editor.org/rfc/rfc4158.html
However, various
CertPathValidatorUtilities.findIssuerCertscopies I can see in this repo, as well asorg.bouncycastle.jcajce.provider.CertPathValidatorUtilitiesinbc-fips:2.1.1, contain this block of code which eventually leads to the elimination of certificates where AKIDs and SKIDs don't match:The consequence of this is, if an end-entity certificate contains an AKID, and an intermediate certificate contains a non-matching SKID, then the intermediate certificate gets eliminated and the chain becomes untrusted.
Is this intended behavior? Why does it not match RFC 4158?