use of com.github.zhenwei.core.asn1.ASN1SequenceParser in project LinLong-Java by zhenwei1108.
the class CMSAuthenticatedDataParser method getUnauthAttrs.
/**
* return a table of the unauthenticated attributes indexed by the OID of the attribute.
*
* @throws IOException
*/
public AttributeTable getUnauthAttrs() throws IOException {
if (unauthAttrs == null && unauthAttrNotRead) {
ASN1SetParser set = authData.getUnauthAttrs();
unauthAttrNotRead = false;
if (set != null) {
ASN1EncodableVector v = new ASN1EncodableVector();
ASN1Encodable o;
while ((o = set.readObject()) != null) {
ASN1SequenceParser seq = (ASN1SequenceParser) o;
v.add(seq.toASN1Primitive());
}
unauthAttrs = new AttributeTable(new DERSet(v));
}
}
return unauthAttrs;
}
use of com.github.zhenwei.core.asn1.ASN1SequenceParser in project LinLong-Java by zhenwei1108.
the class CMSCompressedDataParser method getContent.
/**
* 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(), expander.getInputStream(bytes.getOctetStream()));
} catch (IOException e) {
throw new CMSException("IOException reading compressed content.", e);
}
}
use of com.github.zhenwei.core.asn1.ASN1SequenceParser in project LinLong-Java by zhenwei1108.
the class AuthEnvelopedDataParser method getOriginatorInfo.
public OriginatorInfo getOriginatorInfo() throws IOException {
originatorInfoCalled = true;
if (nextObject == null) {
nextObject = seq.readObject();
}
if (nextObject instanceof ASN1TaggedObjectParser) {
ASN1TaggedObjectParser o = (ASN1TaggedObjectParser) nextObject;
if (o.hasContextTag(0)) {
ASN1SequenceParser originatorInfo = (ASN1SequenceParser) o.parseBaseUniversal(false, BERTags.SEQUENCE);
nextObject = null;
return OriginatorInfo.getInstance(originatorInfo.getLoadedObject());
}
}
return null;
}
use of com.github.zhenwei.core.asn1.ASN1SequenceParser in project LinLong-Java by zhenwei1108.
the class AuthEnvelopedDataParser method getAuthEncryptedContentInfo.
public EncryptedContentInfoParser getAuthEncryptedContentInfo() throws IOException {
if (nextObject == null) {
nextObject = seq.readObject();
}
if (nextObject != null) {
ASN1SequenceParser o = (ASN1SequenceParser) nextObject;
nextObject = null;
EncryptedContentInfoParser encryptedContentInfoParser = new EncryptedContentInfoParser(o);
isData = CMSObjectIdentifiers.data.equals(encryptedContentInfoParser.getContentType());
return encryptedContentInfoParser;
}
return null;
}
use of com.github.zhenwei.core.asn1.ASN1SequenceParser in project LinLong-Java by zhenwei1108.
the class AuthenticatedDataParser method getMacAlgorithm.
public AlgorithmIdentifier getMacAlgorithm() throws IOException {
if (nextObject == null) {
nextObject = seq.readObject();
}
if (nextObject != null) {
ASN1SequenceParser o = (ASN1SequenceParser) nextObject;
nextObject = null;
return AlgorithmIdentifier.getInstance(o.toASN1Primitive());
}
return null;
}
Aggregations