summary refs log tree commit diff
path: root/crypto/src/asn1/cms/ContentInfoParser.cs
blob: 541cc0f59bbe420b3c01b77e4d27c172355f765c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;

namespace Org.BouncyCastle.Asn1.Cms
{
	/**
	* Produce an object suitable for an Asn1OutputStream.
	* <pre>
	* ContentInfo ::= SEQUENCE {
	*          contentType ContentType,
	*          content
	*          [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
	* </pre>
	*/
	public class ContentInfoParser
	{
		private DerObjectIdentifier		contentType;
		private Asn1TaggedObjectParser	content;

		public ContentInfoParser(
			Asn1SequenceParser seq)
		{
			contentType = (DerObjectIdentifier)seq.ReadObject();
			content = (Asn1TaggedObjectParser)seq.ReadObject();
		}

		public DerObjectIdentifier ContentType
		{
			get { return contentType; }
		}

		public IAsn1Convertible GetContent(
			int tag)
		{
			if (content == null)
				return null;

			return content.GetObjectParser(tag, true);
		}
	}
}