match()源码实例Demo

java.security.cert.X509CertSelector#match()源码实例Demo

下面列出了java.security.cert.X509CertSelector#match() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: X509CertSelectorTest.java
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);
}
 
源代码2 项目: TencentKona-8   文件: X509CertSelectorTest.java
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);
}
 
源代码3 项目: openjdk-jdk8u   文件: X509CertSelectorTest.java
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);
}
 
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);
}
 
源代码5 项目: openjdk-jdk9   文件: X509CertSelectorTest.java
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);
}
 
源代码6 项目: jdk8u-jdk   文件: X509CertSelectorTest.java
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);
}
 
源代码7 项目: jdk8u_jdk   文件: X509CertSelectorTest.java
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);
}
 
源代码8 项目: RipplePower   文件: PKIXCertPathReviewer.java
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;
}
 
源代码9 项目: ripple-lib-java   文件: PKIXCertPathReviewer.java
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;
}