本文整理汇总了Java中org.bouncycastle.asn1.cms.CMSObjectIdentifiers类的典型用法代码示例。如果您正苦于以下问题:Java CMSObjectIdentifiers类的具体用法?Java CMSObjectIdentifiers怎么用?Java CMSObjectIdentifiers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CMSObjectIdentifiers类属于org.bouncycastle.asn1.cms包,在下文中一共展示了CMSObjectIdentifiers类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOthersFromStore
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
static Collection getOthersFromStore(ASN1ObjectIdentifier otherRevocationInfoFormat, Store otherRevocationInfos)
{
List others = new ArrayList();
for (Iterator it = otherRevocationInfos.getMatches(null).iterator(); it.hasNext();)
{
ASN1Encodable info = (ASN1Encodable)it.next();
if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(otherRevocationInfoFormat))
{
OCSPResponse resp = OCSPResponse.getInstance(info);
if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
{
throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
}
}
others.add(new DERTaggedObject(false, 1, new OtherRevocationInfoFormat(otherRevocationInfoFormat, info)));
}
return others;
}
示例2: initialize
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
private void initialize(ContentInfoParser contentInfo)
throws CMSException
{
try
{
if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
{
this.timeStampedData = TimeStampedDataParser.getInstance(contentInfo.getContent(BERTags.SEQUENCE));
}
else
{
throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
}
}
catch (IOException e)
{
throw new CMSException("parsing exception: " + e.getMessage(), e);
}
}
示例3: addBasicOcspRespFrom_id_ri_ocsp_response
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
private void addBasicOcspRespFrom_id_ri_ocsp_response(final List<BasicOCSPResp> basicOCSPResps) {
final Store otherRevocationInfo = cmsSignedData.getOtherRevocationInfo(CMSObjectIdentifiers.id_ri_ocsp_response);
final Collection otherRevocationInfoMatches = otherRevocationInfo.getMatches(null);
for (final Object object : otherRevocationInfoMatches) {
if (object instanceof DERSequence) {
final DERSequence otherRevocationInfoMatch = (DERSequence) object;
final BasicOCSPResp basicOCSPResp;
if (otherRevocationInfoMatch.size() == 4) {
basicOCSPResp = CMSUtils.getBasicOcspResp(otherRevocationInfoMatch);
} else {
final OCSPResp ocspResp = CMSUtils.getOcspResp(otherRevocationInfoMatch);
basicOCSPResp = CMSUtils.getBasicOCSPResp(ocspResp);
}
addBasicOcspResp(basicOCSPResps, basicOCSPResp);
} else {
LOG.warn("Unsupported object type for id_ri_ocsp_response (SHALL be DER encoding) : " + object.getClass().getSimpleName());
}
}
}
示例4: generate
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* generate an authenticated object that contains an CMS Authenticated Data
* object using the given provider and the passed in key generator.
* @deprecated
*/
private CMSAuthenticatedData generate(
final CMSProcessable content,
String macOID,
KeyGenerator keyGen,
Provider provider)
throws NoSuchAlgorithmException, CMSException
{
Provider encProvider = keyGen.getProvider();
convertOldRecipients(rand, provider);
return generate(new CMSTypedData()
{
public ASN1ObjectIdentifier getContentType()
{
return CMSObjectIdentifiers.data;
}
public void write(OutputStream out)
throws IOException, CMSException
{
content.write(out);
}
public Object getContent()
{
return content;
}
}, new JceCMSMacCalculatorBuilder(new ASN1ObjectIdentifier(macOID)).setProvider(encProvider).setSecureRandom(rand).build());
}
示例5: open
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* generate a signed object that for a CMS Signed Data
* object using the given provider - if encapsulate is true a copy
* of the message will be included in the signature with the
* default content type "data".
*/
public OutputStream open(
OutputStream out,
boolean encapsulate)
throws IOException
{
return open(CMSObjectIdentifiers.data, out, encapsulate);
}
示例6: open
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* generate an enveloped object that contains an CMS Enveloped Data
* object using the given encryptor.
*/
public OutputStream open(
OutputStream out,
OutputEncryptor encryptor)
throws CMSException, IOException
{
return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
}
示例7: open
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* generate an authenticated data structure with the encapsulated bytes marked as DATA.
*
* @param out the stream to store the authenticated structure in.
* @param macCalculator calculator for the MAC to be attached to the data.
*/
public OutputStream open(
OutputStream out,
MacCalculator macCalculator)
throws CMSException
{
return open(CMSObjectIdentifiers.data, out, macCalculator);
}
示例8: open
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* @deprecated use open(OutputStream, ContentCompressor)
*/
public OutputStream open(
OutputStream out,
String compressionOID)
throws IOException
{
return open(out, CMSObjectIdentifiers.data.getId(), compressionOID);
}
示例9: initialize
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
private void initialize(ContentInfo contentInfo)
{
this.contentInfo = contentInfo;
if (CMSObjectIdentifiers.timestampedData.equals(contentInfo.getContentType()))
{
this.timeStampedData = TimeStampedData.getInstance(contentInfo.getContent());
}
else
{
throw new IllegalArgumentException("Malformed content - type must be " + CMSObjectIdentifiers.timestampedData.getId());
}
util = new TimeStampDataUtil(this.timeStampedData);
}
示例10: addTimeStamp
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* Return a new timeStampedData object with the additional token attached.
*
* @throws CMSException
*/
public CMSTimeStampedData addTimeStamp(TimeStampToken token)
throws CMSException
{
TimeStampAndCRL[] timeStamps = util.getTimeStamps();
TimeStampAndCRL[] newTimeStamps = new TimeStampAndCRL[timeStamps.length + 1];
System.arraycopy(timeStamps, 0, newTimeStamps, 0, timeStamps.length);
newTimeStamps[timeStamps.length] = new TimeStampAndCRL(token.toCMSSignedData().toASN1Structure());
return new CMSTimeStampedData(new ContentInfo(CMSObjectIdentifiers.timestampedData, new TimeStampedData(timeStampedData.getDataUri(), timeStampedData.getMetaData(), timeStampedData.getContent(), new Evidence(new TimeStampTokenEvidence(newTimeStamps)))));
}
示例11: validateInfoFormat
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
private static void validateInfoFormat(OtherRevocationInfoFormat infoFormat)
{
if (CMSObjectIdentifiers.id_ri_ocsp_response.equals(infoFormat.getInfoFormat()))
{
OCSPResponse resp = OCSPResponse.getInstance(infoFormat.getInfo());
if (resp.getResponseStatus().getValue().intValue() != OCSPResponseStatus.SUCCESSFUL)
{
throw new IllegalArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
}
}
}
示例12: open
import org.bouncycastle.asn1.cms.CMSObjectIdentifiers; //导入依赖的package包/类
/**
* Open a compressing output stream.
*
* @param contentOID the content type OID.
* @param out the stream to encode to.
* @param compressor the type of compressor to use.
* @return an output stream to write the data be compressed to.
* @throws IOException
*/
public OutputStream open(
ASN1ObjectIdentifier contentOID,
OutputStream out,
OutputCompressor compressor)
throws IOException
{
BERSequenceGenerator sGen = new BERSequenceGenerator(out);
sGen.addObject(CMSObjectIdentifiers.compressedData);
//
// Compressed Data
//
BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true);
cGen.addObject(new ASN1Integer(0));
//
// AlgorithmIdentifier
//
cGen.addObject(compressor.getAlgorithmIdentifier());
//
// Encapsulated ContentInfo
//
BERSequenceGenerator eiGen = new BERSequenceGenerator(cGen.getRawOutputStream());
eiGen.addObject(contentOID);
OutputStream octetStream = CMSUtils.createBEROctetOutputStream(
eiGen.getRawOutputStream(), 0, true, _bufferSize);
return new CmsCompressedOutputStream(
compressor.getOutputStream(octetStream), sGen, cGen, eiGen);
}