Example usage for org.bouncycastle.util Selector Selector

List of usage examples for org.bouncycastle.util Selector Selector

Introduction

In this page you can find the example usage for org.bouncycastle.util Selector Selector.

Prototype

Selector

Source Link

Usage

From source file:org.signserver.server.signers.BaseSigner.java

License:Open Source License

/**
 * @return True if the CertStore contained the Certificate
 *///  w w w .  ja v  a  2 s . com
private boolean containsCertificate(final Store store, final Certificate subject)
        throws CertStoreException, IOException, CertificateEncodingException {
    final X509CertificateHolder cert = new X509CertificateHolder(subject.getEncoded());
    final Collection<?> matchedCerts = store.getMatches(new Selector() {

        @Override
        public boolean match(Object obj) {
            return cert.equals(obj);
        }

        @Override
        public Object clone() {
            return this;
        }
    });
    return matchedCerts.size() > 0;
}