summary refs log tree commit diff
path: root/crypto/src/cms/CMSTypedStream.cs
blob: 4cd8014aa31ac591476c351c0e50bf3ae0f84de9 (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
using System.IO;

using Org.BouncyCastle.Asn1.Pkcs;
using Org.BouncyCastle.Utilities.IO;

namespace Org.BouncyCastle.Cms
{
    public class CmsTypedStream
	{
		private readonly string	m_oid;
		private readonly Stream	m_in;

		public CmsTypedStream(Stream inStream)
			: this(PkcsObjectIdentifiers.Data.Id, inStream)
		{
		}

		public CmsTypedStream(string oid, Stream inStream)
			: this(oid, inStream, Streams.DefaultBufferSize)
		{
		}

		public CmsTypedStream(string oid, Stream inStream, int bufSize)
		{
			m_oid = oid;
            m_in = new BufferedFilterStream(inStream, bufSize);
        }

		public string ContentType => m_oid;

		public Stream ContentStream => m_in;

		public void Drain()
		{
			using (m_in) Streams.Drain(m_in);
		}
	}
}