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


Java DerOutputStream.putGeneralizedTime方法代码示例

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


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

示例1: encodeTbsResponse

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

    // Note: We're not going explicitly assert the version
    tbsStream.write(respId.getEncoded());
    tbsStream.putGeneralizedTime(producedAtDate);

    // Sequence of responses
    encodeSingleResponses(tbsStream);

    // TODO: add response extension support
    encodeExtensions(tbsStream);

    outerSeq.write(DerValue.tag_Sequence, tbsStream);
    return outerSeq.toByteArray();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:SimpleOCSPServer.java

示例2: getBytes

import sun.security.util.DerOutputStream; //导入方法依赖的package包/类
public byte[] getBytes() throws IOException {
    byte[] nullData = { };
    DerOutputStream responseSeq = new DerOutputStream();
    DerOutputStream srStream = new DerOutputStream();

    // Encode the CertId
    certId.encode(srStream);

    // Next, encode the CertStatus field
    CertStatus csiType = csInfo.getType();
    switch (csiType) {
        case CERT_STATUS_GOOD:
            srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                    false, (byte)0), nullData);
            break;
        case CERT_STATUS_REVOKED:
            DerOutputStream revInfo = new DerOutputStream();
            revInfo.putGeneralizedTime(csInfo.getRevocationTime());
            CRLReason revReason = csInfo.getRevocationReason();
            if (revReason != null) {
                byte[] revDer = new byte[3];
                revDer[0] = DerValue.tag_Enumerated;
                revDer[1] = 1;
                revDer[2] = (byte)revReason.ordinal();
                revInfo.write(DerValue.createTag(
                        DerValue.TAG_CONTEXT, true, (byte)0),
                        revDer);
            }
            srStream.write(DerValue.createTag(
                    DerValue.TAG_CONTEXT, true, (byte)1),
                    revInfo);
            break;
        case CERT_STATUS_UNKNOWN:
            srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                    false, (byte)2), nullData);
            break;
        default:
            throw new IOException("Unknown CertStatus: " + csiType);
    }

    // Add the necessary dates
    srStream.putGeneralizedTime(thisUpdate);
    if (lsrNextUpdate != null) {
        DerOutputStream nuStream = new DerOutputStream();
        nuStream.putGeneralizedTime(lsrNextUpdate);
        srStream.write(DerValue.createTag(DerValue.TAG_CONTEXT,
                true, (byte)0), nuStream);
    }

    // TODO add singleResponse Extension support

    // Add the single response to the response output stream
    responseSeq.write(DerValue.tag_Sequence, srStream);
    return responseSeq.toByteArray();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:56,代码来源:SimpleOCSPServer.java

示例3: asn1Encode

import sun.security.util.DerOutputStream; //导入方法依赖的package包/类
/**
 * Encodes this object to a byte array.
 * @return a byte array of encoded data.
 * @exception Asn1Exception if an error occurs while decoding an ASN1 encoded data.
 * @exception IOException if an I/O error occurs while reading encoded data.
 */
public byte[] asn1Encode() throws Asn1Exception, IOException {
    DerOutputStream out = new DerOutputStream();
    out.putGeneralizedTime(this.toDate());
    return out.toByteArray();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:12,代码来源:KerberosTime.java


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