Search in sources :

Example 1 with X509CollectionStoreParameters

use of org.bouncycastle.x509.X509CollectionStoreParameters in project robovm by robovm.

the class CMSSignedHelper method createAttributeStore.

X509Store createAttributeStore(String type, Provider provider, Store certStore) throws NoSuchStoreException, CMSException {
    try {
        Collection certHldrs = certStore.getMatches(null);
        List certs = new ArrayList(certHldrs.size());
        for (Iterator it = certHldrs.iterator(); it.hasNext(); ) {
            certs.add(new X509V2AttributeCertificate(((X509AttributeCertificateHolder) it.next()).getEncoded()));
        }
        return X509Store.getInstance("AttributeCertificate/" + type, new X509CollectionStoreParameters(certs), provider);
    } catch (IllegalArgumentException e) {
        throw new CMSException("can't setup the X509Store", e);
    } catch (IOException e) {
        throw new CMSException("can't setup the X509Store", e);
    }
}
Also used : ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Collection(java.util.Collection) ArrayList(java.util.ArrayList) CertificateList(org.bouncycastle.asn1.x509.CertificateList) List(java.util.List) X509AttributeCertificateHolder(org.bouncycastle.cert.X509AttributeCertificateHolder) X509CollectionStoreParameters(org.bouncycastle.x509.X509CollectionStoreParameters) IOException(java.io.IOException) X509V2AttributeCertificate(org.bouncycastle.x509.X509V2AttributeCertificate)

Aggregations

IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 List (java.util.List)1 CertificateList (org.bouncycastle.asn1.x509.CertificateList)1 X509AttributeCertificateHolder (org.bouncycastle.cert.X509AttributeCertificateHolder)1 X509CollectionStoreParameters (org.bouncycastle.x509.X509CollectionStoreParameters)1 X509V2AttributeCertificate (org.bouncycastle.x509.X509V2AttributeCertificate)1