本文整理汇总了Java中org.bouncycastle.asn1.ASN1OctetStringParser类的典型用法代码示例。如果您正苦于以下问题:Java ASN1OctetStringParser类的具体用法?Java ASN1OctetStringParser怎么用?Java ASN1OctetStringParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ASN1OctetStringParser类属于org.bouncycastle.asn1包,在下文中一共展示了ASN1OctetStringParser类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: TimeStampedDataParser
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
private TimeStampedDataParser(ASN1SequenceParser parser)
throws IOException
{
this.parser = parser;
this.version = ASN1Integer.getInstance(parser.readObject());
ASN1Encodable obj = parser.readObject();
if (obj instanceof DERIA5String)
{
this.dataUri = DERIA5String.getInstance(obj);
obj = parser.readObject();
}
if (obj instanceof MetaData || obj instanceof ASN1SequenceParser)
{
this.metaData = MetaData.getInstance(obj.toASN1Primitive());
obj = parser.readObject();
}
if (obj instanceof ASN1OctetStringParser)
{
this.content = (ASN1OctetStringParser)obj;
}
}
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:TimeStampedDataParser.java
示例2: getContent
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
/**
* @deprecated use getContent(InputExpandedProvider)
*/
public CMSTypedStream getContent()
throws CMSException
{
try
{
CompressedDataParser comData = new CompressedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));
ContentInfoParser content = comData.getEncapContentInfo();
ASN1OctetStringParser bytes = (ASN1OctetStringParser)content.getContent(BERTags.OCTET_STRING);
return new CMSTypedStream(content.getContentType().toString(), new InflaterInputStream(bytes.getOctetStream()));
}
catch (IOException e)
{
throw new CMSException("IOException reading compressed content.", e);
}
}
开发者ID:Appdome,项目名称:ipack,代码行数:21,代码来源:CMSCompressedDataParser.java
示例3: getContent
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
/**
* Return a typed stream which will allow the reading of the compressed content in
* expanded form.
*
* @param expanderProvider a provider of expander algorithm implementations.
* @return a type stream which will yield the un-compressed content.
* @throws CMSException if there is an exception parsing the CompressedData object.
*/
public CMSTypedStream getContent(InputExpanderProvider expanderProvider)
throws CMSException
{
try
{
CompressedDataParser comData = new CompressedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));
ContentInfoParser content = comData.getEncapContentInfo();
InputExpander expander = expanderProvider.get(comData.getCompressionAlgorithmIdentifier());
ASN1OctetStringParser bytes = (ASN1OctetStringParser)content.getContent(BERTags.OCTET_STRING);
return new CMSTypedStream(content.getContentType().getId(), expander.getInputStream(bytes.getOctetStream()));
}
catch (IOException e)
{
throw new CMSException("IOException reading compressed content.", e);
}
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:27,代码来源:CMSCompressedDataParser.java
示例4: pipeEncapsulatedOctetString
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
private static void pipeEncapsulatedOctetString(ContentInfoParser encapContentInfo,
OutputStream rawOutputStream) throws IOException
{
ASN1OctetStringParser octs = (ASN1OctetStringParser)
encapContentInfo.getContent(BERTags.OCTET_STRING);
if (octs != null)
{
pipeOctetString(octs, rawOutputStream);
}
// BERTaggedObjectParser contentObject = (BERTaggedObjectParser)encapContentInfo.getContentObject();
// if (contentObject != null)
// {
// // Handle IndefiniteLengthInputStream safely
// InputStream input = ASN1StreamParser.getSafeRawInputStream(contentObject.getContentStream(true));
//
// // TODO BerTaggedObjectGenerator?
// BEROutputStream berOut = new BEROutputStream(rawOutputStream);
// berOut.write(DERTags.CONSTRUCTED | DERTags.TAGGED | 0);
// berOut.write(0x80);
//
// pipeRawOctetString(input, rawOutputStream);
//
// berOut.write(0x00);
// berOut.write(0x00);
//
// input.close();
// }
}
开发者ID:Appdome,项目名称:ipack,代码行数:31,代码来源:CMSSignedDataParser.java
示例5: pipeOctetString
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
private static void pipeOctetString(
ASN1OctetStringParser octs,
OutputStream output)
throws IOException
{
// TODO Allow specification of a specific fragment size?
OutputStream outOctets = CMSUtils.createBEROctetOutputStream(
output, 0, true, 0);
Streams.pipeAll(octs.getOctetStream(), outOctets);
outOctets.close();
}
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:CMSSignedDataParser.java
示例6: CMSEnvelopedDataParser
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
public CMSEnvelopedDataParser(
InputStream envelopedData)
throws CMSException, IOException
{
super(envelopedData);
this.attrNotRead = true;
this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));
// TODO Validate version?
//DERInteger version = this._envelopedData.getVersion();
OriginatorInfo info = this.envelopedData.getOriginatorInfo();
if (info != null)
{
this.originatorInfo = new OriginatorInformation(info);
}
//
// read the recipients
//
ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());
//
// read the encrypted content info
//
EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
this.encAlg = encInfo.getContentEncryptionAlgorithm();
CMSReadable readable = new CMSProcessableInputStream(
((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
this.encAlg, readable);
//
// build the RecipientInformationStore
//
this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
recipientInfos, this.encAlg, secureReadable);
}
开发者ID:Appdome,项目名称:ipack,代码行数:41,代码来源:CMSEnvelopedDataParser.java
示例7: CMSEnvelopedDataParser
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
public CMSEnvelopedDataParser(
InputStream envelopedData)
throws CMSException, IOException
{
super(envelopedData);
this.attrNotRead = true;
this.envelopedData = new EnvelopedDataParser((ASN1SequenceParser)_contentInfo.getContent(BERTags.SEQUENCE));
// TODO Validate version?
//ASN1Integer version = this._envelopedData.getVersion();
OriginatorInfo info = this.envelopedData.getOriginatorInfo();
if (info != null)
{
this.originatorInfo = new OriginatorInformation(info);
}
//
// read the recipients
//
ASN1Set recipientInfos = ASN1Set.getInstance(this.envelopedData.getRecipientInfos().toASN1Primitive());
//
// read the encrypted content info
//
EncryptedContentInfoParser encInfo = this.envelopedData.getEncryptedContentInfo();
this.encAlg = encInfo.getContentEncryptionAlgorithm();
CMSReadable readable = new CMSProcessableInputStream(
((ASN1OctetStringParser)encInfo.getEncryptedContent(BERTags.OCTET_STRING)).getOctetStream());
CMSSecureReadable secureReadable = new CMSEnvelopedHelper.CMSEnvelopedSecureReadable(
this.encAlg, readable);
//
// build the RecipientInformationStore
//
this.recipientInfoStore = CMSEnvelopedHelper.buildRecipientInformationStore(
recipientInfos, this.encAlg, secureReadable);
}
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:41,代码来源:CMSEnvelopedDataParser.java
示例8: testReadingWriting
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
public void testReadingWriting()
throws Exception
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
BEROctetStringGenerator octGen = new BEROctetStringGenerator(bOut);
OutputStream out = octGen.getOctetOutputStream();
out.write(new byte[] { 1, 2, 3, 4 });
out.write(new byte[4]);
out.close();
ASN1StreamParser aIn = new ASN1StreamParser(bOut.toByteArray());
ASN1OctetStringParser s = (ASN1OctetStringParser)aIn.readObject();
InputStream in = s.getOctetStream();
int count = 0;
while (in.read() >= 0)
{
count++;
}
assertEquals(8, count);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:28,代码来源:OctetStringTest.java
示例9: testReadingWritingZeroInLength
import org.bouncycastle.asn1.ASN1OctetStringParser; //导入依赖的package包/类
public void testReadingWritingZeroInLength()
throws Exception
{
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
BEROctetStringGenerator octGen = new BEROctetStringGenerator(bOut);
OutputStream out = octGen.getOctetOutputStream();
out.write(new byte[] { 1, 2, 3, 4 });
out.write(new byte[512]); // forces a zero to appear in length
out.close();
ASN1StreamParser aIn = new ASN1StreamParser(bOut.toByteArray());
ASN1OctetStringParser s = (ASN1OctetStringParser)aIn.readObject();
InputStream in = s.getOctetStream();
int count = 0;
while (in.read() >= 0)
{
count++;
}
assertEquals(516, count);
}
开发者ID:credentials,项目名称:irma_future_id,代码行数:28,代码来源:OctetStringTest.java
注:本文中的org.bouncycastle.asn1.ASN1OctetStringParser类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论