add all
This commit is contained in:
74
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attribute.cs
vendored
Normal file
74
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attribute.cs
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class Attribute
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerObjectIdentifier attrType;
|
||||
private Asn1Set attrValues;
|
||||
|
||||
/**
|
||||
* return an Attribute object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static Attribute GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is Attribute)
|
||||
return (Attribute) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new Attribute((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public Attribute(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
attrType = (DerObjectIdentifier)seq[0];
|
||||
attrValues = (Asn1Set)seq[1];
|
||||
}
|
||||
|
||||
public Attribute(
|
||||
DerObjectIdentifier attrType,
|
||||
Asn1Set attrValues)
|
||||
{
|
||||
this.attrType = attrType;
|
||||
this.attrValues = attrValues;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier AttrType
|
||||
{
|
||||
get { return attrType; }
|
||||
}
|
||||
|
||||
public Asn1Set AttrValues
|
||||
{
|
||||
get { return attrValues; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* Attribute ::= SEQUENCE {
|
||||
* attrType OBJECT IDENTIFIER,
|
||||
* attrValues SET OF AttributeValue
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(attrType, attrValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attribute.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attribute.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e7b2ed0c0e219d439652e22b9125ff7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
224
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AttributeTable.cs
vendored
Normal file
224
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AttributeTable.cs
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class AttributeTable
|
||||
{
|
||||
private readonly Dictionary<DerObjectIdentifier, object> m_attributes;
|
||||
|
||||
public AttributeTable(IDictionary<DerObjectIdentifier, object> attrs)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, object>(attrs);
|
||||
}
|
||||
|
||||
public AttributeTable(Asn1EncodableVector v)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, object>(v.Count);
|
||||
|
||||
foreach (Asn1Encodable e in v)
|
||||
{
|
||||
AddAttribute(Attribute.GetInstance(e));
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeTable(Asn1Set s)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, object>(s.Count);
|
||||
|
||||
foreach (Asn1Encodable e in s)
|
||||
{
|
||||
AddAttribute(Attribute.GetInstance(e));
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeTable(Attributes attrs)
|
||||
: this(Asn1Set.GetInstance(attrs.ToAsn1Object()))
|
||||
{
|
||||
}
|
||||
|
||||
private void AddAttribute(Attribute a)
|
||||
{
|
||||
DerObjectIdentifier oid = a.AttrType;
|
||||
|
||||
if (!m_attributes.TryGetValue(oid, out object existingValue))
|
||||
{
|
||||
m_attributes[oid] = a;
|
||||
return;
|
||||
}
|
||||
|
||||
if (existingValue is IList<Attribute> existingList)
|
||||
{
|
||||
existingList.Add(a);
|
||||
return;
|
||||
}
|
||||
|
||||
if (existingValue is Attribute existingAttr)
|
||||
{
|
||||
var newList = new List<Attribute>();
|
||||
newList.Add(existingAttr);
|
||||
newList.Add(a);
|
||||
m_attributes[oid] = newList;
|
||||
return;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
/// <summary>Return the first attribute matching the given OBJECT IDENTIFIER</summary>
|
||||
public Attribute this[DerObjectIdentifier oid]
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!m_attributes.TryGetValue(oid, out object existingValue))
|
||||
return null;
|
||||
|
||||
if (existingValue is IList<Attribute> existingList)
|
||||
return existingList[0];
|
||||
|
||||
if (existingValue is Attribute existingAttr)
|
||||
return existingAttr;
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the attributes matching the OBJECT IDENTIFIER oid. The vector will be
|
||||
* empty if there are no attributes of the required type present.
|
||||
*
|
||||
* @param oid type of attribute required.
|
||||
* @return a vector of all the attributes found of type oid.
|
||||
*/
|
||||
public Asn1EncodableVector GetAll(DerObjectIdentifier oid)
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
if (m_attributes.TryGetValue(oid, out object existingValue))
|
||||
{
|
||||
if (existingValue is IList<Attribute> existingList)
|
||||
{
|
||||
foreach (var attr in existingList)
|
||||
{
|
||||
v.Add(attr);
|
||||
}
|
||||
}
|
||||
else if (existingValue is Attribute existingAttr)
|
||||
{
|
||||
v.Add(existingAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
foreach (object existingValue in m_attributes.Values)
|
||||
{
|
||||
if (existingValue is IList<Attribute> existingList)
|
||||
{
|
||||
total += existingList.Count;
|
||||
}
|
||||
else if (existingValue is Attribute existingAttr)
|
||||
{
|
||||
++total;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionary<DerObjectIdentifier, object> ToDictionary()
|
||||
{
|
||||
return new Dictionary<DerObjectIdentifier, object>(m_attributes);
|
||||
}
|
||||
|
||||
public Asn1EncodableVector ToAsn1EncodableVector()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
foreach (object existingValue in m_attributes.Values)
|
||||
{
|
||||
if (existingValue is IList<Attribute> existingList)
|
||||
{
|
||||
foreach (Attribute existingAttr in existingList)
|
||||
{
|
||||
v.Add(existingAttr);
|
||||
}
|
||||
}
|
||||
else if (existingValue is Attribute existingAttr)
|
||||
{
|
||||
v.Add(existingAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
public Attributes ToAttributes()
|
||||
{
|
||||
return new Attributes(ToAsn1EncodableVector());
|
||||
}
|
||||
|
||||
public AttributeTable Add(params Attribute[] attributes)
|
||||
{
|
||||
if (attributes == null || attributes.Length < 1)
|
||||
return this;
|
||||
|
||||
var newTable = new AttributeTable(m_attributes);
|
||||
foreach (Attribute attribute in attributes)
|
||||
{
|
||||
newTable.AddAttribute(attribute);
|
||||
}
|
||||
|
||||
return newTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a new table with the passed in attribute added.
|
||||
*
|
||||
* @param attrType
|
||||
* @param attrValue
|
||||
* @return
|
||||
*/
|
||||
public AttributeTable Add(DerObjectIdentifier attrType, Asn1Encodable attrValue)
|
||||
{
|
||||
AttributeTable newTable = new AttributeTable(m_attributes);
|
||||
|
||||
newTable.AddAttribute(new Attribute(attrType, new DerSet(attrValue)));
|
||||
|
||||
return newTable;
|
||||
}
|
||||
|
||||
public AttributeTable Remove(DerObjectIdentifier attrType)
|
||||
{
|
||||
AttributeTable newTable = new AttributeTable(m_attributes);
|
||||
|
||||
newTable.m_attributes.Remove(attrType);
|
||||
|
||||
return newTable;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AttributeTable.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AttributeTable.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7d4a7121d9179946b171e9919501078
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
59
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attributes.cs
vendored
Normal file
59
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attributes.cs
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class Attributes
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1Set attributes;
|
||||
|
||||
private Attributes(Asn1Set attributes)
|
||||
{
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public Attributes(Asn1EncodableVector v)
|
||||
{
|
||||
attributes = new BerSet(v);
|
||||
}
|
||||
|
||||
public static Attributes GetInstance(object obj)
|
||||
{
|
||||
if (obj is Attributes)
|
||||
return (Attributes)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new Attributes(Asn1Set.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual Attribute[] GetAttributes()
|
||||
{
|
||||
Attribute[] rv = new Attribute[attributes.Count];
|
||||
|
||||
for (int i = 0; i != rv.Length; i++)
|
||||
{
|
||||
rv[i] = Attribute.GetInstance(attributes[i]);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Attributes ::=
|
||||
* SET SIZE(1..MAX) OF Attribute -- according to RFC 5652
|
||||
* </pre>
|
||||
* @return
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return attributes;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attributes.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Attributes.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93e45ad275157a34f82737172f176419
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
209
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedData.cs
vendored
Normal file
209
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedData.cs
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class AuthEnvelopedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private OriginatorInfo originatorInfo;
|
||||
private Asn1Set recipientInfos;
|
||||
private EncryptedContentInfo authEncryptedContentInfo;
|
||||
private Asn1Set authAttrs;
|
||||
private Asn1OctetString mac;
|
||||
private Asn1Set unauthAttrs;
|
||||
|
||||
public AuthEnvelopedData(
|
||||
OriginatorInfo originatorInfo,
|
||||
Asn1Set recipientInfos,
|
||||
EncryptedContentInfo authEncryptedContentInfo,
|
||||
Asn1Set authAttrs,
|
||||
Asn1OctetString mac,
|
||||
Asn1Set unauthAttrs)
|
||||
{
|
||||
// "It MUST be set to 0."
|
||||
this.version = new DerInteger(0);
|
||||
|
||||
this.originatorInfo = originatorInfo;
|
||||
|
||||
// "There MUST be at least one element in the collection."
|
||||
this.recipientInfos = recipientInfos;
|
||||
if (this.recipientInfos.Count < 1)
|
||||
throw new ArgumentException("AuthEnvelopedData requires at least 1 RecipientInfo");
|
||||
|
||||
this.authEncryptedContentInfo = authEncryptedContentInfo;
|
||||
|
||||
// "The authAttrs MUST be present if the content type carried in
|
||||
// EncryptedContentInfo is not id-data."
|
||||
this.authAttrs = authAttrs;
|
||||
if (!authEncryptedContentInfo.ContentType.Equals(CmsObjectIdentifiers.Data))
|
||||
{
|
||||
if (authAttrs == null || authAttrs.Count < 1)
|
||||
throw new ArgumentException("authAttrs must be present with non-data content");
|
||||
}
|
||||
|
||||
this.mac = mac;
|
||||
|
||||
this.unauthAttrs = unauthAttrs;
|
||||
}
|
||||
|
||||
private AuthEnvelopedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
// "It MUST be set to 0."
|
||||
Asn1Object tmp = seq[index++].ToAsn1Object();
|
||||
version = DerInteger.GetInstance(tmp);
|
||||
if (!version.HasValue(0))
|
||||
throw new ArgumentException("AuthEnvelopedData version number must be 0");
|
||||
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
originatorInfo = OriginatorInfo.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
}
|
||||
|
||||
// "There MUST be at least one element in the collection."
|
||||
recipientInfos = Asn1Set.GetInstance(tmp);
|
||||
if (recipientInfos.Count < 1)
|
||||
throw new ArgumentException("AuthEnvelopedData requires at least 1 RecipientInfo");
|
||||
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
authEncryptedContentInfo = EncryptedContentInfo.GetInstance(tmp);
|
||||
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
authAttrs = Asn1Set.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
}
|
||||
else
|
||||
{
|
||||
// "The authAttrs MUST be present if the content type carried in
|
||||
// EncryptedContentInfo is not id-data."
|
||||
if (!authEncryptedContentInfo.ContentType.Equals(CmsObjectIdentifiers.Data))
|
||||
{
|
||||
if (authAttrs == null || authAttrs.Count < 1)
|
||||
throw new ArgumentException("authAttrs must be present with non-data content");
|
||||
}
|
||||
}
|
||||
|
||||
mac = Asn1OctetString.GetInstance(tmp);
|
||||
|
||||
if (seq.Count > index)
|
||||
{
|
||||
tmp = seq[index++].ToAsn1Object();
|
||||
unauthAttrs = Asn1Set.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthEnvelopedData object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param isExplicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @throws ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static AuthEnvelopedData GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthEnvelopedData object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @throws ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static AuthEnvelopedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is AuthEnvelopedData)
|
||||
return (AuthEnvelopedData)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new AuthEnvelopedData((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Invalid AuthEnvelopedData: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo OriginatorInfo
|
||||
{
|
||||
get { return originatorInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set RecipientInfos
|
||||
{
|
||||
get { return recipientInfos; }
|
||||
}
|
||||
|
||||
public EncryptedContentInfo AuthEncryptedContentInfo
|
||||
{
|
||||
get { return authEncryptedContentInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set AuthAttrs
|
||||
{
|
||||
get { return authAttrs; }
|
||||
}
|
||||
|
||||
public Asn1OctetString Mac
|
||||
{
|
||||
get { return mac; }
|
||||
}
|
||||
|
||||
public Asn1Set UnauthAttrs
|
||||
{
|
||||
get { return unauthAttrs; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AuthEnvelopedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* authEncryptedContentInfo EncryptedContentInfo,
|
||||
* authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
|
||||
* mac MessageAuthenticationCode,
|
||||
* unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version);
|
||||
v.AddOptionalTagged(false, 0, originatorInfo);
|
||||
v.Add(recipientInfos, authEncryptedContentInfo);
|
||||
|
||||
// "authAttrs optionally contains the authenticated attributes."
|
||||
// "AuthAttributes MUST be DER encoded, even if the rest of the
|
||||
// AuthEnvelopedData structure is BER encoded."
|
||||
v.AddOptionalTagged(false, 1, authAttrs);
|
||||
|
||||
v.Add(mac);
|
||||
|
||||
// "unauthAttrs optionally contains the unauthenticated attributes."
|
||||
v.AddOptionalTagged(false, 2, unauthAttrs);
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4395da7e62945354ebf65fc7312dc0be
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
155
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedDataParser.cs
vendored
Normal file
155
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthEnvelopedDataParser.cs
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
*
|
||||
* <pre>
|
||||
* AuthEnvelopedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* authEncryptedContentInfo EncryptedContentInfo,
|
||||
* authAttrs [1] IMPLICIT AuthAttributes OPTIONAL,
|
||||
* mac MessageAuthenticationCode,
|
||||
* unauthAttrs [2] IMPLICIT UnauthAttributes OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public class AuthEnvelopedDataParser
|
||||
{
|
||||
private Asn1SequenceParser seq;
|
||||
private DerInteger version;
|
||||
private IAsn1Convertible nextObject;
|
||||
private bool originatorInfoCalled;
|
||||
private bool isData;
|
||||
|
||||
public AuthEnvelopedDataParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
|
||||
// "It MUST be set to 0."
|
||||
this.version = (DerInteger)seq.ReadObject();
|
||||
if (!version.HasValue(0))
|
||||
throw new Asn1ParsingException("AuthEnvelopedData version number must be 0");
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo GetOriginatorInfo()
|
||||
{
|
||||
originatorInfoCalled = true;
|
||||
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
if (o.HasContextTag(0))
|
||||
{
|
||||
Asn1SequenceParser originatorInfo = (Asn1SequenceParser)o.ParseBaseUniversal(false, Asn1Tags.Sequence);
|
||||
nextObject = null;
|
||||
return OriginatorInfo.GetInstance(originatorInfo.ToAsn1Object());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetRecipientInfos()
|
||||
{
|
||||
if (!originatorInfoCalled)
|
||||
{
|
||||
GetOriginatorInfo();
|
||||
}
|
||||
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
Asn1SetParser recipientInfos = (Asn1SetParser)nextObject;
|
||||
nextObject = null;
|
||||
return recipientInfos;
|
||||
}
|
||||
|
||||
public EncryptedContentInfoParser GetAuthEncryptedContentInfo()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
Asn1SequenceParser o = (Asn1SequenceParser) nextObject;
|
||||
nextObject = null;
|
||||
EncryptedContentInfoParser encryptedContentInfoParser = new EncryptedContentInfoParser(o);
|
||||
isData = CmsObjectIdentifiers.Data.Equals(encryptedContentInfoParser.ContentType);
|
||||
return encryptedContentInfoParser;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetAuthAttrs()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
nextObject = null;
|
||||
return (Asn1SetParser)Asn1Utilities.ParseContextBaseUniversal(o, 1, false, Asn1Tags.SetOf);
|
||||
}
|
||||
|
||||
// "The authAttrs MUST be present if the content type carried in EncryptedContentInfo is not id-data."
|
||||
if (!isData)
|
||||
throw new Asn1ParsingException("authAttrs must be present with non-data content");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1OctetString GetMac()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
IAsn1Convertible o = nextObject;
|
||||
nextObject = null;
|
||||
|
||||
return Asn1OctetString.GetInstance(o.ToAsn1Object());
|
||||
}
|
||||
|
||||
public Asn1SetParser GetUnauthAttrs()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
Asn1TaggedObjectParser o = (Asn1TaggedObjectParser)nextObject;
|
||||
nextObject = null;
|
||||
return (Asn1SetParser)Asn1Utilities.ParseContextBaseUniversal(o, 2, false, Asn1Tags.SetOf);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e5fac709ab110c47bc9eb66d230007a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
255
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedData.cs
vendored
Normal file
255
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedData.cs
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class AuthenticatedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private OriginatorInfo originatorInfo;
|
||||
private Asn1Set recipientInfos;
|
||||
private AlgorithmIdentifier macAlgorithm;
|
||||
private AlgorithmIdentifier digestAlgorithm;
|
||||
private ContentInfo encapsulatedContentInfo;
|
||||
private Asn1Set authAttrs;
|
||||
private Asn1OctetString mac;
|
||||
private Asn1Set unauthAttrs;
|
||||
|
||||
public AuthenticatedData(
|
||||
OriginatorInfo originatorInfo,
|
||||
Asn1Set recipientInfos,
|
||||
AlgorithmIdentifier macAlgorithm,
|
||||
AlgorithmIdentifier digestAlgorithm,
|
||||
ContentInfo encapsulatedContent,
|
||||
Asn1Set authAttrs,
|
||||
Asn1OctetString mac,
|
||||
Asn1Set unauthAttrs)
|
||||
{
|
||||
if (digestAlgorithm != null || authAttrs != null)
|
||||
{
|
||||
if (digestAlgorithm == null || authAttrs == null)
|
||||
{
|
||||
throw new ArgumentException("digestAlgorithm and authAttrs must be set together");
|
||||
}
|
||||
}
|
||||
|
||||
version = new DerInteger(CalculateVersion(originatorInfo));
|
||||
|
||||
this.originatorInfo = originatorInfo;
|
||||
this.macAlgorithm = macAlgorithm;
|
||||
this.digestAlgorithm = digestAlgorithm;
|
||||
this.recipientInfos = recipientInfos;
|
||||
this.encapsulatedContentInfo = encapsulatedContent;
|
||||
this.authAttrs = authAttrs;
|
||||
this.mac = mac;
|
||||
this.unauthAttrs = unauthAttrs;
|
||||
}
|
||||
|
||||
private AuthenticatedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
version = (DerInteger)seq[index++];
|
||||
|
||||
Asn1Encodable tmp = seq[index++];
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
originatorInfo = OriginatorInfo.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
tmp = seq[index++];
|
||||
}
|
||||
|
||||
recipientInfos = Asn1Set.GetInstance(tmp);
|
||||
macAlgorithm = AlgorithmIdentifier.GetInstance(seq[index++]);
|
||||
|
||||
tmp = seq[index++];
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
digestAlgorithm = AlgorithmIdentifier.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
tmp = seq[index++];
|
||||
}
|
||||
|
||||
encapsulatedContentInfo = ContentInfo.GetInstance(tmp);
|
||||
|
||||
tmp = seq[index++];
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
authAttrs = Asn1Set.GetInstance((Asn1TaggedObject)tmp, false);
|
||||
tmp = seq[index++];
|
||||
}
|
||||
|
||||
mac = Asn1OctetString.GetInstance(tmp);
|
||||
|
||||
if (seq.Count > index)
|
||||
{
|
||||
unauthAttrs = Asn1Set.GetInstance((Asn1TaggedObject)seq[index], false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthenticatedData object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param isExplicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @throws ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static AuthenticatedData GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthenticatedData object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @throws ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static AuthenticatedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is AuthenticatedData)
|
||||
{
|
||||
return (AuthenticatedData)obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new AuthenticatedData((Asn1Sequence)obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid AuthenticatedData: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo OriginatorInfo
|
||||
{
|
||||
get { return originatorInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set RecipientInfos
|
||||
{
|
||||
get { return recipientInfos; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier MacAlgorithm
|
||||
{
|
||||
get { return macAlgorithm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier DigestAlgorithm
|
||||
{
|
||||
get { return digestAlgorithm; }
|
||||
}
|
||||
|
||||
public ContentInfo EncapsulatedContentInfo
|
||||
{
|
||||
get { return encapsulatedContentInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set AuthAttrs
|
||||
{
|
||||
get { return authAttrs; }
|
||||
}
|
||||
|
||||
public Asn1OctetString Mac
|
||||
{
|
||||
get { return mac; }
|
||||
}
|
||||
|
||||
public Asn1Set UnauthAttrs
|
||||
{
|
||||
get { return unauthAttrs; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AuthenticatedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* macAlgorithm MessageAuthenticationCodeAlgorithm,
|
||||
* digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
|
||||
* encapContentInfo EncapsulatedContentInfo,
|
||||
* authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
|
||||
* mac MessageAuthenticationCode,
|
||||
* unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
|
||||
*
|
||||
* AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
|
||||
*
|
||||
* UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
|
||||
*
|
||||
* MessageAuthenticationCode ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version);
|
||||
v.AddOptionalTagged(false, 0, originatorInfo);
|
||||
v.Add(recipientInfos, macAlgorithm);
|
||||
v.AddOptionalTagged(false, 1, digestAlgorithm);
|
||||
v.Add(encapsulatedContentInfo);
|
||||
v.AddOptionalTagged(false, 2, authAttrs);
|
||||
v.Add(mac);
|
||||
v.AddOptionalTagged(false, 3, unauthAttrs);
|
||||
return new BerSequence(v);
|
||||
}
|
||||
|
||||
public static int CalculateVersion(OriginatorInfo origInfo)
|
||||
{
|
||||
if (origInfo == null)
|
||||
return 0;
|
||||
|
||||
int ver = 0;
|
||||
|
||||
foreach (object obj in origInfo.Certificates)
|
||||
{
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject tag = (Asn1TaggedObject)obj;
|
||||
|
||||
if (tag.TagNo == 2)
|
||||
{
|
||||
ver = 1;
|
||||
}
|
||||
else if (tag.TagNo == 3)
|
||||
{
|
||||
ver = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (object obj in origInfo.Crls)
|
||||
{
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject tag = (Asn1TaggedObject)obj;
|
||||
|
||||
if (tag.TagNo == 1)
|
||||
{
|
||||
ver = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ver;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff572d35ad682f4486444d1af9600a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
188
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedDataParser.cs
vendored
Normal file
188
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/AuthenticatedDataParser.cs
vendored
Normal file
@@ -0,0 +1,188 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AuthenticatedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* macAlgorithm MessageAuthenticationCodeAlgorithm,
|
||||
* digestAlgorithm [1] DigestAlgorithmIdentifier OPTIONAL,
|
||||
* encapContentInfo EncapsulatedContentInfo,
|
||||
* authAttrs [2] IMPLICIT AuthAttributes OPTIONAL,
|
||||
* mac MessageAuthenticationCode,
|
||||
* unauthAttrs [3] IMPLICIT UnauthAttributes OPTIONAL }
|
||||
*
|
||||
* AuthAttributes ::= SET SIZE (1..MAX) OF Attribute
|
||||
*
|
||||
* UnauthAttributes ::= SET SIZE (1..MAX) OF Attribute
|
||||
*
|
||||
* MessageAuthenticationCode ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public class AuthenticatedDataParser
|
||||
{
|
||||
private Asn1SequenceParser seq;
|
||||
private DerInteger version;
|
||||
private IAsn1Convertible nextObject;
|
||||
private bool originatorInfoCalled;
|
||||
|
||||
public AuthenticatedDataParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
this.version = (DerInteger)seq.ReadObject();
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo GetOriginatorInfo()
|
||||
{
|
||||
originatorInfoCalled = true;
|
||||
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
if (o.HasContextTag(0))
|
||||
{
|
||||
Asn1SequenceParser originatorInfo = (Asn1SequenceParser)o.ParseBaseUniversal(false, Asn1Tags.Sequence);
|
||||
nextObject = null;
|
||||
return OriginatorInfo.GetInstance(originatorInfo.ToAsn1Object());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetRecipientInfos()
|
||||
{
|
||||
if (!originatorInfoCalled)
|
||||
{
|
||||
GetOriginatorInfo();
|
||||
}
|
||||
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
Asn1SetParser recipientInfos = (Asn1SetParser)nextObject;
|
||||
nextObject = null;
|
||||
return recipientInfos;
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier GetMacAlgorithm()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
Asn1SequenceParser o = (Asn1SequenceParser)nextObject;
|
||||
nextObject = null;
|
||||
return AlgorithmIdentifier.GetInstance(o.ToAsn1Object());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier GetDigestAlgorithm()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject is Asn1TaggedObjectParser)
|
||||
{
|
||||
AlgorithmIdentifier obj = AlgorithmIdentifier.GetInstance(
|
||||
(Asn1TaggedObject)nextObject.ToAsn1Object(), false);
|
||||
nextObject = null;
|
||||
return obj;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public ContentInfoParser GetEnapsulatedContentInfo()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
Asn1SequenceParser o = (Asn1SequenceParser)nextObject;
|
||||
nextObject = null;
|
||||
return new ContentInfoParser(o);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetAuthAttrs()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
nextObject = null;
|
||||
return (Asn1SetParser)Asn1Utilities.ParseContextBaseUniversal(o, 2, false, Asn1Tags.SetOf);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1OctetString GetMac()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
IAsn1Convertible o = nextObject;
|
||||
nextObject = null;
|
||||
|
||||
return Asn1OctetString.GetInstance(o.ToAsn1Object());
|
||||
}
|
||||
|
||||
public Asn1SetParser GetUnauthAttrs()
|
||||
{
|
||||
if (nextObject == null)
|
||||
{
|
||||
nextObject = seq.ReadObject();
|
||||
}
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
Asn1TaggedObject o = (Asn1TaggedObject)nextObject;
|
||||
nextObject = null;
|
||||
return (Asn1SetParser)Asn1Utilities.ParseContextBaseUniversal(o, 3, false, Asn1Tags.SetOf);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c19c2da6a0d2194e86593aad8a68c87
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSAttributes.cs
vendored
Normal file
18
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSAttributes.cs
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public abstract class CmsAttributes
|
||||
{
|
||||
public static readonly DerObjectIdentifier ContentType = PkcsObjectIdentifiers.Pkcs9AtContentType;
|
||||
public static readonly DerObjectIdentifier MessageDigest = PkcsObjectIdentifiers.Pkcs9AtMessageDigest;
|
||||
public static readonly DerObjectIdentifier SigningTime = PkcsObjectIdentifiers.Pkcs9AtSigningTime;
|
||||
public static readonly DerObjectIdentifier CounterSignature = PkcsObjectIdentifiers.Pkcs9AtCounterSignature;
|
||||
public static readonly DerObjectIdentifier ContentHint = PkcsObjectIdentifiers.IdAAContentHint;
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSAttributes.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSAttributes.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3536faf70205ac240a1f81abacaa70b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
33
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSObjectIdentifiers.cs
vendored
Normal file
33
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CMSObjectIdentifiers.cs
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public abstract class CmsObjectIdentifiers
|
||||
{
|
||||
public static readonly DerObjectIdentifier Data = PkcsObjectIdentifiers.Data;
|
||||
public static readonly DerObjectIdentifier SignedData = PkcsObjectIdentifiers.SignedData;
|
||||
public static readonly DerObjectIdentifier EnvelopedData = PkcsObjectIdentifiers.EnvelopedData;
|
||||
public static readonly DerObjectIdentifier SignedAndEnvelopedData = PkcsObjectIdentifiers.SignedAndEnvelopedData;
|
||||
public static readonly DerObjectIdentifier DigestedData = PkcsObjectIdentifiers.DigestedData;
|
||||
public static readonly DerObjectIdentifier EncryptedData = PkcsObjectIdentifiers.EncryptedData;
|
||||
public static readonly DerObjectIdentifier AuthenticatedData = PkcsObjectIdentifiers.IdCTAuthData;
|
||||
public static readonly DerObjectIdentifier CompressedData = PkcsObjectIdentifiers.IdCTCompressedData;
|
||||
public static readonly DerObjectIdentifier AuthEnvelopedData = PkcsObjectIdentifiers.IdCTAuthEnvelopedData;
|
||||
public static readonly DerObjectIdentifier TimestampedData = PkcsObjectIdentifiers.IdCTTimestampedData;
|
||||
public static readonly DerObjectIdentifier ZlibCompress = PkcsObjectIdentifiers.IdAlgZlibCompress;
|
||||
|
||||
/**
|
||||
* The other Revocation Info arc
|
||||
* id-ri OBJECT IDENTIFIER ::= { iso(1) identified-organization(3)
|
||||
* dod(6) internet(1) security(5) mechanisms(5) pkix(7) ri(16) }
|
||||
*/
|
||||
public static readonly DerObjectIdentifier id_ri = new DerObjectIdentifier("1.3.6.1.5.5.7.16");
|
||||
|
||||
public static readonly DerObjectIdentifier id_ri_ocsp_response = id_ri.Branch("2");
|
||||
public static readonly DerObjectIdentifier id_ri_scvp = id_ri.Branch("4");
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fb16ff4f1005f3c43b3f3b7527cef3c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
100
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedData.cs
vendored
Normal file
100
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedData.cs
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* RFC 3274 - CMS Compressed Data.
|
||||
* <pre>
|
||||
* CompressedData ::= Sequence {
|
||||
* version CMSVersion,
|
||||
* compressionAlgorithm CompressionAlgorithmIdentifier,
|
||||
* encapContentInfo EncapsulatedContentInfo
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class CompressedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private AlgorithmIdentifier compressionAlgorithm;
|
||||
private ContentInfo encapContentInfo;
|
||||
|
||||
public CompressedData(
|
||||
AlgorithmIdentifier compressionAlgorithm,
|
||||
ContentInfo encapContentInfo)
|
||||
{
|
||||
this.version = new DerInteger(0);
|
||||
this.compressionAlgorithm = compressionAlgorithm;
|
||||
this.encapContentInfo = encapContentInfo;
|
||||
}
|
||||
|
||||
public CompressedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.version = (DerInteger) seq[0];
|
||||
this.compressionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
this.encapContentInfo = ContentInfo.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
/**
|
||||
* return a CompressedData object from a tagged object.
|
||||
*
|
||||
* @param ato the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static CompressedData GetInstance(
|
||||
Asn1TaggedObject ato,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(ato, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a CompressedData object from the given object.
|
||||
*
|
||||
* @param _obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static CompressedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is CompressedData)
|
||||
return (CompressedData)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new CompressedData((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("Invalid CompressedData: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier CompressionAlgorithmIdentifier
|
||||
{
|
||||
get { return compressionAlgorithm; }
|
||||
}
|
||||
|
||||
public ContentInfo EncapContentInfo
|
||||
{
|
||||
get { return encapContentInfo; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new BerSequence(version, compressionAlgorithm, encapContentInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9457f0c939bd3a64db91f73728493334
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedDataParser.cs
vendored
Normal file
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/CompressedDataParser.cs
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* RFC 3274 - CMS Compressed Data.
|
||||
* <pre>
|
||||
* CompressedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* compressionAlgorithm CompressionAlgorithmIdentifier,
|
||||
* encapContentInfo EncapsulatedContentInfo
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class CompressedDataParser
|
||||
{
|
||||
private DerInteger _version;
|
||||
private AlgorithmIdentifier _compressionAlgorithm;
|
||||
private ContentInfoParser _encapContentInfo;
|
||||
|
||||
public CompressedDataParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
this._version = (DerInteger)seq.ReadObject();
|
||||
this._compressionAlgorithm = AlgorithmIdentifier.GetInstance(seq.ReadObject().ToAsn1Object());
|
||||
this._encapContentInfo = new ContentInfoParser((Asn1SequenceParser)seq.ReadObject());
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return _version; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier CompressionAlgorithmIdentifier
|
||||
{
|
||||
get { return _compressionAlgorithm; }
|
||||
}
|
||||
|
||||
public ContentInfoParser GetEncapContentInfo()
|
||||
{
|
||||
return _encapContentInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3793ea5a61cce8e469fa9dc164e95a48
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
91
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfo.cs
vendored
Normal file
91
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfo.cs
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class ContentInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier contentType;
|
||||
private readonly Asn1Encodable content;
|
||||
|
||||
public static ContentInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is ContentInfo)
|
||||
return (ContentInfo) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new ContentInfo((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public static ContentInfo GetInstance(Asn1TaggedObject obj, bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
private ContentInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
contentType = (DerObjectIdentifier) seq[0];
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
Asn1TaggedObject tagged = (Asn1TaggedObject) seq[1];
|
||||
if (!tagged.IsExplicit() || tagged.TagNo != 0)
|
||||
throw new ArgumentException("Bad tag for 'content'", "seq");
|
||||
|
||||
content = tagged.GetObject();
|
||||
}
|
||||
}
|
||||
|
||||
public ContentInfo(
|
||||
DerObjectIdentifier contentType,
|
||||
Asn1Encodable content)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Content
|
||||
{
|
||||
get { return content; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* ContentInfo ::= Sequence {
|
||||
* contentType ContentType,
|
||||
* content
|
||||
* [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(contentType);
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
v.Add(new BerTaggedObject(0, content));
|
||||
}
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60dc726915386494a93527c45d350449
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfoParser.cs
vendored
Normal file
44
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfoParser.cs
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.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 readonly DerObjectIdentifier m_contentType;
|
||||
private readonly Asn1TaggedObjectParser m_content;
|
||||
|
||||
public ContentInfoParser(Asn1SequenceParser seq)
|
||||
{
|
||||
m_contentType = (DerObjectIdentifier)seq.ReadObject();
|
||||
m_content = (Asn1TaggedObjectParser)seq.ReadObject();
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return m_contentType; }
|
||||
}
|
||||
|
||||
public IAsn1Convertible GetContent(int tag)
|
||||
{
|
||||
if (null == m_content)
|
||||
return null;
|
||||
|
||||
// TODO[cms] Ideally we could enforce the claimed tag
|
||||
//return Asn1Utilities.ParseContextBaseUniversal(content, 0, true, tag);
|
||||
return Asn1Utilities.ParseExplicitContextBaseObject(m_content, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfoParser.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ContentInfoParser.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea9252b7438c0be4391421c0b342301d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
98
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedContentInfo.cs
vendored
Normal file
98
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedContentInfo.cs
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class EncryptedContentInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerObjectIdentifier contentType;
|
||||
private AlgorithmIdentifier contentEncryptionAlgorithm;
|
||||
private Asn1OctetString encryptedContent;
|
||||
|
||||
public EncryptedContentInfo(
|
||||
DerObjectIdentifier contentType,
|
||||
AlgorithmIdentifier contentEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedContent)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.contentEncryptionAlgorithm = contentEncryptionAlgorithm;
|
||||
this.encryptedContent = encryptedContent;
|
||||
}
|
||||
|
||||
public EncryptedContentInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
contentType = (DerObjectIdentifier) seq[0];
|
||||
contentEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
|
||||
if (seq.Count > 2)
|
||||
{
|
||||
encryptedContent = Asn1OctetString.GetInstance(
|
||||
(Asn1TaggedObject) seq[2], false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an EncryptedContentInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static EncryptedContentInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is EncryptedContentInfo)
|
||||
return (EncryptedContentInfo)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new EncryptedContentInfo((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Invalid EncryptedContentInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier ContentEncryptionAlgorithm
|
||||
{
|
||||
get { return contentEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedContent
|
||||
{
|
||||
get { return encryptedContent; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* EncryptedContentInfo ::= Sequence {
|
||||
* contentType ContentType,
|
||||
* contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
|
||||
* encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(
|
||||
contentType, contentEncryptionAlgorithm);
|
||||
|
||||
if (encryptedContent != null)
|
||||
{
|
||||
v.Add(new BerTaggedObject(false, 0, encryptedContent));
|
||||
}
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3bad0f2b4823f394ca2aa0ff2f31de2c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,50 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* <pre>
|
||||
* EncryptedContentInfo ::= SEQUENCE {
|
||||
* contentType ContentType,
|
||||
* contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
|
||||
* encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class EncryptedContentInfoParser
|
||||
{
|
||||
private DerObjectIdentifier _contentType;
|
||||
private AlgorithmIdentifier _contentEncryptionAlgorithm;
|
||||
private Asn1TaggedObjectParser _encryptedContent;
|
||||
|
||||
public EncryptedContentInfoParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
_contentType = (DerObjectIdentifier)seq.ReadObject();
|
||||
_contentEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq.ReadObject().ToAsn1Object());
|
||||
_encryptedContent = (Asn1TaggedObjectParser)seq.ReadObject();
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return _contentType; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier ContentEncryptionAlgorithm
|
||||
{
|
||||
get { return _contentEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public IAsn1Convertible GetEncryptedContent(
|
||||
int tag)
|
||||
{
|
||||
return Asn1Utilities.ParseContextBaseUniversal(_encryptedContent, 0, false, tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1bfe6014042c4844687f17cbad385878
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
101
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedData.cs
vendored
Normal file
101
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedData.cs
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class EncryptedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerInteger version;
|
||||
private readonly EncryptedContentInfo encryptedContentInfo;
|
||||
private readonly Asn1Set unprotectedAttrs;
|
||||
|
||||
public static EncryptedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is EncryptedData)
|
||||
return (EncryptedData) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new EncryptedData((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("Invalid EncryptedData: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public EncryptedData(
|
||||
EncryptedContentInfo encInfo)
|
||||
: this(encInfo, null)
|
||||
{
|
||||
}
|
||||
|
||||
public EncryptedData(
|
||||
EncryptedContentInfo encInfo,
|
||||
Asn1Set unprotectedAttrs)
|
||||
{
|
||||
if (encInfo == null)
|
||||
throw new ArgumentNullException("encInfo");
|
||||
|
||||
this.version = new DerInteger((unprotectedAttrs == null) ? 0 : 2);
|
||||
this.encryptedContentInfo = encInfo;
|
||||
this.unprotectedAttrs = unprotectedAttrs;
|
||||
}
|
||||
|
||||
private EncryptedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq == null)
|
||||
throw new ArgumentNullException("seq");
|
||||
if (seq.Count < 2 || seq.Count > 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
this.version = DerInteger.GetInstance(seq[0]);
|
||||
this.encryptedContentInfo = EncryptedContentInfo.GetInstance(seq[1]);
|
||||
|
||||
if (seq.Count > 2)
|
||||
{
|
||||
this.unprotectedAttrs = Asn1Set.GetInstance((Asn1TaggedObject)seq[2], false);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public virtual EncryptedContentInfo EncryptedContentInfo
|
||||
{
|
||||
get { return encryptedContentInfo; }
|
||||
}
|
||||
|
||||
public virtual Asn1Set UnprotectedAttrs
|
||||
{
|
||||
get { return unprotectedAttrs; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* EncryptedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* encryptedContentInfo EncryptedContentInfo,
|
||||
* unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL }
|
||||
* </pre>
|
||||
* @return a basic ASN.1 object representation.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, encryptedContentInfo);
|
||||
|
||||
if (unprotectedAttrs != null)
|
||||
{
|
||||
v.Add(new BerTaggedObject(false, 1, unprotectedAttrs));
|
||||
}
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EncryptedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e831d81ebdc6d1049bda28344baa9e4a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
165
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedData.cs
vendored
Normal file
165
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedData.cs
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class EnvelopedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private OriginatorInfo originatorInfo;
|
||||
private Asn1Set recipientInfos;
|
||||
private EncryptedContentInfo encryptedContentInfo;
|
||||
private Asn1Set unprotectedAttrs;
|
||||
|
||||
public EnvelopedData(
|
||||
OriginatorInfo originatorInfo,
|
||||
Asn1Set recipientInfos,
|
||||
EncryptedContentInfo encryptedContentInfo,
|
||||
Asn1Set unprotectedAttrs)
|
||||
{
|
||||
this.version = new DerInteger(CalculateVersion(originatorInfo, recipientInfos, unprotectedAttrs));
|
||||
this.originatorInfo = originatorInfo;
|
||||
this.recipientInfos = recipientInfos;
|
||||
this.encryptedContentInfo = encryptedContentInfo;
|
||||
this.unprotectedAttrs = unprotectedAttrs;
|
||||
}
|
||||
|
||||
public EnvelopedData(
|
||||
OriginatorInfo originatorInfo,
|
||||
Asn1Set recipientInfos,
|
||||
EncryptedContentInfo encryptedContentInfo,
|
||||
Attributes unprotectedAttrs)
|
||||
{
|
||||
this.version = new DerInteger(CalculateVersion(originatorInfo, recipientInfos, Asn1Set.GetInstance(unprotectedAttrs)));
|
||||
this.originatorInfo = originatorInfo;
|
||||
this.recipientInfos = recipientInfos;
|
||||
this.encryptedContentInfo = encryptedContentInfo;
|
||||
this.unprotectedAttrs = Asn1Set.GetInstance(unprotectedAttrs);
|
||||
}
|
||||
|
||||
private EnvelopedData(Asn1Sequence seq)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
version = (DerInteger) seq[index++];
|
||||
|
||||
object tmp = seq[index++];
|
||||
|
||||
if (tmp is Asn1TaggedObject)
|
||||
{
|
||||
originatorInfo = OriginatorInfo.GetInstance((Asn1TaggedObject) tmp, false);
|
||||
tmp = seq[index++];
|
||||
}
|
||||
|
||||
recipientInfos = Asn1Set.GetInstance(tmp);
|
||||
encryptedContentInfo = EncryptedContentInfo.GetInstance(seq[index++]);
|
||||
|
||||
if (seq.Count > index)
|
||||
{
|
||||
unprotectedAttrs = Asn1Set.GetInstance((Asn1TaggedObject) seq[index], false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an EnvelopedData object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static EnvelopedData GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an EnvelopedData object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static EnvelopedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is EnvelopedData)
|
||||
return (EnvelopedData)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new EnvelopedData(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo OriginatorInfo
|
||||
{
|
||||
get { return originatorInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set RecipientInfos
|
||||
{
|
||||
get { return recipientInfos; }
|
||||
}
|
||||
|
||||
public EncryptedContentInfo EncryptedContentInfo
|
||||
{
|
||||
get { return encryptedContentInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set UnprotectedAttrs
|
||||
{
|
||||
get { return unprotectedAttrs; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* EnvelopedData ::= Sequence {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* encryptedContentInfo EncryptedContentInfo,
|
||||
* unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version);
|
||||
v.AddOptionalTagged(false, 0, originatorInfo);
|
||||
v.Add(recipientInfos, encryptedContentInfo);
|
||||
v.AddOptionalTagged(false, 1, unprotectedAttrs);
|
||||
return new BerSequence(v);
|
||||
}
|
||||
|
||||
public static int CalculateVersion(OriginatorInfo originatorInfo, Asn1Set recipientInfos, Asn1Set unprotectedAttrs)
|
||||
{
|
||||
if (originatorInfo != null || unprotectedAttrs != null)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
foreach (object o in recipientInfos)
|
||||
{
|
||||
RecipientInfo ri = RecipientInfo.GetInstance(o);
|
||||
|
||||
if (!ri.Version.HasValue(0))
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 888a33b285e27814b89fea6c91204f49
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
113
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedDataParser.cs
vendored
Normal file
113
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/EnvelopedDataParser.cs
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* EnvelopedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* originatorInfo [0] IMPLICIT OriginatorInfo OPTIONAL,
|
||||
* recipientInfos RecipientInfos,
|
||||
* encryptedContentInfo EncryptedContentInfo,
|
||||
* unprotectedAttrs [1] IMPLICIT UnprotectedAttributes OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class EnvelopedDataParser
|
||||
{
|
||||
private Asn1SequenceParser _seq;
|
||||
private DerInteger _version;
|
||||
private IAsn1Convertible _nextObject;
|
||||
private bool _originatorInfoCalled;
|
||||
|
||||
public EnvelopedDataParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
this._seq = seq;
|
||||
this._version = (DerInteger)seq.ReadObject();
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return _version; }
|
||||
}
|
||||
|
||||
public OriginatorInfo GetOriginatorInfo()
|
||||
{
|
||||
_originatorInfoCalled = true;
|
||||
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
if (_nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
if (o.HasContextTag(0))
|
||||
{
|
||||
Asn1SequenceParser originatorInfo = (Asn1SequenceParser)o.ParseBaseUniversal(false, Asn1Tags.Sequence);
|
||||
_nextObject = null;
|
||||
return OriginatorInfo.GetInstance(originatorInfo.ToAsn1Object());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetRecipientInfos()
|
||||
{
|
||||
if (!_originatorInfoCalled)
|
||||
{
|
||||
GetOriginatorInfo();
|
||||
}
|
||||
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
Asn1SetParser recipientInfos = (Asn1SetParser)_nextObject;
|
||||
_nextObject = null;
|
||||
return recipientInfos;
|
||||
}
|
||||
|
||||
public EncryptedContentInfoParser GetEncryptedContentInfo()
|
||||
{
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
if (_nextObject != null)
|
||||
{
|
||||
Asn1SequenceParser o = (Asn1SequenceParser) _nextObject;
|
||||
_nextObject = null;
|
||||
return new EncryptedContentInfoParser(o);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetUnprotectedAttrs()
|
||||
{
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
if (_nextObject != null)
|
||||
{
|
||||
Asn1TaggedObjectParser o = (Asn1TaggedObjectParser)_nextObject;
|
||||
_nextObject = null;
|
||||
return (Asn1SetParser)Asn1Utilities.ParseContextBaseUniversal(o, 1, false, Asn1Tags.SetOf);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bc54f1f2ca7d7ae499634d13c6c8aaa7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
77
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Evidence.cs
vendored
Normal file
77
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Evidence.cs
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class Evidence
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
private TimeStampTokenEvidence tstEvidence;
|
||||
private Asn1Sequence otherEvidence;
|
||||
|
||||
public Evidence(TimeStampTokenEvidence tstEvidence)
|
||||
{
|
||||
this.tstEvidence = tstEvidence;
|
||||
}
|
||||
|
||||
private Evidence(Asn1TaggedObject tagged)
|
||||
{
|
||||
if (tagged.TagNo == 0)
|
||||
{
|
||||
this.tstEvidence = TimeStampTokenEvidence.GetInstance(tagged, false);
|
||||
}
|
||||
//else if (tagged.TagNo == 1)
|
||||
//{
|
||||
// this.ersEvidence = EvidenceRecord.GetInstance(tagged, false);
|
||||
//}
|
||||
else if (tagged.TagNo == 2)
|
||||
{
|
||||
this.otherEvidence = Asn1Sequence.GetInstance(tagged, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("unknown tag in Evidence", "tagged");
|
||||
}
|
||||
}
|
||||
|
||||
public static Evidence GetInstance(object obj)
|
||||
{
|
||||
if (obj is Evidence)
|
||||
return (Evidence)obj;
|
||||
|
||||
if (obj is Asn1TaggedObject)
|
||||
return new Evidence(Asn1TaggedObject.GetInstance(obj));
|
||||
|
||||
throw new ArgumentException("Unknown object in GetInstance: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static Evidence GetInstance(Asn1TaggedObject obj, bool isExplicit)
|
||||
{
|
||||
return GetInstance(obj.GetObject()); // must be explicitly tagged
|
||||
}
|
||||
|
||||
public virtual TimeStampTokenEvidence TstEvidence
|
||||
{
|
||||
get { return tstEvidence; }
|
||||
}
|
||||
|
||||
//public EvidenceRecord ErsEvidence
|
||||
//{
|
||||
// get { return ersEvidence; }
|
||||
//}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
if (tstEvidence != null)
|
||||
return new DerTaggedObject(false, 0, tstEvidence);
|
||||
//if (ersEvidence != null)
|
||||
// return new DerTaggedObject(false, 1, ersEvidence);
|
||||
return new DerTaggedObject(false, 2, otherEvidence);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Evidence.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Evidence.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0d0b98dea935524fba0aaa44e38d720
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
65
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/IssuerAndSerialNumber.cs
vendored
Normal file
65
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/IssuerAndSerialNumber.cs
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class IssuerAndSerialNumber
|
||||
: Asn1Encodable
|
||||
{
|
||||
private X509Name name;
|
||||
private DerInteger serialNumber;
|
||||
|
||||
public static IssuerAndSerialNumber GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
IssuerAndSerialNumber existing = obj as IssuerAndSerialNumber;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new IssuerAndSerialNumber(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private IssuerAndSerialNumber(Asn1Sequence seq)
|
||||
{
|
||||
this.name = X509Name.GetInstance(seq[0]);
|
||||
this.serialNumber = (DerInteger) seq[1];
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber(
|
||||
X509Name name,
|
||||
BigInteger serialNumber)
|
||||
{
|
||||
this.name = name;
|
||||
this.serialNumber = new DerInteger(serialNumber);
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber(
|
||||
X509Name name,
|
||||
DerInteger serialNumber)
|
||||
{
|
||||
this.name = name;
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
public X509Name Name
|
||||
{
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public DerInteger SerialNumber
|
||||
{
|
||||
get { return serialNumber; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(name, serialNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae24f598301e6d245954af2b9f8c72f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
123
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKIdentifier.cs
vendored
Normal file
123
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKIdentifier.cs
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class KekIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1OctetString keyIdentifier;
|
||||
private Asn1GeneralizedTime date;
|
||||
private OtherKeyAttribute other;
|
||||
|
||||
public KekIdentifier(
|
||||
byte[] keyIdentifier,
|
||||
Asn1GeneralizedTime date,
|
||||
OtherKeyAttribute other)
|
||||
{
|
||||
this.keyIdentifier = new DerOctetString(keyIdentifier);
|
||||
this.date = date;
|
||||
this.other = other;
|
||||
}
|
||||
|
||||
public KekIdentifier(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
keyIdentifier = (Asn1OctetString) seq[0];
|
||||
|
||||
switch (seq.Count)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (seq[1] is Asn1GeneralizedTime)
|
||||
{
|
||||
date = (Asn1GeneralizedTime) seq[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
other = OtherKeyAttribute.GetInstance(seq[2]);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
date = (Asn1GeneralizedTime) seq[1];
|
||||
other = OtherKeyAttribute.GetInstance(seq[2]);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid KekIdentifier");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KekIdentifier object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static KekIdentifier GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KekIdentifier object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static KekIdentifier GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is KekIdentifier)
|
||||
return (KekIdentifier)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new KekIdentifier((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Invalid KekIdentifier: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public Asn1OctetString KeyIdentifier
|
||||
{
|
||||
get { return keyIdentifier; }
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime Date
|
||||
{
|
||||
get { return date; }
|
||||
}
|
||||
|
||||
public OtherKeyAttribute Other
|
||||
{
|
||||
get { return other; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* KekIdentifier ::= Sequence {
|
||||
* keyIdentifier OCTET STRING,
|
||||
* date GeneralizedTime OPTIONAL,
|
||||
* other OtherKeyAttribute OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(keyIdentifier);
|
||||
v.AddOptional(date, other);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKIdentifier.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKIdentifier.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61cf57550f3fe8245aa52a6fda2b863c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
110
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKRecipientInfo.cs
vendored
Normal file
110
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKRecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class KekRecipientInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private KekIdentifier kekID;
|
||||
private AlgorithmIdentifier keyEncryptionAlgorithm;
|
||||
private Asn1OctetString encryptedKey;
|
||||
|
||||
public KekRecipientInfo(
|
||||
KekIdentifier kekID,
|
||||
AlgorithmIdentifier keyEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedKey)
|
||||
{
|
||||
this.version = new DerInteger(4);
|
||||
this.kekID = kekID;
|
||||
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
|
||||
this.encryptedKey = encryptedKey;
|
||||
}
|
||||
|
||||
public KekRecipientInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
version = (DerInteger) seq[0];
|
||||
kekID = KekIdentifier.GetInstance(seq[1]);
|
||||
keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]);
|
||||
encryptedKey = (Asn1OctetString) seq[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KekRecipientInfo object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static KekRecipientInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KekRecipientInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static KekRecipientInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is KekRecipientInfo)
|
||||
return (KekRecipientInfo)obj;
|
||||
|
||||
if(obj is Asn1Sequence)
|
||||
return new KekRecipientInfo((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Invalid KekRecipientInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public KekIdentifier KekID
|
||||
{
|
||||
get { return kekID; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier KeyEncryptionAlgorithm
|
||||
{
|
||||
get { return keyEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedKey
|
||||
{
|
||||
get { return encryptedKey; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* KekRecipientInfo ::= Sequence {
|
||||
* version CMSVersion, -- always set to 4
|
||||
* kekID KekIdentifier,
|
||||
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
|
||||
* encryptedKey EncryptedKey
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(version, kekID, keyEncryptionAlgorithm, encryptedKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKRecipientInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KEKRecipientInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 078b20050375049498516d9b8d758480
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,98 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class KeyAgreeRecipientIdentifier
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
/**
|
||||
* return an KeyAgreeRecipientIdentifier object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param isExplicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static KeyAgreeRecipientIdentifier GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an KeyAgreeRecipientIdentifier object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static KeyAgreeRecipientIdentifier GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is KeyAgreeRecipientIdentifier)
|
||||
return (KeyAgreeRecipientIdentifier)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new KeyAgreeRecipientIdentifier(IssuerAndSerialNumber.GetInstance(obj));
|
||||
|
||||
if (obj is Asn1TaggedObject && ((Asn1TaggedObject)obj).TagNo == 0)
|
||||
{
|
||||
return new KeyAgreeRecipientIdentifier(RecipientKeyIdentifier.GetInstance(
|
||||
(Asn1TaggedObject)obj, false));
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid KeyAgreeRecipientIdentifier: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private readonly IssuerAndSerialNumber issuerSerial;
|
||||
private readonly RecipientKeyIdentifier rKeyID;
|
||||
|
||||
public KeyAgreeRecipientIdentifier(
|
||||
IssuerAndSerialNumber issuerSerial)
|
||||
{
|
||||
this.issuerSerial = issuerSerial;
|
||||
}
|
||||
|
||||
public KeyAgreeRecipientIdentifier(
|
||||
RecipientKeyIdentifier rKeyID)
|
||||
{
|
||||
this.rKeyID = rKeyID;
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber IssuerAndSerialNumber
|
||||
{
|
||||
get { return issuerSerial; }
|
||||
}
|
||||
|
||||
public RecipientKeyIdentifier RKeyID
|
||||
{
|
||||
get { return rKeyID; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* KeyAgreeRecipientIdentifier ::= CHOICE {
|
||||
* issuerAndSerialNumber IssuerAndSerialNumber,
|
||||
* rKeyId [0] IMPLICIT RecipientKeyIdentifier
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
if (issuerSerial != null)
|
||||
{
|
||||
return issuerSerial.ToAsn1Object();
|
||||
}
|
||||
|
||||
return new DerTaggedObject(false, 0, rKeyID);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31df2eb3dc66bac439bb35b6655efd96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
138
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KeyAgreeRecipientInfo.cs
vendored
Normal file
138
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KeyAgreeRecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class KeyAgreeRecipientInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private OriginatorIdentifierOrKey originator;
|
||||
private Asn1OctetString ukm;
|
||||
private AlgorithmIdentifier keyEncryptionAlgorithm;
|
||||
private Asn1Sequence recipientEncryptedKeys;
|
||||
|
||||
public KeyAgreeRecipientInfo(
|
||||
OriginatorIdentifierOrKey originator,
|
||||
Asn1OctetString ukm,
|
||||
AlgorithmIdentifier keyEncryptionAlgorithm,
|
||||
Asn1Sequence recipientEncryptedKeys)
|
||||
{
|
||||
this.version = new DerInteger(3);
|
||||
this.originator = originator;
|
||||
this.ukm = ukm;
|
||||
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
|
||||
this.recipientEncryptedKeys = recipientEncryptedKeys;
|
||||
}
|
||||
|
||||
public KeyAgreeRecipientInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
int index = 0;
|
||||
|
||||
version = (DerInteger) seq[index++];
|
||||
originator = OriginatorIdentifierOrKey.GetInstance(
|
||||
(Asn1TaggedObject) seq[index++], true);
|
||||
|
||||
if (seq[index] is Asn1TaggedObject)
|
||||
{
|
||||
ukm = Asn1OctetString.GetInstance(
|
||||
(Asn1TaggedObject) seq[index++], true);
|
||||
}
|
||||
|
||||
keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(
|
||||
seq[index++]);
|
||||
|
||||
recipientEncryptedKeys = (Asn1Sequence) seq[index++];
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KeyAgreeRecipientInfo object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static KeyAgreeRecipientInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KeyAgreeRecipientInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static KeyAgreeRecipientInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is KeyAgreeRecipientInfo)
|
||||
return (KeyAgreeRecipientInfo)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new KeyAgreeRecipientInfo((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException(
|
||||
"Illegal object in KeyAgreeRecipientInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public OriginatorIdentifierOrKey Originator
|
||||
{
|
||||
get { return originator; }
|
||||
}
|
||||
|
||||
public Asn1OctetString UserKeyingMaterial
|
||||
{
|
||||
get { return ukm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier KeyEncryptionAlgorithm
|
||||
{
|
||||
get { return keyEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1Sequence RecipientEncryptedKeys
|
||||
{
|
||||
get { return recipientEncryptedKeys; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* KeyAgreeRecipientInfo ::= Sequence {
|
||||
* version CMSVersion, -- always set to 3
|
||||
* originator [0] EXPLICIT OriginatorIdentifierOrKey,
|
||||
* ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
|
||||
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
|
||||
* recipientEncryptedKeys RecipientEncryptedKeys
|
||||
* }
|
||||
*
|
||||
* UserKeyingMaterial ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, new DerTaggedObject(true, 0, originator));
|
||||
v.AddOptionalTagged(true, 1, ukm);
|
||||
v.Add(keyEncryptionAlgorithm, recipientEncryptedKeys);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34fe33ea8c64d624197ed3c1d6992862
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
103
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KeyTransRecipientInfo.cs
vendored
Normal file
103
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/KeyTransRecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class KeyTransRecipientInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private RecipientIdentifier rid;
|
||||
private AlgorithmIdentifier keyEncryptionAlgorithm;
|
||||
private Asn1OctetString encryptedKey;
|
||||
|
||||
public KeyTransRecipientInfo(
|
||||
RecipientIdentifier rid,
|
||||
AlgorithmIdentifier keyEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedKey)
|
||||
{
|
||||
if (rid.ToAsn1Object() is Asn1TaggedObject)
|
||||
{
|
||||
this.version = new DerInteger(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.version = new DerInteger(0);
|
||||
}
|
||||
|
||||
this.rid = rid;
|
||||
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
|
||||
this.encryptedKey = encryptedKey;
|
||||
}
|
||||
|
||||
public KeyTransRecipientInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.version = (DerInteger) seq[0];
|
||||
this.rid = RecipientIdentifier.GetInstance(seq[1]);
|
||||
this.keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]);
|
||||
this.encryptedKey = (Asn1OctetString) seq[3];
|
||||
}
|
||||
|
||||
/**
|
||||
* return a KeyTransRecipientInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static KeyTransRecipientInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is KeyTransRecipientInfo)
|
||||
return (KeyTransRecipientInfo) obj;
|
||||
|
||||
if(obj is Asn1Sequence)
|
||||
return new KeyTransRecipientInfo((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException(
|
||||
"Illegal object in KeyTransRecipientInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public RecipientIdentifier RecipientIdentifier
|
||||
{
|
||||
get { return rid; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier KeyEncryptionAlgorithm
|
||||
{
|
||||
get { return keyEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedKey
|
||||
{
|
||||
get { return encryptedKey; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* KeyTransRecipientInfo ::= Sequence {
|
||||
* version CMSVersion, -- always set to 0 or 2
|
||||
* rid RecipientIdentifier,
|
||||
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
|
||||
* encryptedKey EncryptedKey
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(version, rid, keyEncryptionAlgorithm, encryptedKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ecf1fad3a8bf9247bca3ece6b50dcbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
98
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/MetaData.cs
vendored
Normal file
98
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/MetaData.cs
vendored
Normal file
@@ -0,0 +1,98 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class MetaData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerBoolean hashProtected;
|
||||
private DerUtf8String fileName;
|
||||
private DerIA5String mediaType;
|
||||
private Attributes otherMetaData;
|
||||
|
||||
public MetaData(
|
||||
DerBoolean hashProtected,
|
||||
DerUtf8String fileName,
|
||||
DerIA5String mediaType,
|
||||
Attributes otherMetaData)
|
||||
{
|
||||
this.hashProtected = hashProtected;
|
||||
this.fileName = fileName;
|
||||
this.mediaType = mediaType;
|
||||
this.otherMetaData = otherMetaData;
|
||||
}
|
||||
|
||||
private MetaData(Asn1Sequence seq)
|
||||
{
|
||||
this.hashProtected = DerBoolean.GetInstance(seq[0]);
|
||||
|
||||
int index = 1;
|
||||
|
||||
if (index < seq.Count && seq[index] is DerUtf8String)
|
||||
{
|
||||
this.fileName = DerUtf8String.GetInstance(seq[index++]);
|
||||
}
|
||||
if (index < seq.Count && seq[index] is DerIA5String)
|
||||
{
|
||||
this.mediaType = DerIA5String.GetInstance(seq[index++]);
|
||||
}
|
||||
if (index < seq.Count)
|
||||
{
|
||||
this.otherMetaData = Attributes.GetInstance(seq[index++]);
|
||||
}
|
||||
}
|
||||
|
||||
public static MetaData GetInstance(object obj)
|
||||
{
|
||||
if (obj is MetaData)
|
||||
return (MetaData)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new MetaData(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* MetaData ::= SEQUENCE {
|
||||
* hashProtected BOOLEAN,
|
||||
* fileName UTF8String OPTIONAL,
|
||||
* mediaType IA5String OPTIONAL,
|
||||
* otherMetaData Attributes OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
* @return
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(hashProtected);
|
||||
v.AddOptional(fileName, mediaType, otherMetaData);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
public virtual bool IsHashProtected
|
||||
{
|
||||
get { return hashProtected.IsTrue; }
|
||||
}
|
||||
|
||||
public virtual DerUtf8String FileName
|
||||
{
|
||||
get { return fileName; }
|
||||
}
|
||||
|
||||
public virtual DerIA5String MediaType
|
||||
{
|
||||
get { return mediaType; }
|
||||
}
|
||||
|
||||
public virtual Attributes OtherMetaData
|
||||
{
|
||||
get { return otherMetaData; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/MetaData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/MetaData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d2d072480f8d0a4499b4251e11c11d91
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
148
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorIdentifierOrKey.cs
vendored
Normal file
148
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorIdentifierOrKey.cs
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OriginatorIdentifierOrKey
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
private readonly Asn1Encodable id;
|
||||
|
||||
public OriginatorIdentifierOrKey(IssuerAndSerialNumber id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public OriginatorIdentifierOrKey(SubjectKeyIdentifier id)
|
||||
{
|
||||
this.id = new DerTaggedObject(false, 0, id);
|
||||
}
|
||||
|
||||
public OriginatorIdentifierOrKey(OriginatorPublicKey id)
|
||||
{
|
||||
this.id = new DerTaggedObject(false, 1, id);
|
||||
}
|
||||
|
||||
private OriginatorIdentifierOrKey(Asn1TaggedObject id)
|
||||
{
|
||||
// TODO Add validation
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorIdentifierOrKey object from a tagged object.
|
||||
*
|
||||
* @param o the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static OriginatorIdentifierOrKey GetInstance(
|
||||
Asn1TaggedObject o,
|
||||
bool explicitly)
|
||||
{
|
||||
if (!explicitly)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Can't implicitly tag OriginatorIdentifierOrKey");
|
||||
}
|
||||
|
||||
return GetInstance(o.GetObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorIdentifierOrKey object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OriginatorIdentifierOrKey GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is OriginatorIdentifierOrKey)
|
||||
return (OriginatorIdentifierOrKey)o;
|
||||
|
||||
if (o is IssuerAndSerialNumber)
|
||||
return new OriginatorIdentifierOrKey((IssuerAndSerialNumber)o);
|
||||
|
||||
if (o is SubjectKeyIdentifier)
|
||||
return new OriginatorIdentifierOrKey((SubjectKeyIdentifier)o);
|
||||
|
||||
if (o is OriginatorPublicKey)
|
||||
return new OriginatorIdentifierOrKey((OriginatorPublicKey)o);
|
||||
|
||||
if (o is Asn1TaggedObject)
|
||||
return new OriginatorIdentifierOrKey((Asn1TaggedObject)o);
|
||||
|
||||
throw new ArgumentException("Invalid OriginatorIdentifierOrKey: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(o));
|
||||
}
|
||||
|
||||
public Asn1Encodable ID
|
||||
{
|
||||
get { return id; }
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber IssuerAndSerialNumber
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id is IssuerAndSerialNumber)
|
||||
{
|
||||
return (IssuerAndSerialNumber)id;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public SubjectKeyIdentifier SubjectKeyIdentifier
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id is Asn1TaggedObject && ((Asn1TaggedObject)id).TagNo == 0)
|
||||
{
|
||||
return SubjectKeyIdentifier.GetInstance((Asn1TaggedObject)id, false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public OriginatorPublicKey OriginatorPublicKey
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id is Asn1TaggedObject && ((Asn1TaggedObject)id).TagNo == 1)
|
||||
{
|
||||
return OriginatorPublicKey.GetInstance((Asn1TaggedObject)id, false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* OriginatorIdentifierOrKey ::= CHOICE {
|
||||
* issuerAndSerialNumber IssuerAndSerialNumber,
|
||||
* subjectKeyIdentifier [0] SubjectKeyIdentifier,
|
||||
* originatorKey [1] OriginatorPublicKey
|
||||
* }
|
||||
*
|
||||
* SubjectKeyIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return id.ToAsn1Object();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc08d582034c58541b6a145196d0002f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
116
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorInfo.cs
vendored
Normal file
116
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorInfo.cs
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OriginatorInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1Set certs;
|
||||
private Asn1Set crls;
|
||||
|
||||
public OriginatorInfo(
|
||||
Asn1Set certs,
|
||||
Asn1Set crls)
|
||||
{
|
||||
this.certs = certs;
|
||||
this.crls = crls;
|
||||
}
|
||||
|
||||
public OriginatorInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
switch (seq.Count)
|
||||
{
|
||||
case 0: // empty
|
||||
break;
|
||||
case 1:
|
||||
Asn1TaggedObject o = (Asn1TaggedObject) seq[0];
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0 :
|
||||
certs = Asn1Set.GetInstance(o, false);
|
||||
break;
|
||||
case 1 :
|
||||
crls = Asn1Set.GetInstance(o, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Bad tag in OriginatorInfo: " + o.TagNo);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
certs = Asn1Set.GetInstance((Asn1TaggedObject) seq[0], false);
|
||||
crls = Asn1Set.GetInstance((Asn1TaggedObject) seq[1], false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("OriginatorInfo too big");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorInfo object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static OriginatorInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OriginatorInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is OriginatorInfo)
|
||||
return (OriginatorInfo)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new OriginatorInfo((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Invalid OriginatorInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public Asn1Set Certificates
|
||||
{
|
||||
get { return certs; }
|
||||
}
|
||||
|
||||
public Asn1Set Crls
|
||||
{
|
||||
get { return crls; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* OriginatorInfo ::= Sequence {
|
||||
* certs [0] IMPLICIT CertificateSet OPTIONAL,
|
||||
* crls [1] IMPLICIT CertificateRevocationLists OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(false, 0, certs);
|
||||
v.AddOptionalTagged(false, 1, crls);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b67e77451499f541ac1eec0c4a94419
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
90
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorPublicKey.cs
vendored
Normal file
90
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OriginatorPublicKey.cs
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OriginatorPublicKey
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly AlgorithmIdentifier mAlgorithm;
|
||||
private readonly DerBitString mPublicKey;
|
||||
|
||||
public OriginatorPublicKey(
|
||||
AlgorithmIdentifier algorithm,
|
||||
byte[] publicKey)
|
||||
{
|
||||
this.mAlgorithm = algorithm;
|
||||
this.mPublicKey = new DerBitString(publicKey);
|
||||
}
|
||||
|
||||
private OriginatorPublicKey(Asn1Sequence seq)
|
||||
{
|
||||
this.mAlgorithm = AlgorithmIdentifier.GetInstance(seq[0]);
|
||||
this.mPublicKey = DerBitString.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorPublicKey object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static OriginatorPublicKey GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an OriginatorPublicKey object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OriginatorPublicKey GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is OriginatorPublicKey)
|
||||
return (OriginatorPublicKey)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new OriginatorPublicKey(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
throw new ArgumentException("Invalid OriginatorPublicKey: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier Algorithm
|
||||
{
|
||||
get { return mAlgorithm; }
|
||||
}
|
||||
|
||||
public DerBitString PublicKey
|
||||
{
|
||||
get { return mPublicKey; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* OriginatorPublicKey ::= Sequence {
|
||||
* algorithm AlgorithmIdentifier,
|
||||
* publicKey BIT STRING
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(mAlgorithm, mPublicKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 901fb85c86fb2bb44bf63a38fb907c76
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
74
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherKeyAttribute.cs
vendored
Normal file
74
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherKeyAttribute.cs
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OtherKeyAttribute
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerObjectIdentifier keyAttrId;
|
||||
private Asn1Encodable keyAttr;
|
||||
|
||||
/**
|
||||
* return an OtherKeyAttribute object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OtherKeyAttribute GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is OtherKeyAttribute)
|
||||
return (OtherKeyAttribute) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new OtherKeyAttribute((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public OtherKeyAttribute(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
keyAttrId = (DerObjectIdentifier) seq[0];
|
||||
keyAttr = seq[1];
|
||||
}
|
||||
|
||||
public OtherKeyAttribute(
|
||||
DerObjectIdentifier keyAttrId,
|
||||
Asn1Encodable keyAttr)
|
||||
{
|
||||
this.keyAttrId = keyAttrId;
|
||||
this.keyAttr = keyAttr;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier KeyAttrId
|
||||
{
|
||||
get { return keyAttrId; }
|
||||
}
|
||||
|
||||
public Asn1Encodable KeyAttr
|
||||
{
|
||||
get { return keyAttr; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* OtherKeyAttribute ::= Sequence {
|
||||
* keyAttrId OBJECT IDENTIFIER,
|
||||
* keyAttr ANY DEFINED BY keyAttrId OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(keyAttrId, keyAttr);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherKeyAttribute.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherKeyAttribute.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bce1698247e12b44d9bca522b2d812b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
85
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherRecipientInfo.cs
vendored
Normal file
85
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherRecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OtherRecipientInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier oriType;
|
||||
private readonly Asn1Encodable oriValue;
|
||||
|
||||
public OtherRecipientInfo(
|
||||
DerObjectIdentifier oriType,
|
||||
Asn1Encodable oriValue)
|
||||
{
|
||||
this.oriType = oriType;
|
||||
this.oriValue = oriValue;
|
||||
}
|
||||
|
||||
private OtherRecipientInfo(Asn1Sequence seq)
|
||||
{
|
||||
oriType = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
oriValue = seq[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* return a OtherRecipientInfo object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static OtherRecipientInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a OtherRecipientInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OtherRecipientInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
OtherRecipientInfo existing = obj as OtherRecipientInfo;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new OtherRecipientInfo(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public virtual DerObjectIdentifier OriType
|
||||
{
|
||||
get { return oriType; }
|
||||
}
|
||||
|
||||
public virtual Asn1Encodable OriValue
|
||||
{
|
||||
get { return oriValue; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* OtherRecipientInfo ::= Sequence {
|
||||
* oriType OBJECT IDENTIFIER,
|
||||
* oriValue ANY DEFINED BY oriType }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(oriType, oriValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherRecipientInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/OtherRecipientInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1d41e3896d8556499306ab621d44846
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,79 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class OtherRevocationInfoFormat
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier otherRevInfoFormat;
|
||||
private readonly Asn1Encodable otherRevInfo;
|
||||
|
||||
public OtherRevocationInfoFormat(
|
||||
DerObjectIdentifier otherRevInfoFormat,
|
||||
Asn1Encodable otherRevInfo)
|
||||
{
|
||||
this.otherRevInfoFormat = otherRevInfoFormat;
|
||||
this.otherRevInfo = otherRevInfo;
|
||||
}
|
||||
|
||||
private OtherRevocationInfoFormat(Asn1Sequence seq)
|
||||
{
|
||||
otherRevInfoFormat = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
otherRevInfo = seq[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* return a OtherRevocationInfoFormat object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception IllegalArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static OtherRevocationInfoFormat GetInstance(Asn1TaggedObject obj, bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a OtherRevocationInfoFormat object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception IllegalArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static OtherRevocationInfoFormat GetInstance(object obj)
|
||||
{
|
||||
if (obj is OtherRevocationInfoFormat otherRevocationInfoFormat)
|
||||
return otherRevocationInfoFormat;
|
||||
if (obj != null)
|
||||
return new OtherRevocationInfoFormat(Asn1Sequence.GetInstance(obj));
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual DerObjectIdentifier InfoFormat
|
||||
{
|
||||
get { return otherRevInfoFormat; }
|
||||
}
|
||||
|
||||
public virtual Asn1Encodable Info
|
||||
{
|
||||
get { return otherRevInfo; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an ASN1OutputStream.
|
||||
* <pre>
|
||||
* OtherRevocationInfoFormat ::= SEQUENCE {
|
||||
* otherRevInfoFormat OBJECT IDENTIFIER,
|
||||
* otherRevInfo ANY DEFINED BY otherRevInfoFormat }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(otherRevInfoFormat, otherRevInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6056228d8a0a82849bf87fc2b84bb594
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
131
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/PasswordRecipientInfo.cs
vendored
Normal file
131
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/PasswordRecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class PasswordRecipientInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerInteger version;
|
||||
private readonly AlgorithmIdentifier keyDerivationAlgorithm;
|
||||
private readonly AlgorithmIdentifier keyEncryptionAlgorithm;
|
||||
private readonly Asn1OctetString encryptedKey;
|
||||
|
||||
public PasswordRecipientInfo(
|
||||
AlgorithmIdentifier keyEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedKey)
|
||||
{
|
||||
this.version = new DerInteger(0);
|
||||
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
|
||||
this.encryptedKey = encryptedKey;
|
||||
}
|
||||
|
||||
public PasswordRecipientInfo(
|
||||
AlgorithmIdentifier keyDerivationAlgorithm,
|
||||
AlgorithmIdentifier keyEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedKey)
|
||||
{
|
||||
this.version = new DerInteger(0);
|
||||
this.keyDerivationAlgorithm = keyDerivationAlgorithm;
|
||||
this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
|
||||
this.encryptedKey = encryptedKey;
|
||||
}
|
||||
|
||||
public PasswordRecipientInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
version = (DerInteger) seq[0];
|
||||
|
||||
if (seq[1] is Asn1TaggedObject)
|
||||
{
|
||||
keyDerivationAlgorithm = AlgorithmIdentifier.GetInstance((Asn1TaggedObject) seq[1], false);
|
||||
keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[2]);
|
||||
encryptedKey = (Asn1OctetString) seq[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
keyEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
encryptedKey = (Asn1OctetString) seq[2];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return a PasswordRecipientInfo object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param explicitly true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static PasswordRecipientInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a PasswordRecipientInfo object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static PasswordRecipientInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is PasswordRecipientInfo)
|
||||
return (PasswordRecipientInfo) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new PasswordRecipientInfo((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("Invalid PasswordRecipientInfo: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier KeyDerivationAlgorithm
|
||||
{
|
||||
get { return keyDerivationAlgorithm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier KeyEncryptionAlgorithm
|
||||
{
|
||||
get { return keyEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedKey
|
||||
{
|
||||
get { return encryptedKey; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* PasswordRecipientInfo ::= Sequence {
|
||||
* version CMSVersion, -- Always set to 0
|
||||
* keyDerivationAlgorithm [0] KeyDerivationAlgorithmIdentifier
|
||||
* OPTIONAL,
|
||||
* keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
|
||||
* encryptedKey EncryptedKey }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version);
|
||||
v.AddOptionalTagged(false, 0, keyDerivationAlgorithm);
|
||||
v.Add(keyEncryptionAlgorithm, encryptedKey);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0b8029af5f106a4ca472ea854b10b5f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
94
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientEncryptedKey.cs
vendored
Normal file
94
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientEncryptedKey.cs
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class RecipientEncryptedKey
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly KeyAgreeRecipientIdentifier identifier;
|
||||
private readonly Asn1OctetString encryptedKey;
|
||||
|
||||
private RecipientEncryptedKey(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
identifier = KeyAgreeRecipientIdentifier.GetInstance(seq[0]);
|
||||
encryptedKey = (Asn1OctetString) seq[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* return an RecipientEncryptedKey object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param isExplicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static RecipientEncryptedKey GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a RecipientEncryptedKey object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static RecipientEncryptedKey GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is RecipientEncryptedKey)
|
||||
{
|
||||
return (RecipientEncryptedKey) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new RecipientEncryptedKey((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid RecipientEncryptedKey: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public RecipientEncryptedKey(
|
||||
KeyAgreeRecipientIdentifier id,
|
||||
Asn1OctetString encryptedKey)
|
||||
{
|
||||
this.identifier = id;
|
||||
this.encryptedKey = encryptedKey;
|
||||
}
|
||||
|
||||
public KeyAgreeRecipientIdentifier Identifier
|
||||
{
|
||||
get { return identifier; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedKey
|
||||
{
|
||||
get { return encryptedKey; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* RecipientEncryptedKey ::= SEQUENCE {
|
||||
* rid KeyAgreeRecipientIdentifier,
|
||||
* encryptedKey EncryptedKey
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(identifier, encryptedKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 55d6b0041f9583941bcaa6cb61a9ecb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientIdentifier.cs
vendored
Normal file
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientIdentifier.cs
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class RecipientIdentifier
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
private Asn1Encodable id;
|
||||
|
||||
public RecipientIdentifier(
|
||||
IssuerAndSerialNumber id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public RecipientIdentifier(
|
||||
Asn1OctetString id)
|
||||
{
|
||||
this.id = new DerTaggedObject(false, 0, id);
|
||||
}
|
||||
|
||||
public RecipientIdentifier(
|
||||
Asn1Object id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* return a RecipientIdentifier object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static RecipientIdentifier GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is RecipientIdentifier)
|
||||
return (RecipientIdentifier)o;
|
||||
|
||||
if (o is IssuerAndSerialNumber)
|
||||
return new RecipientIdentifier((IssuerAndSerialNumber) o);
|
||||
|
||||
if (o is Asn1OctetString)
|
||||
return new RecipientIdentifier((Asn1OctetString) o);
|
||||
|
||||
if (o is Asn1Object)
|
||||
return new RecipientIdentifier((Asn1Object) o);
|
||||
|
||||
throw new ArgumentException(
|
||||
"Illegal object in RecipientIdentifier: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(o));
|
||||
}
|
||||
|
||||
public bool IsTagged
|
||||
{
|
||||
get { return (id is Asn1TaggedObject); }
|
||||
}
|
||||
|
||||
public Asn1Encodable ID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id is Asn1TaggedObject)
|
||||
{
|
||||
return Asn1OctetString.GetInstance((Asn1TaggedObject) id, false);
|
||||
}
|
||||
|
||||
return IssuerAndSerialNumber.GetInstance(id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* RecipientIdentifier ::= CHOICE {
|
||||
* issuerAndSerialNumber IssuerAndSerialNumber,
|
||||
* subjectKeyIdentifier [0] SubjectKeyIdentifier
|
||||
* }
|
||||
*
|
||||
* SubjectKeyIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return id.ToAsn1Object();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 268ed068df9ccc340a33d29480368f40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
149
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientInfo.cs
vendored
Normal file
149
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientInfo.cs
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class RecipientInfo
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
internal Asn1Encodable info;
|
||||
|
||||
public RecipientInfo(
|
||||
KeyTransRecipientInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public RecipientInfo(
|
||||
KeyAgreeRecipientInfo info)
|
||||
{
|
||||
this.info = new DerTaggedObject(false, 1, info);
|
||||
}
|
||||
|
||||
public RecipientInfo(
|
||||
KekRecipientInfo info)
|
||||
{
|
||||
this.info = new DerTaggedObject(false, 2, info);
|
||||
}
|
||||
|
||||
public RecipientInfo(
|
||||
PasswordRecipientInfo info)
|
||||
{
|
||||
this.info = new DerTaggedObject(false, 3, info);
|
||||
}
|
||||
|
||||
public RecipientInfo(
|
||||
OtherRecipientInfo info)
|
||||
{
|
||||
this.info = new DerTaggedObject(false, 4, info);
|
||||
}
|
||||
|
||||
public RecipientInfo(
|
||||
Asn1Object info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public static RecipientInfo GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is RecipientInfo)
|
||||
return (RecipientInfo) o;
|
||||
|
||||
if (o is Asn1Sequence)
|
||||
return new RecipientInfo((Asn1Sequence) o);
|
||||
|
||||
if (o is Asn1TaggedObject)
|
||||
return new RecipientInfo((Asn1TaggedObject) o);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(o));
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (info is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject o = (Asn1TaggedObject) info;
|
||||
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 1:
|
||||
return KeyAgreeRecipientInfo.GetInstance(o, false).Version;
|
||||
case 2:
|
||||
return GetKekInfo(o).Version;
|
||||
case 3:
|
||||
return PasswordRecipientInfo.GetInstance(o, false).Version;
|
||||
case 4:
|
||||
return new DerInteger(0); // no syntax version for OtherRecipientInfo
|
||||
default:
|
||||
throw new InvalidOperationException("unknown tag");
|
||||
}
|
||||
}
|
||||
|
||||
return KeyTransRecipientInfo.GetInstance(info).Version;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsTagged
|
||||
{
|
||||
get { return info is Asn1TaggedObject; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Info
|
||||
{
|
||||
get
|
||||
{
|
||||
if (info is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject o = (Asn1TaggedObject) info;
|
||||
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 1:
|
||||
return KeyAgreeRecipientInfo.GetInstance(o, false);
|
||||
case 2:
|
||||
return GetKekInfo(o);
|
||||
case 3:
|
||||
return PasswordRecipientInfo.GetInstance(o, false);
|
||||
case 4:
|
||||
return OtherRecipientInfo.GetInstance(o, false);
|
||||
default:
|
||||
throw new InvalidOperationException("unknown tag");
|
||||
}
|
||||
}
|
||||
|
||||
return KeyTransRecipientInfo.GetInstance(info);
|
||||
}
|
||||
}
|
||||
|
||||
private KekRecipientInfo GetKekInfo(
|
||||
Asn1TaggedObject o)
|
||||
{
|
||||
// For compatibility with erroneous version, we don't always pass 'false' here
|
||||
return KekRecipientInfo.GetInstance(o, o.IsExplicit());
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* RecipientInfo ::= CHOICE {
|
||||
* ktri KeyTransRecipientInfo,
|
||||
* kari [1] KeyAgreeRecipientInfo,
|
||||
* kekri [2] KekRecipientInfo,
|
||||
* pwri [3] PasswordRecipientInfo,
|
||||
* ori [4] OtherRecipientInfo }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return info.ToAsn1Object();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5eac07e1fb01c1046820e7a687450906
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
141
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientKeyIdentifier.cs
vendored
Normal file
141
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/RecipientKeyIdentifier.cs
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class RecipientKeyIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1OctetString subjectKeyIdentifier;
|
||||
private Asn1GeneralizedTime date;
|
||||
private OtherKeyAttribute other;
|
||||
|
||||
public RecipientKeyIdentifier(
|
||||
Asn1OctetString subjectKeyIdentifier,
|
||||
Asn1GeneralizedTime date,
|
||||
OtherKeyAttribute other)
|
||||
{
|
||||
this.subjectKeyIdentifier = subjectKeyIdentifier;
|
||||
this.date = date;
|
||||
this.other = other;
|
||||
}
|
||||
|
||||
public RecipientKeyIdentifier(
|
||||
byte[] subjectKeyIdentifier)
|
||||
: this(subjectKeyIdentifier, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public RecipientKeyIdentifier(
|
||||
byte[] subjectKeyIdentifier,
|
||||
Asn1GeneralizedTime date,
|
||||
OtherKeyAttribute other)
|
||||
{
|
||||
this.subjectKeyIdentifier = new DerOctetString(subjectKeyIdentifier);
|
||||
this.date = date;
|
||||
this.other = other;
|
||||
}
|
||||
|
||||
public RecipientKeyIdentifier(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
subjectKeyIdentifier = Asn1OctetString.GetInstance(
|
||||
seq[0]);
|
||||
|
||||
switch(seq.Count)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
if (seq[1] is Asn1GeneralizedTime)
|
||||
{
|
||||
date = (Asn1GeneralizedTime)seq[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
other = OtherKeyAttribute.GetInstance(seq[2]);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
date = (Asn1GeneralizedTime)seq[1];
|
||||
other = OtherKeyAttribute.GetInstance(seq[2]);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid RecipientKeyIdentifier");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return a RecipientKeyIdentifier object from a tagged object.
|
||||
*
|
||||
* @param _ato the tagged object holding the object we want.
|
||||
* @param _explicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @exception ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static RecipientKeyIdentifier GetInstance(
|
||||
Asn1TaggedObject ato,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(ato, explicitly));
|
||||
}
|
||||
|
||||
/**
|
||||
* return a RecipientKeyIdentifier object from the given object.
|
||||
*
|
||||
* @param _obj the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static RecipientKeyIdentifier GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is RecipientKeyIdentifier)
|
||||
return (RecipientKeyIdentifier) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new RecipientKeyIdentifier((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("Invalid RecipientKeyIdentifier: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public Asn1OctetString SubjectKeyIdentifier
|
||||
{
|
||||
get { return subjectKeyIdentifier; }
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime Date
|
||||
{
|
||||
get { return date; }
|
||||
}
|
||||
|
||||
public OtherKeyAttribute OtherKeyAttribute
|
||||
{
|
||||
get { return other; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* RecipientKeyIdentifier ::= Sequence {
|
||||
* subjectKeyIdentifier SubjectKeyIdentifier,
|
||||
* date GeneralizedTime OPTIONAL,
|
||||
* other OtherKeyAttribute OPTIONAL
|
||||
* }
|
||||
*
|
||||
* SubjectKeyIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(subjectKeyIdentifier);
|
||||
v.AddOptional(date, other);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f98189ae4c7921f4b89e1df99adbea78
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
75
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SCVPReqRes.cs
vendored
Normal file
75
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SCVPReqRes.cs
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class ScvpReqRes
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly ContentInfo request;
|
||||
private readonly ContentInfo response;
|
||||
|
||||
public static ScvpReqRes GetInstance(object obj)
|
||||
{
|
||||
if (obj is ScvpReqRes)
|
||||
return (ScvpReqRes)obj;
|
||||
if (obj != null)
|
||||
return new ScvpReqRes(Asn1Sequence.GetInstance(obj));
|
||||
return null;
|
||||
}
|
||||
|
||||
private ScvpReqRes(Asn1Sequence seq)
|
||||
{
|
||||
if (seq[0] is Asn1TaggedObject)
|
||||
{
|
||||
this.request = ContentInfo.GetInstance(Asn1TaggedObject.GetInstance(seq[0]), true);
|
||||
this.response = ContentInfo.GetInstance(seq[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.request = null;
|
||||
this.response = ContentInfo.GetInstance(seq[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public ScvpReqRes(ContentInfo response)
|
||||
: this(null, response)
|
||||
{
|
||||
}
|
||||
|
||||
public ScvpReqRes(ContentInfo request, ContentInfo response)
|
||||
{
|
||||
this.request = request;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
public virtual ContentInfo Request
|
||||
{
|
||||
get { return request; }
|
||||
}
|
||||
|
||||
public virtual ContentInfo Response
|
||||
{
|
||||
get { return response; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* ScvpReqRes ::= SEQUENCE {
|
||||
* request [0] EXPLICIT ContentInfo OPTIONAL,
|
||||
* response ContentInfo }
|
||||
* </pre>
|
||||
* @return the ASN.1 primitive representation.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(true, 0, request);
|
||||
v.Add(response);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SCVPReqRes.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SCVPReqRes.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 30933c482b046e147af52fff411761cf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
281
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedData.cs
vendored
Normal file
281
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedData.cs
vendored
Normal file
@@ -0,0 +1,281 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* a signed data object.
|
||||
*/
|
||||
public class SignedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static readonly DerInteger Version1 = new DerInteger(1);
|
||||
private static readonly DerInteger Version3 = new DerInteger(3);
|
||||
private static readonly DerInteger Version4 = new DerInteger(4);
|
||||
private static readonly DerInteger Version5 = new DerInteger(5);
|
||||
|
||||
private readonly DerInteger version;
|
||||
private readonly Asn1Set digestAlgorithms;
|
||||
private readonly ContentInfo contentInfo;
|
||||
private readonly Asn1Set certificates;
|
||||
private readonly Asn1Set crls;
|
||||
private readonly Asn1Set signerInfos;
|
||||
private readonly bool certsBer;
|
||||
private readonly bool crlsBer;
|
||||
|
||||
public static SignedData GetInstance(object obj)
|
||||
{
|
||||
if (obj is SignedData)
|
||||
return (SignedData)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new SignedData(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public SignedData(
|
||||
Asn1Set digestAlgorithms,
|
||||
ContentInfo contentInfo,
|
||||
Asn1Set certificates,
|
||||
Asn1Set crls,
|
||||
Asn1Set signerInfos)
|
||||
{
|
||||
this.version = CalculateVersion(contentInfo.ContentType, certificates, crls, signerInfos);
|
||||
this.digestAlgorithms = digestAlgorithms;
|
||||
this.contentInfo = contentInfo;
|
||||
this.certificates = certificates;
|
||||
this.crls = crls;
|
||||
this.signerInfos = signerInfos;
|
||||
this.crlsBer = crls is BerSet;
|
||||
this.certsBer = certificates is BerSet;
|
||||
}
|
||||
|
||||
// RFC3852, section 5.1:
|
||||
// IF ((certificates is present) AND
|
||||
// (any certificates with a type of other are present)) OR
|
||||
// ((crls is present) AND
|
||||
// (any crls with a type of other are present))
|
||||
// THEN version MUST be 5
|
||||
// ELSE
|
||||
// IF (certificates is present) AND
|
||||
// (any version 2 attribute certificates are present)
|
||||
// THEN version MUST be 4
|
||||
// ELSE
|
||||
// IF ((certificates is present) AND
|
||||
// (any version 1 attribute certificates are present)) OR
|
||||
// (any SignerInfo structures are version 3) OR
|
||||
// (encapContentInfo eContentType is other than id-data)
|
||||
// THEN version MUST be 3
|
||||
// ELSE version MUST be 1
|
||||
//
|
||||
private DerInteger CalculateVersion(
|
||||
DerObjectIdentifier contentOid,
|
||||
Asn1Set certs,
|
||||
Asn1Set crls,
|
||||
Asn1Set signerInfs)
|
||||
{
|
||||
bool otherCert = false;
|
||||
bool otherCrl = false;
|
||||
bool attrCertV1Found = false;
|
||||
bool attrCertV2Found = false;
|
||||
|
||||
if (certs != null)
|
||||
{
|
||||
foreach (object obj in certs)
|
||||
{
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject tagged = (Asn1TaggedObject)obj;
|
||||
|
||||
if (tagged.TagNo == 1)
|
||||
{
|
||||
attrCertV1Found = true;
|
||||
}
|
||||
else if (tagged.TagNo == 2)
|
||||
{
|
||||
attrCertV2Found = true;
|
||||
}
|
||||
else if (tagged.TagNo == 3)
|
||||
{
|
||||
otherCert = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (otherCert)
|
||||
{
|
||||
return Version5;
|
||||
}
|
||||
|
||||
if (crls != null)
|
||||
{
|
||||
foreach (object obj in crls)
|
||||
{
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
otherCrl = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (otherCrl)
|
||||
{
|
||||
return Version5;
|
||||
}
|
||||
|
||||
if (attrCertV2Found)
|
||||
{
|
||||
return Version4;
|
||||
}
|
||||
|
||||
if (attrCertV1Found || !CmsObjectIdentifiers.Data.Equals(contentOid) || CheckForVersion3(signerInfs))
|
||||
{
|
||||
return Version3;
|
||||
}
|
||||
|
||||
return Version1;
|
||||
}
|
||||
|
||||
private bool CheckForVersion3(Asn1Set signerInfs)
|
||||
{
|
||||
foreach (object obj in signerInfs)
|
||||
{
|
||||
SignerInfo s = SignerInfo.GetInstance(obj);
|
||||
|
||||
if (s.Version.HasValue(3))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private SignedData(Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
e.MoveNext();
|
||||
version = (DerInteger)e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
digestAlgorithms = (Asn1Set)e.Current.ToAsn1Object();
|
||||
|
||||
e.MoveNext();
|
||||
contentInfo = ContentInfo.GetInstance(e.Current.ToAsn1Object());
|
||||
|
||||
while (e.MoveNext())
|
||||
{
|
||||
Asn1Object o = e.Current.ToAsn1Object();
|
||||
|
||||
//
|
||||
// an interesting feature of SignedData is that there appear
|
||||
// to be varying implementations...
|
||||
// for the moment we ignore anything which doesn't fit.
|
||||
//
|
||||
if (o is Asn1TaggedObject tagged)
|
||||
{
|
||||
switch (tagged.TagNo)
|
||||
{
|
||||
case 0:
|
||||
certsBer = tagged is BerTaggedObject;
|
||||
certificates = Asn1Set.GetInstance(tagged, false);
|
||||
break;
|
||||
case 1:
|
||||
crlsBer = tagged is BerTaggedObject;
|
||||
crls = Asn1Set.GetInstance(tagged, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag value " + tagged.TagNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
signerInfos = (Asn1Set) o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public Asn1Set DigestAlgorithms
|
||||
{
|
||||
get { return digestAlgorithms; }
|
||||
}
|
||||
|
||||
public ContentInfo EncapContentInfo
|
||||
{
|
||||
get { return contentInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set Certificates
|
||||
{
|
||||
get { return certificates; }
|
||||
}
|
||||
|
||||
public Asn1Set CRLs
|
||||
{
|
||||
get { return crls; }
|
||||
}
|
||||
|
||||
public Asn1Set SignerInfos
|
||||
{
|
||||
get { return signerInfos; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SignedData ::= Sequence {
|
||||
* version CMSVersion,
|
||||
* digestAlgorithms DigestAlgorithmIdentifiers,
|
||||
* encapContentInfo EncapsulatedContentInfo,
|
||||
* certificates [0] IMPLICIT CertificateSet OPTIONAL,
|
||||
* crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
|
||||
* signerInfos SignerInfos
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(
|
||||
version, digestAlgorithms, contentInfo);
|
||||
|
||||
if (certificates != null)
|
||||
{
|
||||
if (certsBer)
|
||||
{
|
||||
v.Add(new BerTaggedObject(false, 0, certificates));
|
||||
}
|
||||
else
|
||||
{
|
||||
v.Add(new DerTaggedObject(false, 0, certificates));
|
||||
}
|
||||
}
|
||||
|
||||
if (crls != null)
|
||||
{
|
||||
if (crlsBer)
|
||||
{
|
||||
v.Add(new BerTaggedObject(false, 1, crls));
|
||||
}
|
||||
else
|
||||
{
|
||||
v.Add(new DerTaggedObject(false, 1, crls));
|
||||
}
|
||||
}
|
||||
|
||||
v.Add(signerInfos);
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c423f66ca24d1c4ba73c7e43140f576
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
122
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedDataParser.cs
vendored
Normal file
122
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedDataParser.cs
vendored
Normal file
@@ -0,0 +1,122 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
/**
|
||||
* <pre>
|
||||
* SignedData ::= SEQUENCE {
|
||||
* version CMSVersion,
|
||||
* digestAlgorithms DigestAlgorithmIdentifiers,
|
||||
* encapContentInfo EncapsulatedContentInfo,
|
||||
* certificates [0] IMPLICIT CertificateSet OPTIONAL,
|
||||
* crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
|
||||
* signerInfos SignerInfos
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class SignedDataParser
|
||||
{
|
||||
private Asn1SequenceParser _seq;
|
||||
private DerInteger _version;
|
||||
private object _nextObject;
|
||||
private bool _certsCalled;
|
||||
private bool _crlsCalled;
|
||||
|
||||
public static SignedDataParser GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o is Asn1Sequence)
|
||||
return new SignedDataParser(((Asn1Sequence)o).Parser);
|
||||
|
||||
if (o is Asn1SequenceParser)
|
||||
return new SignedDataParser((Asn1SequenceParser)o);
|
||||
|
||||
throw new IOException("unknown object encountered: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(o));
|
||||
}
|
||||
|
||||
public SignedDataParser(
|
||||
Asn1SequenceParser seq)
|
||||
{
|
||||
this._seq = seq;
|
||||
this._version = (DerInteger)seq.ReadObject();
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return _version; }
|
||||
}
|
||||
|
||||
public Asn1SetParser GetDigestAlgorithms()
|
||||
{
|
||||
return (Asn1SetParser)_seq.ReadObject();
|
||||
}
|
||||
|
||||
public ContentInfoParser GetEncapContentInfo()
|
||||
{
|
||||
return new ContentInfoParser((Asn1SequenceParser)_seq.ReadObject());
|
||||
}
|
||||
|
||||
public Asn1SetParser GetCertificates()
|
||||
{
|
||||
_certsCalled = true;
|
||||
_nextObject = _seq.ReadObject();
|
||||
|
||||
if (_nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
if (o.HasContextTag(0))
|
||||
{
|
||||
Asn1SetParser certs = (Asn1SetParser)o.ParseBaseUniversal(false, Asn1Tags.SetOf);
|
||||
_nextObject = null;
|
||||
return certs;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetCrls()
|
||||
{
|
||||
if (!_certsCalled)
|
||||
throw new IOException("GetCerts() has not been called.");
|
||||
|
||||
_crlsCalled = true;
|
||||
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
if (_nextObject is Asn1TaggedObjectParser o)
|
||||
{
|
||||
if (o.HasContextTag(1))
|
||||
{
|
||||
Asn1SetParser crls = (Asn1SetParser)o.ParseBaseUniversal(false, Asn1Tags.SetOf);
|
||||
_nextObject = null;
|
||||
return crls;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Asn1SetParser GetSignerInfos()
|
||||
{
|
||||
if (!_certsCalled || !_crlsCalled)
|
||||
throw new IOException("GetCerts() and/or GetCrls() has not been called.");
|
||||
|
||||
if (_nextObject == null)
|
||||
{
|
||||
_nextObject = _seq.ReadObject();
|
||||
}
|
||||
|
||||
return (Asn1SetParser)_nextObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedDataParser.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignedDataParser.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 05e7b42e6f58b8241b76bd70edc648ee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerIdentifier.cs
vendored
Normal file
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerIdentifier.cs
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class SignerIdentifier
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
private Asn1Encodable id;
|
||||
|
||||
public SignerIdentifier(
|
||||
IssuerAndSerialNumber id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public SignerIdentifier(
|
||||
Asn1OctetString id)
|
||||
{
|
||||
this.id = new DerTaggedObject(false, 0, id);
|
||||
}
|
||||
|
||||
public SignerIdentifier(
|
||||
Asn1Object id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* return a SignerIdentifier object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static SignerIdentifier GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is SignerIdentifier)
|
||||
return (SignerIdentifier) o;
|
||||
|
||||
if (o is IssuerAndSerialNumber)
|
||||
return new SignerIdentifier((IssuerAndSerialNumber) o);
|
||||
|
||||
if (o is Asn1OctetString)
|
||||
return new SignerIdentifier((Asn1OctetString) o);
|
||||
|
||||
if (o is Asn1Object)
|
||||
return new SignerIdentifier((Asn1Object) o);
|
||||
|
||||
throw new ArgumentException(
|
||||
"Illegal object in SignerIdentifier: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(o));
|
||||
}
|
||||
|
||||
public bool IsTagged
|
||||
{
|
||||
get { return (id is Asn1TaggedObject); }
|
||||
}
|
||||
|
||||
public Asn1Encodable ID
|
||||
{
|
||||
get
|
||||
{
|
||||
if (id is Asn1TaggedObject)
|
||||
{
|
||||
return Asn1OctetString.GetInstance((Asn1TaggedObject)id, false);
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SignerIdentifier ::= CHOICE {
|
||||
* issuerAndSerialNumber IssuerAndSerialNumber,
|
||||
* subjectKeyIdentifier [0] SubjectKeyIdentifier
|
||||
* }
|
||||
*
|
||||
* SubjectKeyIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return id.ToAsn1Object();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerIdentifier.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerIdentifier.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5831edaa0fffd8c49b6b6954d736ca02
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
174
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerInfo.cs
vendored
Normal file
174
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerInfo.cs
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class SignerInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private SignerIdentifier sid;
|
||||
private AlgorithmIdentifier digAlgorithm;
|
||||
private Asn1Set authenticatedAttributes;
|
||||
private AlgorithmIdentifier digEncryptionAlgorithm;
|
||||
private Asn1OctetString encryptedDigest;
|
||||
private Asn1Set unauthenticatedAttributes;
|
||||
|
||||
public static SignerInfo GetInstance(object obj)
|
||||
{
|
||||
if (obj == null || obj is SignerInfo)
|
||||
return (SignerInfo) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new SignerInfo((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public SignerInfo(
|
||||
SignerIdentifier sid,
|
||||
AlgorithmIdentifier digAlgorithm,
|
||||
Asn1Set authenticatedAttributes,
|
||||
AlgorithmIdentifier digEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedDigest,
|
||||
Asn1Set unauthenticatedAttributes)
|
||||
{
|
||||
this.version = new DerInteger(sid.IsTagged ? 3 : 1);
|
||||
this.sid = sid;
|
||||
this.digAlgorithm = digAlgorithm;
|
||||
this.authenticatedAttributes = authenticatedAttributes;
|
||||
this.digEncryptionAlgorithm = digEncryptionAlgorithm;
|
||||
this.encryptedDigest = encryptedDigest;
|
||||
this.unauthenticatedAttributes = unauthenticatedAttributes;
|
||||
}
|
||||
|
||||
public SignerInfo(
|
||||
SignerIdentifier sid,
|
||||
AlgorithmIdentifier digAlgorithm,
|
||||
Attributes authenticatedAttributes,
|
||||
AlgorithmIdentifier digEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedDigest,
|
||||
Attributes unauthenticatedAttributes)
|
||||
{
|
||||
this.version = new DerInteger(sid.IsTagged ? 3 : 1);
|
||||
this.sid = sid;
|
||||
this.digAlgorithm = digAlgorithm;
|
||||
this.authenticatedAttributes = Asn1Set.GetInstance(authenticatedAttributes);
|
||||
this.digEncryptionAlgorithm = digEncryptionAlgorithm;
|
||||
this.encryptedDigest = encryptedDigest;
|
||||
this.unauthenticatedAttributes = Asn1Set.GetInstance(unauthenticatedAttributes);
|
||||
}
|
||||
|
||||
private SignerInfo(Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
e.MoveNext();
|
||||
version = (DerInteger)e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
sid = SignerIdentifier.GetInstance(e.Current.ToAsn1Object());
|
||||
|
||||
e.MoveNext();
|
||||
digAlgorithm = AlgorithmIdentifier.GetInstance(e.Current.ToAsn1Object());
|
||||
|
||||
e.MoveNext();
|
||||
var obj = e.Current.ToAsn1Object();
|
||||
|
||||
if (obj is Asn1TaggedObject tagged)
|
||||
{
|
||||
authenticatedAttributes = Asn1Set.GetInstance(tagged, false);
|
||||
|
||||
e.MoveNext();
|
||||
digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(e.Current.ToAsn1Object());
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticatedAttributes = null;
|
||||
digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(obj);
|
||||
}
|
||||
|
||||
e.MoveNext();
|
||||
encryptedDigest = Asn1OctetString.GetInstance(e.Current.ToAsn1Object());
|
||||
|
||||
if (e.MoveNext())
|
||||
{
|
||||
unauthenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject)e.Current.ToAsn1Object(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
unauthenticatedAttributes = null;
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public SignerIdentifier SignerID
|
||||
{
|
||||
get { return sid; }
|
||||
}
|
||||
|
||||
public Asn1Set AuthenticatedAttributes
|
||||
{
|
||||
get { return authenticatedAttributes; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier DigestAlgorithm
|
||||
{
|
||||
get { return digAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1OctetString EncryptedDigest
|
||||
{
|
||||
get { return encryptedDigest; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier DigestEncryptionAlgorithm
|
||||
{
|
||||
get { return digEncryptionAlgorithm; }
|
||||
}
|
||||
|
||||
public Asn1Set UnauthenticatedAttributes
|
||||
{
|
||||
get { return unauthenticatedAttributes; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SignerInfo ::= Sequence {
|
||||
* version Version,
|
||||
* SignerIdentifier sid,
|
||||
* digestAlgorithm DigestAlgorithmIdentifier,
|
||||
* authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
|
||||
* digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
|
||||
* encryptedDigest EncryptedDigest,
|
||||
* unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
|
||||
* }
|
||||
*
|
||||
* EncryptedDigest ::= OCTET STRING
|
||||
*
|
||||
* DigestAlgorithmIdentifier ::= AlgorithmIdentifier
|
||||
*
|
||||
* DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, sid, digAlgorithm);
|
||||
v.AddOptionalTagged(false, 0, authenticatedAttributes);
|
||||
v.Add(digEncryptionAlgorithm, encryptedDigest);
|
||||
v.AddOptionalTagged(false, 1, unauthenticatedAttributes);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/SignerInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 45efbcfcd327360458fa1d300c0cb7a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
114
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Time.cs
vendored
Normal file
114
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Time.cs
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class Time
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
public static Time GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
if (obj is Time time)
|
||||
return time;
|
||||
if (obj is Asn1UtcTime utcTime)
|
||||
return new Time(utcTime);
|
||||
if (obj is Asn1GeneralizedTime generalizedTime)
|
||||
return new Time(generalizedTime);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), nameof(obj));
|
||||
}
|
||||
|
||||
public static Time GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
|
||||
{
|
||||
return GetInstance(taggedObject.GetObject());
|
||||
}
|
||||
|
||||
private readonly Asn1Object m_timeObject;
|
||||
|
||||
public Time(Asn1GeneralizedTime generalizedTime)
|
||||
{
|
||||
this.m_timeObject = generalizedTime ?? throw new ArgumentNullException(nameof(generalizedTime));
|
||||
}
|
||||
|
||||
public Time(Asn1UtcTime utcTime)
|
||||
{
|
||||
if (utcTime == null)
|
||||
throw new ArgumentNullException(nameof(utcTime));
|
||||
|
||||
// Validate utcTime is in the appropriate year range
|
||||
utcTime.ToDateTime(2049);
|
||||
|
||||
this.m_timeObject = utcTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* creates a time object from a given date - if the date is between 1950
|
||||
* and 2049 a UTCTime object is Generated, otherwise a GeneralizedTime
|
||||
* is used.
|
||||
*/
|
||||
public Time(DateTime date)
|
||||
{
|
||||
DateTime utc = date.ToUniversalTime();
|
||||
|
||||
if (utc.Year < 1950 || utc.Year > 2049)
|
||||
{
|
||||
m_timeObject = new DerGeneralizedTime(utc);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_timeObject = new DerUtcTime(utc, 2049);
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime ToDateTime()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (m_timeObject is Asn1UtcTime utcTime)
|
||||
return utcTime.ToDateTime(2049);
|
||||
|
||||
return ((Asn1GeneralizedTime)m_timeObject).ToDateTime();
|
||||
}
|
||||
catch (FormatException e)
|
||||
{
|
||||
// this should never happen
|
||||
throw new InvalidOperationException("invalid date string: " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public DateTime Date => ToDateTime();
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* Time ::= CHOICE {
|
||||
* utcTime UTCTime,
|
||||
* generalTime GeneralizedTime }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return m_timeObject;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (m_timeObject is Asn1UtcTime utcTime)
|
||||
return utcTime.ToDateTime(2049).ToString(@"yyyyMMddHHmmssK", DateTimeFormatInfo.InvariantInfo);
|
||||
|
||||
if (m_timeObject is Asn1GeneralizedTime generalizedTime)
|
||||
return generalizedTime.ToDateTime().ToString(@"yyyyMMddHHmmss.FFFFFFFK", DateTimeFormatInfo.InvariantInfo);
|
||||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Time.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/Time.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb973623f792e0f409b05930fa72b8d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
66
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampAndCRL.cs
vendored
Normal file
66
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampAndCRL.cs
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class TimeStampAndCrl
|
||||
: Asn1Encodable
|
||||
{
|
||||
private ContentInfo timeStamp;
|
||||
private X509.CertificateList crl;
|
||||
|
||||
public TimeStampAndCrl(ContentInfo timeStamp)
|
||||
{
|
||||
this.timeStamp = timeStamp;
|
||||
}
|
||||
|
||||
private TimeStampAndCrl(Asn1Sequence seq)
|
||||
{
|
||||
this.timeStamp = ContentInfo.GetInstance(seq[0]);
|
||||
if (seq.Count == 2)
|
||||
{
|
||||
this.crl = X509.CertificateList.GetInstance(seq[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeStampAndCrl GetInstance(object obj)
|
||||
{
|
||||
if (obj is TimeStampAndCrl)
|
||||
return (TimeStampAndCrl)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new TimeStampAndCrl(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual ContentInfo TimeStampToken
|
||||
{
|
||||
get { return this.timeStamp; }
|
||||
}
|
||||
|
||||
public virtual X509.CertificateList Crl
|
||||
{
|
||||
get { return this.crl; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* TimeStampAndCRL ::= SEQUENCE {
|
||||
* timeStamp TimeStampToken, -- according to RFC 3161
|
||||
* crl CertificateList OPTIONAL -- according to RFC 5280
|
||||
* }
|
||||
* </pre>
|
||||
* @return
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(timeStamp);
|
||||
v.AddOptional(crl);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampAndCRL.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampAndCRL.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f4dcd32502de784a9926445d3380301
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
69
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampTokenEvidence.cs
vendored
Normal file
69
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampTokenEvidence.cs
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class TimeStampTokenEvidence
|
||||
: Asn1Encodable
|
||||
{
|
||||
private TimeStampAndCrl[] timeStampAndCrls;
|
||||
|
||||
public TimeStampTokenEvidence(TimeStampAndCrl[] timeStampAndCrls)
|
||||
{
|
||||
this.timeStampAndCrls = timeStampAndCrls;
|
||||
}
|
||||
|
||||
public TimeStampTokenEvidence(TimeStampAndCrl timeStampAndCrl)
|
||||
{
|
||||
this.timeStampAndCrls = new TimeStampAndCrl[]{ timeStampAndCrl };
|
||||
}
|
||||
|
||||
private TimeStampTokenEvidence(Asn1Sequence seq)
|
||||
{
|
||||
this.timeStampAndCrls = new TimeStampAndCrl[seq.Count];
|
||||
|
||||
int count = 0;
|
||||
|
||||
foreach (Asn1Encodable ae in seq)
|
||||
{
|
||||
this.timeStampAndCrls[count++] = TimeStampAndCrl.GetInstance(ae.ToAsn1Object());
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeStampTokenEvidence GetInstance(Asn1TaggedObject tagged, bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(tagged, isExplicit));
|
||||
}
|
||||
|
||||
public static TimeStampTokenEvidence GetInstance(object obj)
|
||||
{
|
||||
if (obj is TimeStampTokenEvidence)
|
||||
return (TimeStampTokenEvidence)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new TimeStampTokenEvidence(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual TimeStampAndCrl[] ToTimeStampAndCrlArray()
|
||||
{
|
||||
return (TimeStampAndCrl[])timeStampAndCrls.Clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* TimeStampTokenEvidence ::=
|
||||
* SEQUENCE SIZE(1..MAX) OF TimeStampAndCrl
|
||||
* </pre>
|
||||
* @return
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(timeStampAndCrls);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9677d88eeedf9374597fdb1722202d99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
99
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedData.cs
vendored
Normal file
99
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedData.cs
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class TimeStampedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private DerIA5String dataUri;
|
||||
private MetaData metaData;
|
||||
private Asn1OctetString content;
|
||||
private Evidence temporalEvidence;
|
||||
|
||||
public TimeStampedData(DerIA5String dataUri, MetaData metaData, Asn1OctetString content,
|
||||
Evidence temporalEvidence)
|
||||
{
|
||||
this.version = new DerInteger(1);
|
||||
this.dataUri = dataUri;
|
||||
this.metaData = metaData;
|
||||
this.content = content;
|
||||
this.temporalEvidence = temporalEvidence;
|
||||
}
|
||||
|
||||
private TimeStampedData(Asn1Sequence seq)
|
||||
{
|
||||
this.version = DerInteger.GetInstance(seq[0]);
|
||||
|
||||
int index = 1;
|
||||
if (seq[index] is DerIA5String)
|
||||
{
|
||||
this.dataUri = DerIA5String.GetInstance(seq[index++]);
|
||||
}
|
||||
if (seq[index] is MetaData || seq[index] is Asn1Sequence)
|
||||
{
|
||||
this.metaData = MetaData.GetInstance(seq[index++]);
|
||||
}
|
||||
if (seq[index] is Asn1OctetString)
|
||||
{
|
||||
this.content = Asn1OctetString.GetInstance(seq[index++]);
|
||||
}
|
||||
this.temporalEvidence = Evidence.GetInstance(seq[index]);
|
||||
}
|
||||
|
||||
public static TimeStampedData GetInstance(object obj)
|
||||
{
|
||||
if (obj is TimeStampedData)
|
||||
return (TimeStampedData)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new TimeStampedData(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual DerIA5String DataUri
|
||||
{
|
||||
get { return dataUri; }
|
||||
}
|
||||
|
||||
public MetaData MetaData
|
||||
{
|
||||
get { return metaData; }
|
||||
}
|
||||
|
||||
public Asn1OctetString Content
|
||||
{
|
||||
get { return content; }
|
||||
}
|
||||
|
||||
public Evidence TemporalEvidence
|
||||
{
|
||||
get { return temporalEvidence; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* TimeStampedData ::= SEQUENCE {
|
||||
* version INTEGER { v1(1) },
|
||||
* dataUri IA5String OPTIONAL,
|
||||
* metaData MetaData OPTIONAL,
|
||||
* content OCTET STRING OPTIONAL,
|
||||
* temporalEvidence Evidence
|
||||
* }
|
||||
* </pre>
|
||||
* @return
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version);
|
||||
v.AddOptional(dataUri, metaData, content);
|
||||
v.Add(temporalEvidence);
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44dbb40e9540e9a43828dba5a0dedd98
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
80
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedDataParser.cs
vendored
Normal file
80
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/TimeStampedDataParser.cs
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
|
||||
{
|
||||
public class TimeStampedDataParser
|
||||
{
|
||||
private DerInteger version;
|
||||
private DerIA5String dataUri;
|
||||
private MetaData metaData;
|
||||
private Asn1OctetStringParser content;
|
||||
private Evidence temporalEvidence;
|
||||
private Asn1SequenceParser parser;
|
||||
|
||||
private TimeStampedDataParser(Asn1SequenceParser parser)
|
||||
{
|
||||
this.parser = parser;
|
||||
this.version = DerInteger.GetInstance(parser.ReadObject());
|
||||
|
||||
Asn1Object obj = parser.ReadObject().ToAsn1Object();
|
||||
|
||||
if (obj is DerIA5String)
|
||||
{
|
||||
this.dataUri = DerIA5String.GetInstance(obj);
|
||||
obj = parser.ReadObject().ToAsn1Object();
|
||||
}
|
||||
|
||||
if (//obj is MetaData ||
|
||||
obj is Asn1SequenceParser)
|
||||
{
|
||||
this.metaData = MetaData.GetInstance(obj.ToAsn1Object());
|
||||
obj = parser.ReadObject().ToAsn1Object();
|
||||
}
|
||||
|
||||
if (obj is Asn1OctetStringParser)
|
||||
{
|
||||
this.content = (Asn1OctetStringParser)obj;
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeStampedDataParser GetInstance(object obj)
|
||||
{
|
||||
if (obj is Asn1Sequence)
|
||||
return new TimeStampedDataParser(((Asn1Sequence)obj).Parser);
|
||||
|
||||
if (obj is Asn1SequenceParser)
|
||||
return new TimeStampedDataParser((Asn1SequenceParser)obj);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual DerIA5String DataUri
|
||||
{
|
||||
get { return dataUri; }
|
||||
}
|
||||
|
||||
public virtual MetaData MetaData
|
||||
{
|
||||
get { return metaData; }
|
||||
}
|
||||
|
||||
public virtual Asn1OctetStringParser Content
|
||||
{
|
||||
get { return content; }
|
||||
}
|
||||
|
||||
public virtual Evidence GetTemporalEvidence()
|
||||
{
|
||||
if (temporalEvidence == null)
|
||||
{
|
||||
temporalEvidence = Evidence.GetInstance(parser.ReadObject().ToAsn1Object());
|
||||
}
|
||||
|
||||
return temporalEvidence;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11ea87c7cb447c647ab686bb9dd0deda
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ecc.meta
vendored
Normal file
8
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ecc.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ddfa1d4dfe54044448daca0f58ec039a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
104
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ecc/MQVuserKeyingMaterial.cs
vendored
Normal file
104
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cms/ecc/MQVuserKeyingMaterial.cs
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.Ecc
|
||||
{
|
||||
public class MQVuserKeyingMaterial
|
||||
: Asn1Encodable
|
||||
{
|
||||
private OriginatorPublicKey ephemeralPublicKey;
|
||||
private Asn1OctetString addedukm;
|
||||
|
||||
public MQVuserKeyingMaterial(
|
||||
OriginatorPublicKey ephemeralPublicKey,
|
||||
Asn1OctetString addedukm)
|
||||
{
|
||||
// TODO Check ephemeralPublicKey not null
|
||||
|
||||
this.ephemeralPublicKey = ephemeralPublicKey;
|
||||
this.addedukm = addedukm;
|
||||
}
|
||||
|
||||
private MQVuserKeyingMaterial(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
// TODO Check seq has either 1 or 2 elements
|
||||
|
||||
this.ephemeralPublicKey = OriginatorPublicKey.GetInstance(seq[0]);
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
this.addedukm = Asn1OctetString.GetInstance(
|
||||
(Asn1TaggedObject)seq[1], true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthEnvelopedData object from a tagged object.
|
||||
*
|
||||
* @param obj the tagged object holding the object we want.
|
||||
* @param isExplicit true if the object is meant to be explicitly
|
||||
* tagged false otherwise.
|
||||
* @throws ArgumentException if the object held by the
|
||||
* tagged object cannot be converted.
|
||||
*/
|
||||
public static MQVuserKeyingMaterial GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* return an AuthEnvelopedData object from the given object.
|
||||
*
|
||||
* @param obj the object we want converted.
|
||||
* @throws ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static MQVuserKeyingMaterial GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is MQVuserKeyingMaterial)
|
||||
{
|
||||
return (MQVuserKeyingMaterial)obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new MQVuserKeyingMaterial((Asn1Sequence)obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid MQVuserKeyingMaterial: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public OriginatorPublicKey EphemeralPublicKey
|
||||
{
|
||||
get { return ephemeralPublicKey; }
|
||||
}
|
||||
|
||||
public Asn1OctetString AddedUkm
|
||||
{
|
||||
get { return addedukm; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* MQVuserKeyingMaterial ::= SEQUENCE {
|
||||
* ephemeralPublicKey OriginatorPublicKey,
|
||||
* addedukm [0] EXPLICIT UserKeyingMaterial OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(ephemeralPublicKey);
|
||||
v.AddOptionalTagged(true, 0, addedukm);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ca994732aac101b46a2c4018dbb9a9b0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user