53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
|
#pragma warning disable
|
|
using System;
|
|
using System.IO;
|
|
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
|
{
|
|
public class CmsContentInfoParser
|
|
{
|
|
protected ContentInfoParser contentInfo;
|
|
protected Stream data;
|
|
|
|
protected CmsContentInfoParser(
|
|
Stream data)
|
|
{
|
|
if (data == null)
|
|
throw new ArgumentNullException("data");
|
|
|
|
this.data = data;
|
|
|
|
try
|
|
{
|
|
Asn1StreamParser inStream = new Asn1StreamParser(data);
|
|
|
|
this.contentInfo = new ContentInfoParser((Asn1SequenceParser)inStream.ReadObject());
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
throw new CmsException("IOException reading content.", e);
|
|
}
|
|
catch (InvalidCastException e)
|
|
{
|
|
throw new CmsException("Unexpected object reading content.", e);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Close the underlying data stream.
|
|
* @throws IOException if the close fails.
|
|
*/
|
|
public void Close()
|
|
{
|
|
data.Dispose();
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore
|
|
#endif
|