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


Java DerOutputStream.putSequence方法代码示例

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


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

示例1: encodeBasicOcspResponse

import sun.security.util.DerOutputStream; //导入方法依赖的package包/类
private byte[] encodeBasicOcspResponse() throws IOException {
    DerOutputStream outerSeq = new DerOutputStream();
    DerOutputStream basicORItemStream = new DerOutputStream();

    // Encode the tbsResponse
    byte[] tbsResponseBytes = encodeTbsResponse();
    basicORItemStream.write(tbsResponseBytes);

    try {
        sigAlgId.derEncode(basicORItemStream);

        // Create the signature
        Signature sig = Signature.getInstance(sigAlgId.getName());
        sig.initSign(signerKey);
        sig.update(tbsResponseBytes);
        signature = sig.sign();
        basicORItemStream.putBitString(signature);
    } catch (GeneralSecurityException exc) {
        err(exc);
        throw new IOException(exc);
    }

    // Add certificates
    try {
        DerOutputStream certStream = new DerOutputStream();
        ArrayList<DerValue> certList = new ArrayList<>();
        if (signerCert != issuerCert) {
            certList.add(new DerValue(signerCert.getEncoded()));
        }
        certList.add(new DerValue(issuerCert.getEncoded()));
        DerValue[] dvals = new DerValue[certList.size()];
        certStream.putSequence(certList.toArray(dvals));
        basicORItemStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                true, (byte)0), certStream);
    } catch (CertificateEncodingException cex) {
        err(cex);
        throw new IOException(cex);
    }

    // Commit the outermost sequence bytes
    outerSeq.write(DerValue.tag_Sequence, basicORItemStream);
    return outerSeq.toByteArray();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:SimpleOCSPServer.java

示例2: encodeSingleResponses

import sun.security.util.DerOutputStream; //导入方法依赖的package包/类
private void encodeSingleResponses(DerOutputStream tbsStream)
        throws IOException {
    DerValue[] srDerVals = new DerValue[singleResponseList.size()];
    int srDvCtr = 0;

    for (LocalSingleResponse lsr : singleResponseList) {
        srDerVals[srDvCtr++] = new DerValue(lsr.getBytes());
    }

    tbsStream.putSequence(srDerVals);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:SimpleOCSPServer.java


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