java-1_8_0-openjdk/8051972.patch

19 lines
1023 B
Diff

--- icedtea-3.8.0/openjdk/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java 2018-09-18 09:01:53.500945030 +0200
+++ icedtea-3.8.0/openjdk/jdk/test/sun/security/pkcs11/ec/ReadCertificates.java 2018-09-18 09:08:14.826936408 +0200
@@ -171,8 +171,14 @@
signer = getRandomCert(certList);
} while (cert.getIssuerX500Principal().equals(signer.getSubjectX500Principal()));
try {
- cert.verify(signer.getPublicKey());
+ PublicKey signerPublicKey = signer.getPublicKey();
+ cert.verify(signerPublicKey);
+ // Ignore false positives
+ if (cert.getPublicKey().equals(signerPublicKey)) {
+ System.out.println("OK: self-signed certificate detected");
+ } else {
throw new Exception("Verified invalid signature");
+ }
} catch (SignatureException | InvalidKeyException e) {
System.out.println("OK: " + e);
}