Search in sources :

Example 1 with X509AttrCertParser

use of com.github.zhenwei.provider.jce.provider.X509AttrCertParser in project LinLong-Java by zhenwei1108.

the class LDAPStoreHelper method createAttributeCertificates.

private Set createAttributeCertificates(List list, X509AttributeCertStoreSelector xselector) throws StoreException {
    Set certSet = new HashSet();
    Iterator it = list.iterator();
    X509AttrCertParser parser = new X509AttrCertParser();
    while (it.hasNext()) {
        try {
            parser.engineInit(new ByteArrayInputStream((byte[]) it.next()));
            X509AttributeCertificate cert = (X509AttributeCertificate) parser.engineRead();
            if (xselector.match((Object) cert)) {
                certSet.add(cert);
            }
        } catch (StreamParsingException e) {
        }
    }
    return certSet;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) ByteArrayInputStream(java.io.ByteArrayInputStream) X509AttrCertParser(com.github.zhenwei.provider.jce.provider.X509AttrCertParser) Iterator(java.util.Iterator) X509AttributeCertificate(com.github.zhenwei.provider.x509.X509AttributeCertificate) HashSet(java.util.HashSet)

Aggregations

X509AttrCertParser (com.github.zhenwei.provider.jce.provider.X509AttrCertParser)1 X509AttributeCertificate (com.github.zhenwei.provider.x509.X509AttributeCertificate)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1