01: package org.bouncycastle.asn1.cms;
02:
03: import java.io.IOException;
04:
05: import org.bouncycastle.asn1.DEREncodable;
06: import org.bouncycastle.asn1.DERObjectIdentifier;
07: import org.bouncycastle.asn1.ASN1SequenceParser;
08: import org.bouncycastle.asn1.ASN1TaggedObjectParser;
09: import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
10:
11: /**
12: * <pre>
13: * EncryptedContentInfo ::= SEQUENCE {
14: * contentType ContentType,
15: * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
16: * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
17: * }
18: * </pre>
19: */
20: public class EncryptedContentInfoParser {
21: private DERObjectIdentifier _contentType;
22: private AlgorithmIdentifier _contentEncryptionAlgorithm;
23: private ASN1TaggedObjectParser _encryptedContent;
24:
25: public EncryptedContentInfoParser(ASN1SequenceParser seq)
26: throws IOException {
27: _contentType = (DERObjectIdentifier) seq.readObject();
28: _contentEncryptionAlgorithm = AlgorithmIdentifier
29: .getInstance(seq.readObject().getDERObject());
30: _encryptedContent = (ASN1TaggedObjectParser) seq.readObject();
31: }
32:
33: public DERObjectIdentifier getContentType() {
34: return _contentType;
35: }
36:
37: public AlgorithmIdentifier getContentEncryptionAlgorithm() {
38: return _contentEncryptionAlgorithm;
39: }
40:
41: public DEREncodable getEncryptedContent(int tag) throws IOException {
42: return _encryptedContent.getObjectParser(tag, false);
43: }
44: }
|