Skip to content

Commit 2ac0e18

Browse files
committed
corrected CertPath issue - relates to github #2152
1 parent 0c824b6 commit 2ac0e18

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

prov/src/main/java/org/bouncycastle/jce/provider/CertPathValidatorUtilities.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import javax.security.auth.x500.X500Principal;
4343

4444
import org.bouncycastle.asn1.ASN1Encodable;
45-
import org.bouncycastle.asn1.ASN1Encoding;
4645
import org.bouncycastle.asn1.ASN1Enumerated;
4746
import org.bouncycastle.asn1.ASN1GeneralizedTime;
4847
import org.bouncycastle.asn1.ASN1Integer;
@@ -55,7 +54,6 @@
5554
import org.bouncycastle.asn1.x500.X500Name;
5655
import org.bouncycastle.asn1.x500.style.RFC4519Style;
5756
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
58-
import org.bouncycastle.asn1.x509.AuthorityKeyIdentifier;
5957
import org.bouncycastle.asn1.x509.CRLDistPoint;
6058
import org.bouncycastle.asn1.x509.CRLReason;
6159
import org.bouncycastle.asn1.x509.DistributionPoint;
@@ -1234,25 +1232,26 @@ static Collection findIssuerCerts(
12341232
"Subject criteria for certificate selector to find issuer certificate could not be set.", e);
12351233
}
12361234

1237-
try
1238-
{
1239-
byte[] akiExtValue = cert.getExtensionValue(AUTHORITY_KEY_IDENTIFIER);
1240-
if (akiExtValue != null)
1241-
{
1242-
AuthorityKeyIdentifier aki = AuthorityKeyIdentifier.getInstance(
1243-
ASN1OctetString.getInstance(akiExtValue).getOctets());
1244-
1245-
ASN1OctetString keyIdentifier = aki.getKeyIdentifierObject();
1246-
if (keyIdentifier != null)
1247-
{
1248-
selector.setSubjectKeyIdentifier(keyIdentifier.getEncoded(ASN1Encoding.DER));
1249-
}
1250-
}
1251-
}
1252-
catch (Exception e)
1253-
{
1254-
// authority key identifier could not be retrieved from target cert, just search without it
1255-
}
1235+
// RFC 3.5.12: explicitly disallows this - subject key identifier may be calculated differently
1236+
// try
1237+
// {
1238+
// byte[] akiExtValue = cert.getExtensionValue(AUTHORITY_KEY_IDENTIFIER);
1239+
// if (akiExtValue != null)
1240+
// {
1241+
// AuthorityKeyIdentifier aki = AuthorityKeyIdentifier.getInstance(
1242+
// ASN1OctetString.getInstance(akiExtValue).getOctets());
1243+
//
1244+
// ASN1OctetString keyIdentifier = aki.getKeyIdentifierObject();
1245+
// if (keyIdentifier != null)
1246+
// {
1247+
// selector.setSubjectKeyIdentifier(keyIdentifier.getEncoded(ASN1Encoding.DER));
1248+
// }
1249+
// }
1250+
// }
1251+
// catch (Exception e)
1252+
// {
1253+
// // authority key identifier could not be retrieved from target cert, just search without it
1254+
// }
12561255

12571256
PKIXCertStoreSelector certSelect = new PKIXCertStoreSelector.Builder(selector).build();
12581257
Set certs = new LinkedHashSet();

0 commit comments

Comments
 (0)