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