Java Code Examples for java.security.cert.X509CertSelector#match()
The following examples show how to use
java.security.cert.X509CertSelector#match() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X509CertSelectorTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 2
Source File: X509CertSelectorTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 3
Source File: X509CertSelectorTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 4
Source File: X509CertSelectorTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 5
Source File: X509CertSelectorTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 6
Source File: X509CertSelectorTest.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 7
Source File: X509CertSelectorTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) { boolean result = selector.match(cert); if (match != result) throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match); }
Example 8
Source File: PKIXCertPathReviewer.java From RipplePower with Apache License 2.0 | 4 votes |
protected Collection getTrustAnchors(X509Certificate cert, Set trustanchors) throws CertPathReviewerException { Collection trustColl = new ArrayList(); Iterator it = trustanchors.iterator(); X509CertSelector certSelectX509 = new X509CertSelector(); try { certSelectX509.setSubject(getEncodedIssuerPrincipal(cert).getEncoded()); byte[] ext = cert.getExtensionValue(X509Extensions.AuthorityKeyIdentifier.getId()); if (ext != null) { ASN1OctetString oct = (ASN1OctetString)ASN1Primitive.fromByteArray(ext); AuthorityKeyIdentifier authID = AuthorityKeyIdentifier.getInstance(ASN1Primitive.fromByteArray(oct.getOctets())); certSelectX509.setSerialNumber(authID.getAuthorityCertSerialNumber()); byte[] keyID = authID.getKeyIdentifier(); if (keyID != null) { certSelectX509.setSubjectKeyIdentifier(new DEROctetString(keyID).getEncoded()); } } } catch (IOException ex) { ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.trustAnchorIssuerError"); throw new CertPathReviewerException(msg); } while (it.hasNext()) { TrustAnchor trust = (TrustAnchor) it.next(); if (trust.getTrustedCert() != null) { if (certSelectX509.match(trust.getTrustedCert())) { trustColl.add(trust); } } else if (trust.getCAName() != null && trust.getCAPublicKey() != null) { X500Principal certIssuer = getEncodedIssuerPrincipal(cert); X500Principal caName = new X500Principal(trust.getCAName()); if (certIssuer.equals(caName)) { trustColl.add(trust); } } } return trustColl; }
Example 9
Source File: PKIXCertPathReviewer.java From ripple-lib-java with ISC License | 4 votes |
protected Collection getTrustAnchors(X509Certificate cert, Set trustanchors) throws CertPathReviewerException { Collection trustColl = new ArrayList(); Iterator it = trustanchors.iterator(); X509CertSelector certSelectX509 = new X509CertSelector(); try { certSelectX509.setSubject(getEncodedIssuerPrincipal(cert).getEncoded()); byte[] ext = cert.getExtensionValue(X509Extensions.AuthorityKeyIdentifier.getId()); if (ext != null) { ASN1OctetString oct = (ASN1OctetString)ASN1Primitive.fromByteArray(ext); AuthorityKeyIdentifier authID = AuthorityKeyIdentifier.getInstance(ASN1Primitive.fromByteArray(oct.getOctets())); certSelectX509.setSerialNumber(authID.getAuthorityCertSerialNumber()); byte[] keyID = authID.getKeyIdentifier(); if (keyID != null) { certSelectX509.setSubjectKeyIdentifier(new DEROctetString(keyID).getEncoded()); } } } catch (IOException ex) { ErrorBundle msg = new ErrorBundle(RESOURCE_NAME,"CertPathReviewer.trustAnchorIssuerError"); throw new CertPathReviewerException(msg); } while (it.hasNext()) { TrustAnchor trust = (TrustAnchor) it.next(); if (trust.getTrustedCert() != null) { if (certSelectX509.match(trust.getTrustedCert())) { trustColl.add(trust); } } else if (trust.getCAName() != null && trust.getCAPublicKey() != null) { X500Principal certIssuer = getEncodedIssuerPrincipal(cert); X500Principal caName = new X500Principal(trust.getCAName()); if (certIssuer.equals(caName)) { trustColl.add(trust); } } } return trustColl; }