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