java.security.cert.CertSelector Java Examples

The following examples show how to use java.security.cert.CertSelector. 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: SSLServerCertStore.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #2
Source File: SSLServerCertStore.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #3
Source File: URICertStore.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #4
Source File: SSLServerCertStore.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #5
Source File: SSLServerCertStore.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #6
Source File: PKIXTimestampParameters.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setTargetCertConstraints(CertSelector selector) {
    // To avoid problems with PKIXBuilderParameter's constructors
    if (p == null) {
        return;
    }
    p.setTargetCertConstraints(selector);
}
 
Example #7
Source File: URICertStore.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #8
Source File: PKIXExtendedParameters.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setTargetCertConstraints(CertSelector selector) {
    // To avoid problems with PKIXBuilderParameter's constructors
    if (p == null) {
        return;
    }
    p.setTargetCertConstraints(selector);
}
 
Example #9
Source File: X509KeySelector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #10
Source File: URICertStore.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #11
Source File: SSLServerCertStore.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #12
Source File: SSLServerCertStore.java    From openjsse with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #13
Source File: PKIXExtendedParameters.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@Override
public void setTargetCertConstraints(CertSelector selector) {
    // To avoid problems with PKIXBuilderParameter's constructors
    if (p == null) {
        return;
    }
    p.setTargetCertConstraints(selector);
}
 
Example #14
Source File: X509KeySelector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #15
Source File: URICertStore.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #16
Source File: URICertStore.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #17
Source File: SSLServerCertStore.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #18
Source File: PKIXExtendedParameters.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setTargetCertConstraints(CertSelector selector) {
    // To avoid problems with PKIXBuilderParameter's constructors
    if (p == null) {
        return;
    }
    p.setTargetCertConstraints(selector);
}
 
Example #19
Source File: X509KeySelector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #20
Source File: X509KeySelector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #21
Source File: URICertStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #22
Source File: SSLServerCertStore.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #23
Source File: PKIXTimestampParameters.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void setTargetCertConstraints(CertSelector selector) {
    // To avoid problems with PKIXBuilderParameter's constructors
    if (p == null) {
        return;
    }
    p.setTargetCertConstraints(selector);
}
 
Example #24
Source File: X509KeySelector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #25
Source File: X509KeySelector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #26
Source File: URICertStore.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #27
Source File: SSLServerCertStore.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #28
Source File: X509KeySelector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Searches the specified keystore for a certificate that matches the
 * criteria specified in the CertSelector.
 *
 * @return a KeySelectorResult containing the cert's public key if there
 *   is a match; otherwise null
 */
private KeySelectorResult keyStoreSelect(CertSelector cs)
    throws KeyStoreException {
    Enumeration<String> aliases = ks.aliases();
    while (aliases.hasMoreElements()) {
        String alias = aliases.nextElement();
        Certificate cert = ks.getCertificate(alias);
        if (cert != null && cs.match(cert)) {
            return new SimpleKeySelectorResult(cert.getPublicKey());
        }
    }
    return null;
}
 
Example #29
Source File: SSLServerCertStore.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static List<X509Certificate> getMatchingCerts
    (List<X509Certificate> certs, CertSelector selector)
{
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}
 
Example #30
Source File: URICertStore.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Iterates over the specified Collection of X509Certificates and
 * returns only those that match the criteria specified in the
 * CertSelector.
 */
private static Collection<X509Certificate> getMatchingCerts
    (Collection<X509Certificate> certs, CertSelector selector) {
    // if selector not specified, all certs match
    if (selector == null) {
        return certs;
    }
    List<X509Certificate> matchedCerts = new ArrayList<>(certs.size());
    for (X509Certificate cert : certs) {
        if (selector.match(cert)) {
            matchedCerts.add(cert);
        }
    }
    return matchedCerts;
}