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


Java PKCS7.getCRLs方法代码示例

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


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

示例1: parseX509orPKCS7CRL

import sun.security.pkcs.PKCS7; //导入方法依赖的package包/类
private Collection<? extends java.security.cert.CRL>
    parseX509orPKCS7CRL(InputStream is)
    throws CRLException, IOException
{
    Collection<X509CRLImpl> coll = new ArrayList<>();
    byte[] data = readOneBlock(is);
    if (data == null) {
        return new ArrayList<>(0);
    }
    try {
        PKCS7 pkcs7 = new PKCS7(data);
        X509CRL[] crls = pkcs7.getCRLs();
        // CRLs are optional in PKCS #7
        if (crls != null) {
            return Arrays.asList(crls);
        } else {
            // no crls provided
            return new ArrayList<>(0);
        }
    } catch (ParsingException e) {
        while (data != null) {
            coll.add(new X509CRLImpl(data));
            data = readOneBlock(is);
        }
    }
    return coll;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:28,代码来源:X509Factory.java

示例2: parseX509orPKCS7CRL

import sun.security.pkcs.PKCS7; //导入方法依赖的package包/类
private Collection<? extends java.security.cert.CRL>
    parseX509orPKCS7CRL(InputStream is)
    throws CRLException, IOException
{
    int peekByte;
    byte[] data;
    PushbackInputStream pbis = new PushbackInputStream(is);
    Collection<X509CRLImpl> coll = new ArrayList<>();

    // Test the InputStream for end-of-stream.  If the stream's
    // initial state is already at end-of-stream then return
    // an empty collection.  Otherwise, push the byte back into the
    // stream and let readOneBlock look for the first CRL.
    peekByte = pbis.read();
    if (peekByte == -1) {
        return new ArrayList<>(0);
    } else {
        pbis.unread(peekByte);
        data = readOneBlock(pbis);
    }

    // If we end up with a null value after reading the first block
    // then we know the end-of-stream has been reached and no CRL
    // data has been found.
    if (data == null) {
        throw new CRLException("No CRL data found");
    }

    try {
        PKCS7 pkcs7 = new PKCS7(data);
        X509CRL[] crls = pkcs7.getCRLs();
        // CRLs are optional in PKCS #7
        if (crls != null) {
            return Arrays.asList(crls);
        } else {
            // no crls provided
            return new ArrayList<>(0);
        }
    } catch (ParsingException e) {
        while (data != null) {
            coll.add(new X509CRLImpl(data));
            data = readOneBlock(pbis);
        }
    }
    return coll;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:X509Factory.java


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