当前位置: 首页>>代码示例>>Java>>正文


Java CertStore.getCRLs方法代码示例

本文整理汇总了Java中java.security.cert.CertStore.getCRLs方法的典型用法代码示例。如果您正苦于以下问题:Java CertStore.getCRLs方法的具体用法?Java CertStore.getCRLs怎么用?Java CertStore.getCRLs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.cert.CertStore的用法示例。


在下文中一共展示了CertStore.getCRLs方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: engineGetCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
public Collection engineGetCRLs(CRLSelector crlSelector)
    throws CertStoreException
{
    boolean searchAllStores = params.getSearchAllStores();
    Iterator iter = params.getCertStores().iterator();
    List allCRLs = searchAllStores ? new ArrayList() : Collections.EMPTY_LIST;
    
    while (iter.hasNext())
    {
        CertStore store = (CertStore)iter.next();
        Collection crls = store.getCRLs(crlSelector);

        if (searchAllStores)
        {
            allCRLs.addAll(crls);
        }
        else if (!crls.isEmpty())
        {
            return crls;
        }
    }

    return allCRLs;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:MultiCertStoreSpi.java

示例2: storeContainsCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
/**
 * Determine whether there are any CRL's in the {@link CertStore} that is to be used.
 * 
 * @param certStore the cert store that will be used for validation
 * @return true if the store contains at least 1 CRL instance, false otherwise
 */
protected boolean storeContainsCRLs(CertStore certStore) {
    Collection<? extends CRL> crls = null;
    try {
        //Save some cycles and memory: Collection cert store allows null as specifier to return all.
        //crls = certStore.getCRLs( new X509CRLSelector() );
        crls = certStore.getCRLs(null);
    } catch (CertStoreException e) {
        log.error("Error examining cert store for CRL's, treating as if no CRL's present", e);
        return false;
    }
    if (crls != null && !crls.isEmpty()) {
        return true;
    }
    return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:CertPathPKIXTrustEvaluator.java

示例3: getCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
public static Collection<? extends CRL> getCRLs(final PKIXCRLStoreSelector selector, CertStore certStore)
    throws CertStoreException
{
    return certStore.getCRLs(new CRLSelector()
    {
        public boolean match(CRL crl)
        {
            return selector.match(crl);
        }

        public Object clone()
        {
            return this;
        }
    });
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:17,代码来源:PKIXCRLStoreSelector.java

示例4: checkResult

import java.security.cert.CertStore; //导入方法依赖的package包/类
private void checkResult(CertStore certS)   throws CertStoreException, 
        InvalidAlgorithmParameterException {
    CertSelector certSelector = new X509CertSelector();
    CRLSelector crlSelector = new X509CRLSelector();
    Collection collection = certS.getCertificates(certSelector);
    assertNull("Not null collection", collection);
    collection = certS.getCRLs(crlSelector);
    assertNull("Not null collection", collection);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:CertStore_ImplTest.java

示例5: loadCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
/**
 * Loads CRLs from a source. This method is also called in JarSigner.
 * @param src the source, which means System.in if null, or a URI,
 *        or a bare file path name
 */
public static Collection<? extends CRL> loadCRLs(String src) throws Exception {
    InputStream in = null;
    URI uri = null;
    if (src == null) {
        in = System.in;
    } else {
        try {
            uri = new URI(src);
            if (uri.getScheme().equals("ldap")) {
                // No input stream for LDAP
            } else {
                in = uri.toURL().openStream();
            }
        } catch (Exception e) {
            try {
                in = new FileInputStream(src);
            } catch (Exception e2) {
                if (uri == null || uri.getScheme() == null) {
                    throw e2;   // More likely a bare file path
                } else {
                    throw e;    // More likely a protocol or network problem
                }
            }
        }
    }
    if (in != null) {
        try {
            // Read the full stream before feeding to X509Factory,
            // otherwise, keytool -gencrl | keytool -printcrl
            // might not work properly, since -gencrl is slow
            // and there's no data in the pipe at the beginning.
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            byte[] b = new byte[4096];
            while (true) {
                int len = in.read(b);
                if (len < 0) break;
                bout.write(b, 0, len);
            }
            return CertificateFactory.getInstance("X509").generateCRLs(
                    new ByteArrayInputStream(bout.toByteArray()));
        } finally {
            if (in != System.in) {
                in.close();
            }
        }
    } else {    // must be LDAP, and uri is not null
        URICertStoreParameters params =
            new URICertStoreParameters(uri);
        CertStore s = CertStore.getInstance("LDAP", params);
        return s.getCRLs(new X509CRLSelector());
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:58,代码来源:Main.java

示例6: loadCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
/**
 * Loads CRLs from a source. This method is also called in JarSigner.
 * @param src the source, which means System.in if null, or a URI,
 *        or a bare file path name
 */
public static Collection<? extends CRL> loadCRLs(String src) throws Exception {
    InputStream in = null;
    URI uri = null;
    if (src == null) {
        in = System.in;
    } else {
        try {
            uri = new URI(src);
            if (uri.getScheme().equals("ldap")) {
                // No input stream for LDAP
            } else {
                in = uri.toURL().openStream();
            }
        } catch (Exception e) {
            try {
                in = new FileInputStream(src);
            } catch (Exception e2) {
                if (uri == null || uri.getScheme() == null) {
                    throw e2;   // More likely a bare file path
                } else {
                    throw e;    // More likely a protocol or network problem
                }
            }
        }
    }
    if (in != null) {
        try {
            // Read the full stream before feeding to X509Factory,
            // otherwise, keytool -gencrl | keytool -printcrl
            // might not work properly, since -gencrl is slow
            // and there's no data in the pipe at the beginning.
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            byte[] b = new byte[4096];
            while (true) {
                int len = in.read(b);
                if (len < 0) break;
                bout.write(b, 0, len);
            }
            return CertificateFactory.getInstance("X509").generateCRLs(
                    new ByteArrayInputStream(bout.toByteArray()));
        } finally {
            if (in != System.in) {
                in.close();
            }
        }
    } else {    // must be LDAP, and uri is not null
        // Lazily load LDAPCertStoreHelper if present
        CertStoreHelper helper = CertStoreHelper.getInstance("LDAP");
        String path = uri.getPath();
        if (path.charAt(0) == '/') path = path.substring(1);
        CertStore s = helper.getCertStore(uri);
        X509CRLSelector sel =
                helper.wrap(new X509CRLSelector(), null, path);
        return s.getCRLs(sel);
    }
}
 
开发者ID:JetBrains,项目名称:jdk8u_jdk,代码行数:62,代码来源:Main.java

示例7: getCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
public static Collection<? extends CRL> getCRLs(final PKIXCRLStoreSelector selector, CertStore certStore)
    throws CertStoreException
{
    return certStore.getCRLs(new SelectorClone(selector));
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:6,代码来源:PKIXCRLStoreSelector.java

示例8: loadCRLs

import java.security.cert.CertStore; //导入方法依赖的package包/类
/**
 * Loads CRLs from a source. This method is also called in JarSigner.
 * @param src the source, which means System.in if null, or a URI,
 *        or a bare file path name
 */
public static Collection<? extends CRL> loadCRLs(String src) throws Exception {
    InputStream in = null;
    URI uri = null;
    if (src == null) {
        in = System.in;
    } else {
        try {
            uri = new URI(src);
            if (uri.getScheme().equals("ldap")) {
                // No input stream for LDAP
            } else {
                in = uri.toURL().openStream();
            }
        } catch (Exception e) {
            try {
                in = new FileInputStream(src);
            } catch (Exception e2) {
                if (uri == null || uri.getScheme() == null) {
                    throw e2;   // More likely a bare file path
                } else {
                    throw e;    // More likely a protocol or network problem
                }
            }
        }
    }
    if (in != null) {
        try {
            // Read the full stream before feeding to X509Factory,
            // otherwise, keytool -gencrl | keytool -printcrl
            // might not work properly, since -gencrl is slow
            // and there's no data in the pipe at the beginning.
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            byte[] b = new byte[4096];
            while (true) {
                int len = in.read(b);
                if (len < 0) break;
                bout.write(b, 0, len);
            }
            return CertificateFactory.getInstance("X509").generateCRLs(
                    new ByteArrayInputStream(bout.toByteArray()));
        } finally {
            if (in != System.in) {
                in.close();
            }
        }
    } else {    // must be LDAP, and uri is not null
        String path = uri.getPath();
        if (path.charAt(0) == '/') path = path.substring(1);
        LDAPCertStoreHelper h = new LDAPCertStoreHelper();
        CertStore s = h.getCertStore(uri);
        X509CRLSelector sel =
                h.wrap(new X509CRLSelector(), null, path);
        return s.getCRLs(sel);
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:61,代码来源:KeyTool.java


注:本文中的java.security.cert.CertStore.getCRLs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。