本文整理汇总了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();
}
示例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();
}
示例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();
}