- Initial commit
This commit is contained in:
89
Runtime/3rdParty/BouncyCastle/asn1/x509/AccessDescription.cs
vendored
Normal file
89
Runtime/3rdParty/BouncyCastle/asn1/x509/AccessDescription.cs
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* The AccessDescription object.
|
||||
* <pre>
|
||||
* AccessDescription ::= SEQUENCE {
|
||||
* accessMethod OBJECT IDENTIFIER,
|
||||
* accessLocation GeneralName }
|
||||
* </pre>
|
||||
*/
|
||||
public class AccessDescription
|
||||
: Asn1Encodable
|
||||
{
|
||||
public readonly static DerObjectIdentifier IdADCAIssuers = new DerObjectIdentifier("1.3.6.1.5.5.7.48.2");
|
||||
public readonly static DerObjectIdentifier IdADOcsp = new DerObjectIdentifier("1.3.6.1.5.5.7.48.1");
|
||||
|
||||
private readonly DerObjectIdentifier accessMethod;
|
||||
private readonly GeneralName accessLocation;
|
||||
|
||||
public static AccessDescription GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is AccessDescription)
|
||||
return (AccessDescription) obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new AccessDescription((Asn1Sequence) obj);
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private AccessDescription(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("wrong number of elements in sequence");
|
||||
|
||||
accessMethod = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
accessLocation = GeneralName.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AccessDescription with the oid and location provided.
|
||||
*/
|
||||
public AccessDescription(
|
||||
DerObjectIdentifier oid,
|
||||
GeneralName location)
|
||||
{
|
||||
accessMethod = oid;
|
||||
accessLocation = location;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the access method.
|
||||
*/
|
||||
public DerObjectIdentifier AccessMethod
|
||||
{
|
||||
get { return accessMethod; }
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return the access location
|
||||
*/
|
||||
public GeneralName AccessLocation
|
||||
{
|
||||
get { return accessLocation; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(accessMethod, accessLocation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "AccessDescription: Oid(" + this.accessMethod.Id + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AccessDescription.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AccessDescription.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fc6b1bce31c4b74183cccf0528a1e92
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AccessDescription.cs
|
||||
uploadId: 783279
|
||||
87
Runtime/3rdParty/BouncyCastle/asn1/x509/AlgorithmIdentifier.cs
vendored
Normal file
87
Runtime/3rdParty/BouncyCastle/asn1/x509/AlgorithmIdentifier.cs
vendored
Normal file
@ -0,0 +1,87 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class AlgorithmIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier algorithm;
|
||||
private readonly Asn1Encodable parameters;
|
||||
|
||||
public static AlgorithmIdentifier GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static AlgorithmIdentifier GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
if (obj is AlgorithmIdentifier)
|
||||
return (AlgorithmIdentifier)obj;
|
||||
return new AlgorithmIdentifier(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier(
|
||||
DerObjectIdentifier algorithm)
|
||||
{
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier(
|
||||
DerObjectIdentifier algorithm,
|
||||
Asn1Encodable parameters)
|
||||
{
|
||||
this.algorithm = algorithm;
|
||||
this.parameters = parameters;
|
||||
}
|
||||
|
||||
internal AlgorithmIdentifier(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
this.algorithm = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
this.parameters = seq.Count < 2 ? null : seq[1];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the OID in the Algorithm entry of this identifier.
|
||||
/// </summary>
|
||||
public virtual DerObjectIdentifier Algorithm
|
||||
{
|
||||
get { return algorithm; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the parameters structure in the Parameters entry of this identifier.
|
||||
/// </summary>
|
||||
public virtual Asn1Encodable Parameters
|
||||
{
|
||||
get { return parameters; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AlgorithmIdentifier ::= Sequence {
|
||||
* algorithm OBJECT IDENTIFIER,
|
||||
* parameters ANY DEFINED BY algorithm OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(algorithm);
|
||||
v.AddOptional(parameters);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AlgorithmIdentifier.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AlgorithmIdentifier.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74d1f42dee5b53647bd71386bdbc95b5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AlgorithmIdentifier.cs
|
||||
uploadId: 783279
|
||||
90
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertIssuer.cs
vendored
Normal file
90
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertIssuer.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.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class AttCertIssuer
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
internal readonly Asn1Encodable obj;
|
||||
internal readonly Asn1Object choiceObj;
|
||||
|
||||
public static AttCertIssuer GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is AttCertIssuer)
|
||||
{
|
||||
return (AttCertIssuer)obj;
|
||||
}
|
||||
else if (obj is V2Form)
|
||||
{
|
||||
return new AttCertIssuer(V2Form.GetInstance(obj));
|
||||
}
|
||||
else if (obj is GeneralNames)
|
||||
{
|
||||
return new AttCertIssuer((GeneralNames)obj);
|
||||
}
|
||||
else if (obj is Asn1TaggedObject)
|
||||
{
|
||||
return new AttCertIssuer(V2Form.GetInstance((Asn1TaggedObject)obj, false));
|
||||
}
|
||||
else if (obj is Asn1Sequence)
|
||||
{
|
||||
return new AttCertIssuer(GeneralNames.GetInstance(obj));
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static AttCertIssuer GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(obj.GetObject()); // must be explictly tagged
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Don't use this one if you are trying to be RFC 3281 compliant.
|
||||
/// Use it for v1 attribute certificates only.
|
||||
/// </summary>
|
||||
/// <param name="names">Our GeneralNames structure</param>
|
||||
public AttCertIssuer(
|
||||
GeneralNames names)
|
||||
{
|
||||
obj = names;
|
||||
choiceObj = obj.ToAsn1Object();
|
||||
}
|
||||
|
||||
public AttCertIssuer(
|
||||
V2Form v2Form)
|
||||
{
|
||||
obj = v2Form;
|
||||
choiceObj = new DerTaggedObject(false, 0, obj);
|
||||
}
|
||||
|
||||
public Asn1Encodable Issuer
|
||||
{
|
||||
get { return obj; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AttCertIssuer ::= CHOICE {
|
||||
* v1Form GeneralNames, -- MUST NOT be used in this
|
||||
* -- profile
|
||||
* v2Form [0] V2Form -- v2 only
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return choiceObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertIssuer.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertIssuer.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24c98319223cbc0488b4a6521e795dc6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertIssuer.cs
|
||||
uploadId: 783279
|
||||
82
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertValidityPeriod.cs
vendored
Normal file
82
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertValidityPeriod.cs
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
#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.X509
|
||||
{
|
||||
public class AttCertValidityPeriod
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1GeneralizedTime notBeforeTime;
|
||||
private readonly Asn1GeneralizedTime notAfterTime;
|
||||
|
||||
public static AttCertValidityPeriod GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is AttCertValidityPeriod || obj == null)
|
||||
{
|
||||
return (AttCertValidityPeriod) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new AttCertValidityPeriod((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static AttCertValidityPeriod GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
private AttCertValidityPeriod(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
notBeforeTime = Asn1GeneralizedTime.GetInstance(seq[0]);
|
||||
notAfterTime = Asn1GeneralizedTime.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public AttCertValidityPeriod(
|
||||
Asn1GeneralizedTime notBeforeTime,
|
||||
Asn1GeneralizedTime notAfterTime)
|
||||
{
|
||||
this.notBeforeTime = notBeforeTime;
|
||||
this.notAfterTime = notAfterTime;
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime NotBeforeTime
|
||||
{
|
||||
get { return notBeforeTime; }
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime NotAfterTime
|
||||
{
|
||||
get { return notAfterTime; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AttCertValidityPeriod ::= Sequence {
|
||||
* notBeforeTime GeneralizedTime,
|
||||
* notAfterTime GeneralizedTime
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(notBeforeTime, notAfterTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertValidityPeriod.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertValidityPeriod.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5321f2cb782e44043b4fa49060cbae5d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AttCertValidityPeriod.cs
|
||||
uploadId: 783279
|
||||
86
Runtime/3rdParty/BouncyCastle/asn1/x509/Attribute.cs
vendored
Normal file
86
Runtime/3rdParty/BouncyCastle/asn1/x509/Attribute.cs
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
#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.X509
|
||||
{
|
||||
public class AttributeX509
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier attrType;
|
||||
private readonly Asn1Set attrValues;
|
||||
|
||||
/**
|
||||
* return an Attr object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static AttributeX509 GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is AttributeX509)
|
||||
{
|
||||
return (AttributeX509) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new AttributeX509((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private AttributeX509(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
attrType = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
attrValues = Asn1Set.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public AttributeX509(
|
||||
DerObjectIdentifier attrType,
|
||||
Asn1Set attrValues)
|
||||
{
|
||||
this.attrType = attrType;
|
||||
this.attrValues = attrValues;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier AttrType
|
||||
{
|
||||
get { return attrType; }
|
||||
}
|
||||
|
||||
public Asn1Encodable[] GetAttributeValues()
|
||||
{
|
||||
return attrValues.ToArray();
|
||||
}
|
||||
|
||||
public Asn1Set AttrValues
|
||||
{
|
||||
get { return attrValues; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* Attr ::= Sequence {
|
||||
* attrType OBJECT IDENTIFIER,
|
||||
* attrValues Set OF AttributeValue
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(attrType, attrValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/Attribute.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/Attribute.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1e4913ceea3f4294b888f419274a1a78
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/Attribute.cs
|
||||
uploadId: 783279
|
||||
90
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificate.cs
vendored
Normal file
90
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificate.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;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class AttributeCertificate
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly AttributeCertificateInfo acinfo;
|
||||
private readonly AlgorithmIdentifier signatureAlgorithm;
|
||||
private readonly DerBitString signatureValue;
|
||||
|
||||
/**
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public static AttributeCertificate GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is AttributeCertificate)
|
||||
return (AttributeCertificate) obj;
|
||||
|
||||
if (obj != null)
|
||||
return new AttributeCertificate(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public AttributeCertificate(
|
||||
AttributeCertificateInfo acinfo,
|
||||
AlgorithmIdentifier signatureAlgorithm,
|
||||
DerBitString signatureValue)
|
||||
{
|
||||
this.acinfo = acinfo;
|
||||
this.signatureAlgorithm = signatureAlgorithm;
|
||||
this.signatureValue = signatureValue;
|
||||
}
|
||||
|
||||
private AttributeCertificate(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
this.acinfo = AttributeCertificateInfo.GetInstance(seq[0]);
|
||||
this.signatureAlgorithm = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
this.signatureValue = DerBitString.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
public AttributeCertificateInfo ACInfo
|
||||
{
|
||||
get { return acinfo; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier SignatureAlgorithm
|
||||
{
|
||||
get { return signatureAlgorithm; }
|
||||
}
|
||||
|
||||
public DerBitString SignatureValue
|
||||
{
|
||||
get { return signatureValue; }
|
||||
}
|
||||
|
||||
public byte[] GetSignatureOctets()
|
||||
{
|
||||
return signatureValue.GetOctets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AttributeCertificate ::= Sequence {
|
||||
* acinfo AttributeCertificateInfo,
|
||||
* signatureAlgorithm AlgorithmIdentifier,
|
||||
* signatureValue BIT STRING
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(acinfo, signatureAlgorithm, signatureValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificate.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificate.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8a575c445db2d2146bb19447baf9a5bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificate.cs
|
||||
uploadId: 783279
|
||||
167
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificateInfo.cs
vendored
Normal file
167
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificateInfo.cs
vendored
Normal file
@ -0,0 +1,167 @@
|
||||
#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.X509
|
||||
{
|
||||
public class AttributeCertificateInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal readonly DerInteger version;
|
||||
internal readonly Holder holder;
|
||||
internal readonly AttCertIssuer issuer;
|
||||
internal readonly AlgorithmIdentifier signature;
|
||||
internal readonly DerInteger serialNumber;
|
||||
internal readonly AttCertValidityPeriod attrCertValidityPeriod;
|
||||
internal readonly Asn1Sequence attributes;
|
||||
internal readonly DerBitString issuerUniqueID;
|
||||
internal readonly X509Extensions extensions;
|
||||
|
||||
public static AttributeCertificateInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
public static AttributeCertificateInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is AttributeCertificateInfo)
|
||||
{
|
||||
return (AttributeCertificateInfo) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new AttributeCertificateInfo((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private AttributeCertificateInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 6 || seq.Count > 9)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
int start;
|
||||
if (seq[0] is DerInteger) // in version 1 certs version is DEFAULT v1(0)
|
||||
{
|
||||
this.version = DerInteger.GetInstance(seq[0]);
|
||||
start = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.version = new DerInteger(0);
|
||||
start = 0;
|
||||
}
|
||||
|
||||
this.holder = Holder.GetInstance(seq[start]);
|
||||
this.issuer = AttCertIssuer.GetInstance(seq[start + 1]);
|
||||
this.signature = AlgorithmIdentifier.GetInstance(seq[start + 2]);
|
||||
this.serialNumber = DerInteger.GetInstance(seq[start + 3]);
|
||||
this.attrCertValidityPeriod = AttCertValidityPeriod.GetInstance(seq[start + 4]);
|
||||
this.attributes = Asn1Sequence.GetInstance(seq[start + 5]);
|
||||
|
||||
for (int i = start + 6; i < seq.Count; i++)
|
||||
{
|
||||
Asn1Encodable obj = (Asn1Encodable) seq[i];
|
||||
|
||||
if (obj is DerBitString)
|
||||
{
|
||||
this.issuerUniqueID = DerBitString.GetInstance(seq[i]);
|
||||
}
|
||||
else if (obj is Asn1Sequence || obj is X509Extensions)
|
||||
{
|
||||
this.extensions = X509Extensions.GetInstance(seq[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public Holder Holder
|
||||
{
|
||||
get { return holder; }
|
||||
}
|
||||
|
||||
public AttCertIssuer Issuer
|
||||
{
|
||||
get { return issuer; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier Signature
|
||||
{
|
||||
get { return signature; }
|
||||
}
|
||||
|
||||
public DerInteger SerialNumber
|
||||
{
|
||||
get { return serialNumber; }
|
||||
}
|
||||
|
||||
public AttCertValidityPeriod AttrCertValidityPeriod
|
||||
{
|
||||
get { return attrCertValidityPeriod; }
|
||||
}
|
||||
|
||||
public Asn1Sequence Attributes
|
||||
{
|
||||
get { return attributes; }
|
||||
}
|
||||
|
||||
public DerBitString IssuerUniqueID
|
||||
{
|
||||
get { return issuerUniqueID; }
|
||||
}
|
||||
|
||||
public X509Extensions Extensions
|
||||
{
|
||||
get { return extensions; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* AttributeCertificateInfo ::= Sequence {
|
||||
* version AttCertVersion -- version is v2,
|
||||
* holder Holder,
|
||||
* issuer AttCertIssuer,
|
||||
* signature AlgorithmIdentifier,
|
||||
* serialNumber CertificateSerialNumber,
|
||||
* attrCertValidityPeriod AttCertValidityPeriod,
|
||||
* attributes Sequence OF Attr,
|
||||
* issuerUniqueID UniqueIdentifier OPTIONAL,
|
||||
* extensions Extensions OPTIONAL
|
||||
* }
|
||||
*
|
||||
* AttCertVersion ::= Integer { v2(1) }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(9);
|
||||
|
||||
if (!version.HasValue(0))
|
||||
{
|
||||
v.Add(version);
|
||||
}
|
||||
|
||||
v.Add(holder, issuer, signature, serialNumber, attrCertValidityPeriod, attributes);
|
||||
v.AddOptional(issuerUniqueID, extensions);
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificateInfo.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificateInfo.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d9ead0124c35704286b318f293a6640
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeCertificateInfo.cs
|
||||
uploadId: 783279
|
||||
54
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeTable.cs
vendored
Normal file
54
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeTable.cs
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class AttributeTable
|
||||
{
|
||||
private readonly IDictionary<DerObjectIdentifier, AttributeX509> m_attributes;
|
||||
|
||||
public AttributeTable(IDictionary<DerObjectIdentifier, AttributeX509> attrs)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(attrs);
|
||||
}
|
||||
|
||||
public AttributeTable(Asn1EncodableVector v)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(v.Count);
|
||||
|
||||
for (int i = 0; i != v.Count; i++)
|
||||
{
|
||||
AttributeX509 a = AttributeX509.GetInstance(v[i]);
|
||||
|
||||
m_attributes.Add(a.AttrType, a);
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeTable(Asn1Set s)
|
||||
{
|
||||
m_attributes = new Dictionary<DerObjectIdentifier, AttributeX509>(s.Count);
|
||||
|
||||
for (int i = 0; i != s.Count; i++)
|
||||
{
|
||||
AttributeX509 a = AttributeX509.GetInstance(s[i]);
|
||||
|
||||
m_attributes.Add(a.AttrType, a);
|
||||
}
|
||||
}
|
||||
|
||||
public AttributeX509 Get(DerObjectIdentifier oid)
|
||||
{
|
||||
return CollectionUtilities.GetValueOrNull(m_attributes, oid);
|
||||
}
|
||||
|
||||
public IDictionary<DerObjectIdentifier, AttributeX509> ToDictionary()
|
||||
{
|
||||
return new Dictionary<DerObjectIdentifier, AttributeX509>(m_attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeTable.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeTable.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 862496a230ee1e644baeda9d3c583189
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AttributeTable.cs
|
||||
uploadId: 783279
|
||||
111
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityInformationAccess.cs
vendored
Normal file
111
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityInformationAccess.cs
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The AuthorityInformationAccess object.
|
||||
* <pre>
|
||||
* id-pe-authorityInfoAccess OBJECT IDENTIFIER ::= { id-pe 1 }
|
||||
*
|
||||
* AuthorityInfoAccessSyntax ::=
|
||||
* Sequence SIZE (1..MAX) OF AccessDescription
|
||||
* AccessDescription ::= Sequence {
|
||||
* accessMethod OBJECT IDENTIFIER,
|
||||
* accessLocation GeneralName }
|
||||
*
|
||||
* id-ad OBJECT IDENTIFIER ::= { id-pkix 48 }
|
||||
* id-ad-caIssuers OBJECT IDENTIFIER ::= { id-ad 2 }
|
||||
* id-ad-ocsp OBJECT IDENTIFIER ::= { id-ad 1 }
|
||||
* </pre>
|
||||
*/
|
||||
public class AuthorityInformationAccess
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static AccessDescription[] Copy(AccessDescription[] descriptions)
|
||||
{
|
||||
return (AccessDescription[])descriptions.Clone();
|
||||
}
|
||||
|
||||
public static AuthorityInformationAccess GetInstance(object obj)
|
||||
{
|
||||
if (obj is AuthorityInformationAccess)
|
||||
return (AuthorityInformationAccess)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new AuthorityInformationAccess(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static AuthorityInformationAccess FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.AuthorityInfoAccess));
|
||||
}
|
||||
|
||||
private readonly AccessDescription[] descriptions;
|
||||
|
||||
private AuthorityInformationAccess(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1)
|
||||
throw new ArgumentException("sequence may not be empty");
|
||||
|
||||
this.descriptions = new AccessDescription[seq.Count];
|
||||
|
||||
for (int i = 0; i < seq.Count; ++i)
|
||||
{
|
||||
descriptions[i] = AccessDescription.GetInstance(seq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public AuthorityInformationAccess(
|
||||
AccessDescription description)
|
||||
{
|
||||
this.descriptions = new AccessDescription[]{ description };
|
||||
}
|
||||
|
||||
public AuthorityInformationAccess(
|
||||
AccessDescription[] descriptions)
|
||||
{
|
||||
this.descriptions = Copy(descriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AuthorityInformationAccess with the oid and location provided.
|
||||
*/
|
||||
public AuthorityInformationAccess(DerObjectIdentifier oid, GeneralName location)
|
||||
: this(new AccessDescription(oid, location))
|
||||
{
|
||||
}
|
||||
|
||||
public AccessDescription[] GetAccessDescriptions()
|
||||
{
|
||||
return Copy(descriptions);
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(descriptions);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
//return "AuthorityInformationAccess: Oid(" + this.descriptions[0].AccessMethod.Id + ")";
|
||||
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("AuthorityInformationAccess:");
|
||||
foreach (AccessDescription description in descriptions)
|
||||
{
|
||||
buf.Append(" ")
|
||||
.Append(description)
|
||||
.AppendLine();
|
||||
}
|
||||
return buf.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityInformationAccess.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityInformationAccess.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8f412afbd6f3fa64a904932848e473da
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityInformationAccess.cs
|
||||
uploadId: 783279
|
||||
187
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityKeyIdentifier.cs
vendored
Normal file
187
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityKeyIdentifier.cs
vendored
Normal file
@ -0,0 +1,187 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The AuthorityKeyIdentifier object.
|
||||
* <pre>
|
||||
* id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 35 }
|
||||
*
|
||||
* AuthorityKeyIdentifier ::= Sequence {
|
||||
* keyIdentifier [0] IMPLICIT KeyIdentifier OPTIONAL,
|
||||
* authorityCertIssuer [1] IMPLICIT GeneralNames OPTIONAL,
|
||||
* authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL }
|
||||
*
|
||||
* KeyIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class AuthorityKeyIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static AuthorityKeyIdentifier GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static AuthorityKeyIdentifier GetInstance(object obj)
|
||||
{
|
||||
if (obj is AuthorityKeyIdentifier)
|
||||
return (AuthorityKeyIdentifier)obj;
|
||||
if (obj is X509Extension)
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new AuthorityKeyIdentifier(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static AuthorityKeyIdentifier FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.AuthorityKeyIdentifier));
|
||||
}
|
||||
|
||||
private readonly Asn1OctetString keyidentifier;
|
||||
private readonly GeneralNames certissuer;
|
||||
private readonly DerInteger certserno;
|
||||
|
||||
protected internal AuthorityKeyIdentifier(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
foreach (Asn1Encodable element in seq)
|
||||
{
|
||||
Asn1TaggedObject obj = Asn1TaggedObject.GetInstance(element);
|
||||
|
||||
switch (obj.TagNo)
|
||||
{
|
||||
case 0:
|
||||
this.keyidentifier = Asn1OctetString.GetInstance(obj, false);
|
||||
break;
|
||||
case 1:
|
||||
this.certissuer = GeneralNames.GetInstance(obj, false);
|
||||
break;
|
||||
case 2:
|
||||
this.certserno = DerInteger.GetInstance(obj, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("illegal tag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Calulates the keyidentifier using a SHA1 hash over the BIT STRING
|
||||
* from SubjectPublicKeyInfo as defined in RFC2459.
|
||||
*
|
||||
* Example of making a AuthorityKeyIdentifier:
|
||||
* <pre>
|
||||
* SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
|
||||
* publicKey.getEncoded()).readObject());
|
||||
* AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);
|
||||
* </pre>
|
||||
*
|
||||
**/
|
||||
public AuthorityKeyIdentifier(
|
||||
SubjectPublicKeyInfo spki)
|
||||
: this(spki, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AuthorityKeyIdentifier with the GeneralNames tag and
|
||||
* the serial number provided as well.
|
||||
*/
|
||||
public AuthorityKeyIdentifier(
|
||||
SubjectPublicKeyInfo spki,
|
||||
GeneralNames name,
|
||||
BigInteger serialNumber)
|
||||
{
|
||||
IDigest digest = new Sha1Digest();
|
||||
byte[] resBuf = new byte[digest.GetDigestSize()];
|
||||
byte[] bytes = spki.PublicKeyData.GetBytes();
|
||||
digest.BlockUpdate(bytes, 0, bytes.Length);
|
||||
digest.DoFinal(resBuf, 0);
|
||||
|
||||
this.keyidentifier = new DerOctetString(resBuf);
|
||||
this.certissuer = name;
|
||||
this.certserno = serialNumber == null ? null : new DerInteger(serialNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AuthorityKeyIdentifier with the GeneralNames tag and
|
||||
* the serial number provided.
|
||||
*/
|
||||
public AuthorityKeyIdentifier(
|
||||
GeneralNames name,
|
||||
BigInteger serialNumber)
|
||||
: this((byte[])null, name, serialNumber)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AuthorityKeyIdentifier with a precomputed key identifier
|
||||
*/
|
||||
public AuthorityKeyIdentifier(
|
||||
byte[] keyIdentifier)
|
||||
: this(keyIdentifier, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* create an AuthorityKeyIdentifier with a precomupted key identifier
|
||||
* and the GeneralNames tag and the serial number provided as well.
|
||||
*/
|
||||
public AuthorityKeyIdentifier(
|
||||
byte[] keyIdentifier,
|
||||
GeneralNames name,
|
||||
BigInteger serialNumber)
|
||||
{
|
||||
this.keyidentifier = keyIdentifier == null ? null : new DerOctetString(keyIdentifier);
|
||||
this.certissuer = name;
|
||||
this.certserno = serialNumber == null ? null : new DerInteger(serialNumber);
|
||||
}
|
||||
|
||||
public byte[] GetKeyIdentifier()
|
||||
{
|
||||
return keyidentifier == null ? null : keyidentifier.GetOctets();
|
||||
}
|
||||
|
||||
public GeneralNames AuthorityCertIssuer
|
||||
{
|
||||
get { return certissuer; }
|
||||
}
|
||||
|
||||
public BigInteger AuthorityCertSerialNumber
|
||||
{
|
||||
get { return certserno == null ? null : certserno.Value; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(false, 0, keyidentifier);
|
||||
v.AddOptionalTagged(false, 1, certissuer);
|
||||
v.AddOptionalTagged(false, 2, certserno);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string keyID = (keyidentifier != null) ? Hex.ToHexString(keyidentifier.GetOctets()) : "null";
|
||||
|
||||
return "AuthorityKeyIdentifier: KeyID(" + keyID + ")";
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityKeyIdentifier.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityKeyIdentifier.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7af7f9bc1136f524b82aab10b4d1a5af
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/AuthorityKeyIdentifier.cs
|
||||
uploadId: 783279
|
||||
121
Runtime/3rdParty/BouncyCastle/asn1/x509/BasicConstraints.cs
vendored
Normal file
121
Runtime/3rdParty/BouncyCastle/asn1/x509/BasicConstraints.cs
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class BasicConstraints
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static BasicConstraints GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static BasicConstraints GetInstance(object obj)
|
||||
{
|
||||
if (obj is BasicConstraints)
|
||||
return (BasicConstraints)obj;
|
||||
if (obj is X509Extension)
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new BasicConstraints(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static BasicConstraints FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.BasicConstraints));
|
||||
}
|
||||
|
||||
private readonly DerBoolean cA;
|
||||
private readonly DerInteger pathLenConstraint;
|
||||
|
||||
private BasicConstraints(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count > 0)
|
||||
{
|
||||
if (seq[0] is DerBoolean)
|
||||
{
|
||||
this.cA = DerBoolean.GetInstance(seq[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pathLenConstraint = DerInteger.GetInstance(seq[0]);
|
||||
}
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
if (this.cA == null)
|
||||
throw new ArgumentException("wrong sequence in constructor", "seq");
|
||||
|
||||
this.pathLenConstraint = DerInteger.GetInstance(seq[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BasicConstraints(
|
||||
bool cA)
|
||||
{
|
||||
if (cA)
|
||||
{
|
||||
this.cA = DerBoolean.True;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* create a cA=true object for the given path length constraint.
|
||||
*
|
||||
* @param pathLenConstraint
|
||||
*/
|
||||
public BasicConstraints(
|
||||
int pathLenConstraint)
|
||||
{
|
||||
this.cA = DerBoolean.True;
|
||||
this.pathLenConstraint = new DerInteger(pathLenConstraint);
|
||||
}
|
||||
|
||||
public bool IsCA()
|
||||
{
|
||||
return cA != null && cA.IsTrue;
|
||||
}
|
||||
|
||||
public BigInteger PathLenConstraint
|
||||
{
|
||||
get { return pathLenConstraint == null ? null : pathLenConstraint.Value; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* BasicConstraints := Sequence {
|
||||
* cA Boolean DEFAULT FALSE,
|
||||
* pathLenConstraint Integer (0..MAX) OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(2);
|
||||
v.AddOptional(cA,
|
||||
pathLenConstraint); // yes some people actually do this when cA is false...
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (pathLenConstraint == null)
|
||||
{
|
||||
return "BasicConstraints: isCa(" + this.IsCA() + ")";
|
||||
}
|
||||
|
||||
return "BasicConstraints: isCa(" + this.IsCA() + "), pathLenConstraint = " + pathLenConstraint.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/BasicConstraints.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/BasicConstraints.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 787b8a9978024a34096c163bb28d54a2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/BasicConstraints.cs
|
||||
uploadId: 783279
|
||||
89
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLDistPoint.cs
vendored
Normal file
89
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLDistPoint.cs
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class CrlDistPoint
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static CrlDistPoint GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static CrlDistPoint GetInstance(object obj)
|
||||
{
|
||||
if (obj is CrlDistPoint)
|
||||
return (CrlDistPoint)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new CrlDistPoint(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static CrlDistPoint FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.CrlDistributionPoints));
|
||||
}
|
||||
|
||||
internal readonly Asn1Sequence seq;
|
||||
|
||||
private CrlDistPoint(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public CrlDistPoint(
|
||||
DistributionPoint[] points)
|
||||
{
|
||||
seq = new DerSequence(points);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the distribution points making up the sequence.
|
||||
*
|
||||
* @return DistributionPoint[]
|
||||
*/
|
||||
public DistributionPoint[] GetDistributionPoints()
|
||||
{
|
||||
DistributionPoint[] dp = new DistributionPoint[seq.Count];
|
||||
|
||||
for (int i = 0; i != seq.Count; ++i)
|
||||
{
|
||||
dp[i] = DistributionPoint.GetInstance(seq[i]);
|
||||
}
|
||||
|
||||
return dp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* CrlDistPoint ::= Sequence SIZE {1..MAX} OF DistributionPoint
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("CRLDistPoint:");
|
||||
foreach (DistributionPoint dp in GetDistributionPoints())
|
||||
{
|
||||
buf.Append(" ")
|
||||
.Append(dp)
|
||||
.AppendLine();
|
||||
}
|
||||
return buf.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLDistPoint.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLDistPoint.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66ab97eed8aa93248a3aead3651345f3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CRLDistPoint.cs
|
||||
uploadId: 783279
|
||||
34
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLNumber.cs
vendored
Normal file
34
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLNumber.cs
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The CRLNumber object.
|
||||
* <pre>
|
||||
* CRLNumber::= Integer(0..MAX)
|
||||
* </pre>
|
||||
*/
|
||||
public class CrlNumber
|
||||
: DerInteger
|
||||
{
|
||||
public CrlNumber(
|
||||
BigInteger number)
|
||||
: base(number)
|
||||
{
|
||||
}
|
||||
|
||||
public BigInteger Number
|
||||
{
|
||||
get { return PositiveValue; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "CRLNumber: " + Number;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLNumber.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLNumber.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2aeadd31e511fd243b3812ae888042e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CRLNumber.cs
|
||||
uploadId: 783279
|
||||
64
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLReason.cs
vendored
Normal file
64
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLReason.cs
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The CRLReason enumeration.
|
||||
* <pre>
|
||||
* CRLReason ::= Enumerated {
|
||||
* unspecified (0),
|
||||
* keyCompromise (1),
|
||||
* cACompromise (2),
|
||||
* affiliationChanged (3),
|
||||
* superseded (4),
|
||||
* cessationOfOperation (5),
|
||||
* certificateHold (6),
|
||||
* removeFromCRL (8),
|
||||
* privilegeWithdrawn (9),
|
||||
* aACompromise (10)
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class CrlReason
|
||||
: DerEnumerated
|
||||
{
|
||||
public const int Unspecified = 0;
|
||||
public const int KeyCompromise = 1;
|
||||
public const int CACompromise = 2;
|
||||
public const int AffiliationChanged = 3;
|
||||
public const int Superseded = 4;
|
||||
public const int CessationOfOperation = 5;
|
||||
public const int CertificateHold = 6;
|
||||
// 7 -> Unknown
|
||||
public const int RemoveFromCrl = 8;
|
||||
public const int PrivilegeWithdrawn = 9;
|
||||
public const int AACompromise = 10;
|
||||
|
||||
private static readonly string[] ReasonString = new string[]
|
||||
{
|
||||
"Unspecified", "KeyCompromise", "CACompromise", "AffiliationChanged",
|
||||
"Superseded", "CessationOfOperation", "CertificateHold", "Unknown",
|
||||
"RemoveFromCrl", "PrivilegeWithdrawn", "AACompromise"
|
||||
};
|
||||
|
||||
public CrlReason(
|
||||
int reason)
|
||||
: base(reason)
|
||||
{
|
||||
}
|
||||
|
||||
public CrlReason(DerEnumerated reason)
|
||||
: base(reason.IntValueExact)
|
||||
{
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
int reason = IntValueExact;
|
||||
string str = (reason < 0 || reason > 10) ? "Invalid" : ReasonString[reason];
|
||||
return "CrlReason: " + str;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLReason.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CRLReason.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56f50d8d8cd7a9d429273a7af62d9268
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CRLReason.cs
|
||||
uploadId: 783279
|
||||
24
Runtime/3rdParty/BouncyCastle/asn1/x509/CertPolicyId.cs
vendored
Normal file
24
Runtime/3rdParty/BouncyCastle/asn1/x509/CertPolicyId.cs
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* CertPolicyId, used in the CertificatePolicies and PolicyMappings
|
||||
* X509V3 Extensions.
|
||||
*
|
||||
* <pre>
|
||||
* CertPolicyId ::= OBJECT IDENTIFIER
|
||||
* </pre>
|
||||
*/
|
||||
public class CertPolicyID
|
||||
: DerObjectIdentifier
|
||||
{
|
||||
public CertPolicyID(
|
||||
string id)
|
||||
: base(id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertPolicyId.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertPolicyId.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43004b73691902a4aa4115eb853a654d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CertPolicyId.cs
|
||||
uploadId: 783279
|
||||
115
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificateList.cs
vendored
Normal file
115
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificateList.cs
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* PKIX RFC-2459
|
||||
*
|
||||
* The X.509 v2 CRL syntax is as follows. For signature calculation,
|
||||
* the data that is to be signed is ASN.1 Der encoded.
|
||||
*
|
||||
* <pre>
|
||||
* CertificateList ::= Sequence {
|
||||
* tbsCertList TbsCertList,
|
||||
* signatureAlgorithm AlgorithmIdentifier,
|
||||
* signatureValue BIT STRING }
|
||||
* </pre>
|
||||
*/
|
||||
public class CertificateList
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly TbsCertificateList tbsCertList;
|
||||
private readonly AlgorithmIdentifier sigAlgID;
|
||||
private readonly DerBitString sig;
|
||||
|
||||
public static CertificateList GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static CertificateList GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is CertificateList)
|
||||
return (CertificateList) obj;
|
||||
|
||||
if (obj != null)
|
||||
return new CertificateList(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private CertificateList(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 3)
|
||||
throw new ArgumentException("sequence wrong size for CertificateList", "seq");
|
||||
|
||||
tbsCertList = TbsCertificateList.GetInstance(seq[0]);
|
||||
sigAlgID = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
sig = DerBitString.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
public TbsCertificateList TbsCertList
|
||||
{
|
||||
get { return tbsCertList; }
|
||||
}
|
||||
|
||||
public CrlEntry[] GetRevokedCertificates()
|
||||
{
|
||||
return tbsCertList.GetRevokedCertificates();
|
||||
}
|
||||
|
||||
public IEnumerable<CrlEntry> GetRevokedCertificateEnumeration()
|
||||
{
|
||||
return tbsCertList.GetRevokedCertificateEnumeration();
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier SignatureAlgorithm
|
||||
{
|
||||
get { return sigAlgID; }
|
||||
}
|
||||
|
||||
public DerBitString Signature
|
||||
{
|
||||
get { return sig; }
|
||||
}
|
||||
|
||||
public byte[] GetSignatureOctets()
|
||||
{
|
||||
return sig.GetOctets();
|
||||
}
|
||||
|
||||
public int Version
|
||||
{
|
||||
get { return tbsCertList.Version; }
|
||||
}
|
||||
|
||||
public X509Name Issuer
|
||||
{
|
||||
get { return tbsCertList.Issuer; }
|
||||
}
|
||||
|
||||
public Time ThisUpdate
|
||||
{
|
||||
get { return tbsCertList.ThisUpdate; }
|
||||
}
|
||||
|
||||
public Time NextUpdate
|
||||
{
|
||||
get { return tbsCertList.NextUpdate; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(tbsCertList, sigAlgID, sig);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificateList.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificateList.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c53a73fa90f59cb42bab3d969bb427e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CertificateList.cs
|
||||
uploadId: 783279
|
||||
157
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePair.cs
vendored
Normal file
157
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePair.cs
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* This class helps to support crossCerfificatePairs in a LDAP directory
|
||||
* according RFC 2587
|
||||
*
|
||||
* <pre>
|
||||
* crossCertificatePairATTRIBUTE::={
|
||||
* WITH SYNTAX CertificatePair
|
||||
* EQUALITY MATCHING RULE certificatePairExactMatch
|
||||
* ID joint-iso-ccitt(2) ds(5) attributeType(4) crossCertificatePair(40)}
|
||||
* </pre>
|
||||
*
|
||||
* <blockquote> The forward elements of the crossCertificatePair attribute of a
|
||||
* CA's directory entry shall be used to store all, except self-issued
|
||||
* certificates issued to this CA. Optionally, the reverse elements of the
|
||||
* crossCertificatePair attribute, of a CA's directory entry may contain a
|
||||
* subset of certificates issued by this CA to other CAs. When both the forward
|
||||
* and the reverse elements are present in a single attribute value, issuer name
|
||||
* in one certificate shall match the subject name in the other and vice versa,
|
||||
* and the subject public key in one certificate shall be capable of verifying
|
||||
* the digital signature on the other certificate and vice versa.
|
||||
*
|
||||
* When a reverse element is present, the forward element value and the reverse
|
||||
* element value need not be stored in the same attribute value; in other words,
|
||||
* they can be stored in either a single attribute value or two attribute
|
||||
* values. </blockquote>
|
||||
*
|
||||
* <pre>
|
||||
* CertificatePair ::= SEQUENCE {
|
||||
* forward [0] Certificate OPTIONAL,
|
||||
* reverse [1] Certificate OPTIONAL,
|
||||
* -- at least one of the pair shall be present -- }
|
||||
* </pre>
|
||||
*/
|
||||
public class CertificatePair
|
||||
: Asn1Encodable
|
||||
{
|
||||
private X509CertificateStructure forward, reverse;
|
||||
|
||||
public static CertificatePair GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is CertificatePair)
|
||||
{
|
||||
return (CertificatePair) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new CertificatePair((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from Asn1Sequence.
|
||||
* <p/>
|
||||
* The sequence is of type CertificatePair:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* CertificatePair ::= SEQUENCE {
|
||||
* forward [0] Certificate OPTIONAL,
|
||||
* reverse [1] Certificate OPTIONAL,
|
||||
* -- at least one of the pair shall be present -- }
|
||||
* </pre>
|
||||
*
|
||||
* @param seq The ASN.1 sequence.
|
||||
*/
|
||||
private CertificatePair(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 1 && seq.Count != 2)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
}
|
||||
|
||||
foreach (object obj in seq)
|
||||
{
|
||||
Asn1TaggedObject o = Asn1TaggedObject.GetInstance(obj);
|
||||
if (o.TagNo == 0)
|
||||
{
|
||||
forward = X509CertificateStructure.GetInstance(o, true);
|
||||
}
|
||||
else if (o.TagNo == 1)
|
||||
{
|
||||
reverse = X509CertificateStructure.GetInstance(o, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Bad tag number: " + o.TagNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from a given details.
|
||||
*
|
||||
* @param forward Certificates issued to this CA.
|
||||
* @param reverse Certificates issued by this CA to other CAs.
|
||||
*/
|
||||
public CertificatePair(
|
||||
X509CertificateStructure forward,
|
||||
X509CertificateStructure reverse)
|
||||
{
|
||||
this.forward = forward;
|
||||
this.reverse = reverse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <p/>
|
||||
* Returns:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* CertificatePair ::= SEQUENCE {
|
||||
* forward [0] Certificate OPTIONAL,
|
||||
* reverse [1] Certificate OPTIONAL,
|
||||
* -- at least one of the pair shall be present -- }
|
||||
* </pre>
|
||||
*
|
||||
* @return a DERObject
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(true, 0, forward);
|
||||
v.AddOptionalTagged(true, 1, reverse);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the forward.
|
||||
*/
|
||||
public X509CertificateStructure Forward
|
||||
{
|
||||
get { return forward; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the reverse.
|
||||
*/
|
||||
public X509CertificateStructure Reverse
|
||||
{
|
||||
get { return reverse; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePair.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePair.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f3cfe718f865494c83c11c3102faa73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePair.cs
|
||||
uploadId: 783279
|
||||
109
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePolicies.cs
vendored
Normal file
109
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePolicies.cs
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class CertificatePolicies
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static PolicyInformation[] Copy(PolicyInformation[] policyInfo)
|
||||
{
|
||||
return (PolicyInformation[])policyInfo.Clone();
|
||||
}
|
||||
|
||||
public static CertificatePolicies GetInstance(object obj)
|
||||
{
|
||||
if (obj is CertificatePolicies)
|
||||
return (CertificatePolicies)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new CertificatePolicies(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static CertificatePolicies GetInstance(Asn1TaggedObject obj, bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
public static CertificatePolicies FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.CertificatePolicies));
|
||||
}
|
||||
|
||||
private readonly PolicyInformation[] policyInformation;
|
||||
|
||||
/**
|
||||
* Construct a CertificatePolicies object containing one PolicyInformation.
|
||||
*
|
||||
* @param name the name to be contained.
|
||||
*/
|
||||
public CertificatePolicies(PolicyInformation name)
|
||||
{
|
||||
this.policyInformation = new PolicyInformation[] { name };
|
||||
}
|
||||
|
||||
public CertificatePolicies(PolicyInformation[] policyInformation)
|
||||
{
|
||||
this.policyInformation = Copy(policyInformation);
|
||||
}
|
||||
|
||||
private CertificatePolicies(Asn1Sequence seq)
|
||||
{
|
||||
this.policyInformation = new PolicyInformation[seq.Count];
|
||||
|
||||
for (int i = 0; i < seq.Count; ++i)
|
||||
{
|
||||
policyInformation[i] = PolicyInformation.GetInstance(seq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual PolicyInformation[] GetPolicyInformation()
|
||||
{
|
||||
return Copy(policyInformation);
|
||||
}
|
||||
|
||||
public virtual PolicyInformation GetPolicyInformation(DerObjectIdentifier policyIdentifier)
|
||||
{
|
||||
for (int i = 0; i != policyInformation.Length; i++)
|
||||
{
|
||||
if (policyIdentifier.Equals(policyInformation[i].PolicyIdentifier))
|
||||
{
|
||||
return policyInformation[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an ASN1OutputStream.
|
||||
* <pre>
|
||||
* CertificatePolicies ::= SEQUENCE SIZE {1..MAX} OF PolicyInformation
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(policyInformation);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder("CertificatePolicies:");
|
||||
if (policyInformation != null && policyInformation.Length > 0)
|
||||
{
|
||||
sb.Append(' ');
|
||||
sb.Append(policyInformation[0]);
|
||||
for (int i = 1; i < policyInformation.Length; ++i)
|
||||
{
|
||||
sb.Append(", ");
|
||||
sb.Append(policyInformation[i]);
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePolicies.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePolicies.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ba4f8c889517a9f479e56b776d1a1d91
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/CertificatePolicies.cs
|
||||
uploadId: 783279
|
||||
81
Runtime/3rdParty/BouncyCastle/asn1/x509/DSAParameter.cs
vendored
Normal file
81
Runtime/3rdParty/BouncyCastle/asn1/x509/DSAParameter.cs
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class DsaParameter
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal readonly DerInteger p, q, g;
|
||||
|
||||
public static DsaParameter GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static DsaParameter GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if(obj == null || obj is DsaParameter)
|
||||
{
|
||||
return (DsaParameter) obj;
|
||||
}
|
||||
|
||||
if(obj is Asn1Sequence)
|
||||
{
|
||||
return new DsaParameter((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid DsaParameter: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public DsaParameter(
|
||||
BigInteger p,
|
||||
BigInteger q,
|
||||
BigInteger g)
|
||||
{
|
||||
this.p = new DerInteger(p);
|
||||
this.q = new DerInteger(q);
|
||||
this.g = new DerInteger(g);
|
||||
}
|
||||
|
||||
private DsaParameter(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
this.p = DerInteger.GetInstance(seq[0]);
|
||||
this.q = DerInteger.GetInstance(seq[1]);
|
||||
this.g = DerInteger.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
public BigInteger P
|
||||
{
|
||||
get { return p.PositiveValue; }
|
||||
}
|
||||
|
||||
public BigInteger Q
|
||||
{
|
||||
get { return q.PositiveValue; }
|
||||
}
|
||||
|
||||
public BigInteger G
|
||||
{
|
||||
get { return g.PositiveValue; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(p, q, g);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DSAParameter.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DSAParameter.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0df53db1cbafa134987d7c3f98d2eac1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/DSAParameter.cs
|
||||
uploadId: 783279
|
||||
81
Runtime/3rdParty/BouncyCastle/asn1/x509/DigestInfo.cs
vendored
Normal file
81
Runtime/3rdParty/BouncyCastle/asn1/x509/DigestInfo.cs
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* The DigestInfo object.
|
||||
* <pre>
|
||||
* DigestInfo::=Sequence{
|
||||
* digestAlgorithm AlgorithmIdentifier,
|
||||
* digest OCTET STRING }
|
||||
* </pre>
|
||||
*/
|
||||
public class DigestInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly byte[] digest;
|
||||
private readonly AlgorithmIdentifier algID;
|
||||
|
||||
public static DigestInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static DigestInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is DigestInfo)
|
||||
{
|
||||
return (DigestInfo) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new DigestInfo((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public DigestInfo(
|
||||
AlgorithmIdentifier algID,
|
||||
byte[] digest)
|
||||
{
|
||||
this.digest = digest;
|
||||
this.algID = algID;
|
||||
}
|
||||
|
||||
private DigestInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
algID = AlgorithmIdentifier.GetInstance(seq[0]);
|
||||
digest = Asn1OctetString.GetInstance(seq[1]).GetOctets();
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier AlgorithmID
|
||||
{
|
||||
get { return algID; }
|
||||
}
|
||||
|
||||
public byte[] GetDigest()
|
||||
{
|
||||
return digest;
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(algID, new DerOctetString(digest));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DigestInfo.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DigestInfo.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 689c30e3590b6d140b51038ff73c8c69
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/DigestInfo.cs
|
||||
uploadId: 783279
|
||||
178
Runtime/3rdParty/BouncyCastle/asn1/x509/DisplayText.cs
vendored
Normal file
178
Runtime/3rdParty/BouncyCastle/asn1/x509/DisplayText.cs
vendored
Normal file
@ -0,0 +1,178 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* <code>DisplayText</code> class, used in
|
||||
* <code>CertificatePolicies</code> X509 V3 extensions (in policy qualifiers).
|
||||
*
|
||||
* <p>It stores a string in a chosen encoding.
|
||||
* <pre>
|
||||
* DisplayText ::= CHOICE {
|
||||
* ia5String IA5String (SIZE (1..200)),
|
||||
* visibleString VisibleString (SIZE (1..200)),
|
||||
* bmpString BMPString (SIZE (1..200)),
|
||||
* utf8String UTF8String (SIZE (1..200)) }
|
||||
* </pre></p>
|
||||
* @see PolicyQualifierInfo
|
||||
* @see PolicyInformation
|
||||
*/
|
||||
public class DisplayText
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
/**
|
||||
* Constant corresponding to ia5String encoding.
|
||||
*
|
||||
*/
|
||||
public const int ContentTypeIA5String = 0;
|
||||
/**
|
||||
* Constant corresponding to bmpString encoding.
|
||||
*
|
||||
*/
|
||||
public const int ContentTypeBmpString = 1;
|
||||
/**
|
||||
* Constant corresponding to utf8String encoding.
|
||||
*
|
||||
*/
|
||||
public const int ContentTypeUtf8String = 2;
|
||||
/**
|
||||
* Constant corresponding to visibleString encoding.
|
||||
*
|
||||
*/
|
||||
public const int ContentTypeVisibleString = 3;
|
||||
/**
|
||||
* Describe constant <code>DisplayTextMaximumSize</code> here.
|
||||
*
|
||||
*/
|
||||
public const int DisplayTextMaximumSize = 200;
|
||||
|
||||
internal readonly int contentType;
|
||||
internal readonly IAsn1String contents;
|
||||
|
||||
/**
|
||||
* Creates a new <code>DisplayText</code> instance.
|
||||
*
|
||||
* @param type the desired encoding type for the text.
|
||||
* @param text the text to store. Strings longer than 200
|
||||
* characters are truncated.
|
||||
*/
|
||||
public DisplayText(
|
||||
int type,
|
||||
string text)
|
||||
{
|
||||
if (text.Length > DisplayTextMaximumSize)
|
||||
{
|
||||
// RFC3280 limits these strings to 200 chars
|
||||
// truncate the string
|
||||
text = text.Substring(0, DisplayTextMaximumSize);
|
||||
}
|
||||
|
||||
contentType = type;
|
||||
switch (type)
|
||||
{
|
||||
case ContentTypeIA5String:
|
||||
contents = (IAsn1String)new DerIA5String (text);
|
||||
break;
|
||||
case ContentTypeUtf8String:
|
||||
contents = (IAsn1String)new DerUtf8String(text);
|
||||
break;
|
||||
case ContentTypeVisibleString:
|
||||
contents = (IAsn1String)new DerVisibleString(text);
|
||||
break;
|
||||
case ContentTypeBmpString:
|
||||
contents = (IAsn1String)new DerBmpString(text);
|
||||
break;
|
||||
default:
|
||||
contents = (IAsn1String)new DerUtf8String(text);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * return true if the passed in string can be represented without
|
||||
// * loss as a PrintableString, false otherwise.
|
||||
// */
|
||||
// private bool CanBePrintable(
|
||||
// string str)
|
||||
// {
|
||||
// for (int i = str.Length - 1; i >= 0; i--)
|
||||
// {
|
||||
// if (str[i] > 0x007f)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Creates a new <code>DisplayText</code> instance.
|
||||
*
|
||||
* @param text the text to encapsulate. Strings longer than 200
|
||||
* characters are truncated.
|
||||
*/
|
||||
public DisplayText(
|
||||
string text)
|
||||
{
|
||||
// by default use UTF8String
|
||||
if (text.Length > DisplayTextMaximumSize)
|
||||
{
|
||||
text = text.Substring(0, DisplayTextMaximumSize);
|
||||
}
|
||||
|
||||
contentType = ContentTypeUtf8String;
|
||||
contents = new DerUtf8String(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>DisplayText</code> instance.
|
||||
* <p>Useful when reading back a <code>DisplayText</code> class
|
||||
* from it's Asn1Encodable form.</p>
|
||||
*
|
||||
* @param contents an <code>Asn1Encodable</code> instance.
|
||||
*/
|
||||
public DisplayText(
|
||||
IAsn1String contents)
|
||||
{
|
||||
this.contents = contents;
|
||||
}
|
||||
|
||||
public static DisplayText GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is IAsn1String)
|
||||
{
|
||||
return new DisplayText((IAsn1String) obj);
|
||||
}
|
||||
|
||||
if (obj is DisplayText)
|
||||
{
|
||||
return (DisplayText) obj;
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return (Asn1Object) contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the stored <code>string</code> object.
|
||||
*
|
||||
* @return the stored text as a <code>string</code>.
|
||||
*/
|
||||
public string GetString()
|
||||
{
|
||||
return contents.GetString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DisplayText.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DisplayText.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 344ca49bedc8874459e689116ee08f35
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/DisplayText.cs
|
||||
uploadId: 783279
|
||||
143
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPoint.cs
vendored
Normal file
143
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPoint.cs
vendored
Normal file
@ -0,0 +1,143 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The DistributionPoint object.
|
||||
* <pre>
|
||||
* DistributionPoint ::= Sequence {
|
||||
* distributionPoint [0] DistributionPointName OPTIONAL,
|
||||
* reasons [1] ReasonFlags OPTIONAL,
|
||||
* cRLIssuer [2] GeneralNames OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class DistributionPoint
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal readonly DistributionPointName distributionPoint;
|
||||
internal readonly ReasonFlags reasons;
|
||||
internal readonly GeneralNames cRLIssuer;
|
||||
|
||||
public static DistributionPoint GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static DistributionPoint GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if(obj == null || obj is DistributionPoint)
|
||||
{
|
||||
return (DistributionPoint) obj;
|
||||
}
|
||||
|
||||
if(obj is Asn1Sequence)
|
||||
{
|
||||
return new DistributionPoint((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid DistributionPoint: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
private DistributionPoint(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject t = Asn1TaggedObject.GetInstance(seq[i]);
|
||||
|
||||
switch (t.TagNo)
|
||||
{
|
||||
case 0:
|
||||
distributionPoint = DistributionPointName.GetInstance(t, true);
|
||||
break;
|
||||
case 1:
|
||||
reasons = new ReasonFlags(DerBitString.GetInstance(t, false));
|
||||
break;
|
||||
case 2:
|
||||
cRLIssuer = GeneralNames.GetInstance(t, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DistributionPoint(
|
||||
DistributionPointName distributionPointName,
|
||||
ReasonFlags reasons,
|
||||
GeneralNames crlIssuer)
|
||||
{
|
||||
this.distributionPoint = distributionPointName;
|
||||
this.reasons = reasons;
|
||||
this.cRLIssuer = crlIssuer;
|
||||
}
|
||||
|
||||
public DistributionPointName DistributionPointName
|
||||
{
|
||||
get { return distributionPoint; }
|
||||
}
|
||||
|
||||
public ReasonFlags Reasons
|
||||
{
|
||||
get { return reasons; }
|
||||
}
|
||||
|
||||
public GeneralNames CrlIssuer
|
||||
{
|
||||
get { return cRLIssuer; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
// As this is a CHOICE it must be explicitly tagged
|
||||
v.AddOptionalTagged(true, 0, distributionPoint);
|
||||
|
||||
v.AddOptionalTagged(false, 1, reasons);
|
||||
v.AddOptionalTagged(false, 2, cRLIssuer);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("DistributionPoint: [");
|
||||
if (distributionPoint != null)
|
||||
{
|
||||
AppendObject(buf, "distributionPoint", distributionPoint.ToString());
|
||||
}
|
||||
if (reasons != null)
|
||||
{
|
||||
AppendObject(buf, "reasons", reasons.ToString());
|
||||
}
|
||||
if (cRLIssuer != null)
|
||||
{
|
||||
AppendObject(buf, "cRLIssuer", cRLIssuer.ToString());
|
||||
}
|
||||
buf.AppendLine("]");
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
private void AppendObject(StringBuilder buf, string name, string val)
|
||||
{
|
||||
string indent = " ";
|
||||
buf.Append(indent);
|
||||
buf.Append(name);
|
||||
buf.AppendLine(":");
|
||||
buf.Append(indent);
|
||||
buf.Append(indent);
|
||||
buf.Append(val);
|
||||
buf.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPoint.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPoint.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e885999cc3e152947ab893f8f57a8e0f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPoint.cs
|
||||
uploadId: 783279
|
||||
125
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPointName.cs
vendored
Normal file
125
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPointName.cs
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The DistributionPointName object.
|
||||
* <pre>
|
||||
* DistributionPointName ::= CHOICE {
|
||||
* fullName [0] GeneralNames,
|
||||
* nameRelativeToCRLIssuer [1] RDN
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class DistributionPointName
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
internal readonly Asn1Encodable name;
|
||||
internal readonly int type;
|
||||
|
||||
public const int FullName = 0;
|
||||
public const int NameRelativeToCrlIssuer = 1;
|
||||
|
||||
public static DistributionPointName GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1TaggedObject.GetInstance(obj, true));
|
||||
}
|
||||
|
||||
public static DistributionPointName GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is DistributionPointName)
|
||||
{
|
||||
return (DistributionPointName) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
return new DistributionPointName((Asn1TaggedObject) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public DistributionPointName(
|
||||
int type,
|
||||
Asn1Encodable name)
|
||||
{
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public DistributionPointName(
|
||||
GeneralNames name)
|
||||
: this(FullName, name)
|
||||
{
|
||||
}
|
||||
|
||||
public int PointType
|
||||
{
|
||||
get { return type; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Name
|
||||
{
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public DistributionPointName(
|
||||
Asn1TaggedObject obj)
|
||||
{
|
||||
this.type = obj.TagNo;
|
||||
|
||||
if (type == FullName)
|
||||
{
|
||||
this.name = GeneralNames.GetInstance(obj, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.name = Asn1Set.GetInstance(obj, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerTaggedObject(false, type, name);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("DistributionPointName: [");
|
||||
if (type == FullName)
|
||||
{
|
||||
AppendObject(buf, "fullName", name.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AppendObject(buf, "nameRelativeToCRLIssuer", name.ToString());
|
||||
}
|
||||
buf.AppendLine("]");
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
private void AppendObject(StringBuilder buf, string name, string val)
|
||||
{
|
||||
string indent = " ";
|
||||
buf.Append(indent);
|
||||
buf.Append(name);
|
||||
buf.AppendLine(":");
|
||||
buf.Append(indent);
|
||||
buf.Append(indent);
|
||||
buf.Append(val);
|
||||
buf.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPointName.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPointName.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9c30e3e050194f438209cb9f2513aef
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/DistributionPointName.cs
|
||||
uploadId: 783279
|
||||
110
Runtime/3rdParty/BouncyCastle/asn1/x509/ExtendedKeyUsage.cs
vendored
Normal file
110
Runtime/3rdParty/BouncyCastle/asn1/x509/ExtendedKeyUsage.cs
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The extendedKeyUsage object.
|
||||
* <pre>
|
||||
* extendedKeyUsage ::= Sequence SIZE (1..MAX) OF KeyPurposeId
|
||||
* </pre>
|
||||
*/
|
||||
public class ExtendedKeyUsage
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static ExtendedKeyUsage GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static ExtendedKeyUsage GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is ExtendedKeyUsage)
|
||||
return (ExtendedKeyUsage)obj;
|
||||
if (obj is X509Extension)
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new ExtendedKeyUsage(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static ExtendedKeyUsage FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.ExtendedKeyUsage));
|
||||
}
|
||||
|
||||
internal readonly ISet<DerObjectIdentifier> m_usageTable = new HashSet<DerObjectIdentifier>();
|
||||
internal readonly Asn1Sequence seq;
|
||||
|
||||
private ExtendedKeyUsage(Asn1Sequence seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
|
||||
foreach (Asn1Encodable element in seq)
|
||||
{
|
||||
DerObjectIdentifier oid = DerObjectIdentifier.GetInstance(element);
|
||||
|
||||
m_usageTable.Add(oid);
|
||||
}
|
||||
}
|
||||
|
||||
public ExtendedKeyUsage(params KeyPurposeID[] usages)
|
||||
{
|
||||
this.seq = new DerSequence(usages);
|
||||
|
||||
foreach (KeyPurposeID usage in usages)
|
||||
{
|
||||
m_usageTable.Add(usage);
|
||||
}
|
||||
}
|
||||
|
||||
public ExtendedKeyUsage(IEnumerable<DerObjectIdentifier> usages)
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
foreach (object usage in usages)
|
||||
{
|
||||
DerObjectIdentifier oid = DerObjectIdentifier.GetInstance(usage);
|
||||
|
||||
v.Add(oid);
|
||||
m_usageTable.Add(oid);
|
||||
}
|
||||
|
||||
this.seq = new DerSequence(v);
|
||||
}
|
||||
|
||||
public bool HasKeyPurposeId(KeyPurposeID keyPurposeId)
|
||||
{
|
||||
return m_usageTable.Contains(keyPurposeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all extended key usages.
|
||||
* The returned ArrayList contains DerObjectIdentifier instances.
|
||||
* @return An ArrayList with all key purposes.
|
||||
*/
|
||||
public IList<DerObjectIdentifier> GetAllUsages()
|
||||
{
|
||||
return new List<DerObjectIdentifier>(m_usageTable);
|
||||
}
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return m_usageTable.Count; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ExtendedKeyUsage.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ExtendedKeyUsage.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1913c7df77aefb428f36b84750ec38d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/ExtendedKeyUsage.cs
|
||||
uploadId: 783279
|
||||
427
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralName.cs
vendored
Normal file
427
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralName.cs
vendored
Normal file
@ -0,0 +1,427 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using NetUtils = Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Net;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The GeneralName object.
|
||||
* <pre>
|
||||
* GeneralName ::= CHOICE {
|
||||
* otherName [0] OtherName,
|
||||
* rfc822Name [1] IA5String,
|
||||
* dNSName [2] IA5String,
|
||||
* x400Address [3] ORAddress,
|
||||
* directoryName [4] Name,
|
||||
* ediPartyName [5] EDIPartyName,
|
||||
* uniformResourceIdentifier [6] IA5String,
|
||||
* iPAddress [7] OCTET STRING,
|
||||
* registeredID [8] OBJECT IDENTIFIER}
|
||||
*
|
||||
* OtherName ::= Sequence {
|
||||
* type-id OBJECT IDENTIFIER,
|
||||
* value [0] EXPLICIT ANY DEFINED BY type-id }
|
||||
*
|
||||
* EDIPartyName ::= Sequence {
|
||||
* nameAssigner [0] DirectoryString OPTIONAL,
|
||||
* partyName [1] DirectoryString }
|
||||
* </pre>
|
||||
*/
|
||||
public class GeneralName
|
||||
: Asn1Encodable, IAsn1Choice
|
||||
{
|
||||
public const int OtherName = 0;
|
||||
public const int Rfc822Name = 1;
|
||||
public const int DnsName = 2;
|
||||
public const int X400Address = 3;
|
||||
public const int DirectoryName = 4;
|
||||
public const int EdiPartyName = 5;
|
||||
public const int UniformResourceIdentifier = 6;
|
||||
public const int IPAddress = 7;
|
||||
public const int RegisteredID = 8;
|
||||
|
||||
internal readonly Asn1Encodable obj;
|
||||
internal readonly int tag;
|
||||
|
||||
public GeneralName(
|
||||
X509Name directoryName)
|
||||
{
|
||||
this.obj = directoryName;
|
||||
this.tag = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* When the subjectAltName extension contains an Internet mail address,
|
||||
* the address MUST be included as an rfc822Name. The format of an
|
||||
* rfc822Name is an "addr-spec" as defined in RFC 822 [RFC 822].
|
||||
*
|
||||
* When the subjectAltName extension contains a domain name service
|
||||
* label, the domain name MUST be stored in the dNSName (an IA5String).
|
||||
* The name MUST be in the "preferred name syntax," as specified by RFC
|
||||
* 1034 [RFC 1034].
|
||||
*
|
||||
* When the subjectAltName extension contains a URI, the name MUST be
|
||||
* stored in the uniformResourceIdentifier (an IA5String). The name MUST
|
||||
* be a non-relative URL, and MUST follow the URL syntax and encoding
|
||||
* rules specified in [RFC 1738]. The name must include both a scheme
|
||||
* (e.g., "http" or "ftp") and a scheme-specific-part. The scheme-
|
||||
* specific-part must include a fully qualified domain name or IP
|
||||
* address as the host.
|
||||
*
|
||||
* When the subjectAltName extension contains a iPAddress, the address
|
||||
* MUST be stored in the octet string in "network byte order," as
|
||||
* specified in RFC 791 [RFC 791]. The least significant bit (LSB) of
|
||||
* each octet is the LSB of the corresponding byte in the network
|
||||
* address. For IP Version 4, as specified in RFC 791, the octet string
|
||||
* MUST contain exactly four octets. For IP Version 6, as specified in
|
||||
* RFC 1883, the octet string MUST contain exactly sixteen octets [RFC
|
||||
* 1883].
|
||||
*/
|
||||
public GeneralName(
|
||||
Asn1Object name,
|
||||
int tag)
|
||||
{
|
||||
this.obj = name;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public GeneralName(
|
||||
int tag,
|
||||
Asn1Encodable name)
|
||||
{
|
||||
this.obj = name;
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a GeneralName for the given tag from the passed in string.
|
||||
* <p>
|
||||
* This constructor can handle:
|
||||
* <ul>
|
||||
* <li>rfc822Name</li>
|
||||
* <li>iPAddress</li>
|
||||
* <li>directoryName</li>
|
||||
* <li>dNSName</li>
|
||||
* <li>uniformResourceIdentifier</li>
|
||||
* <li>registeredID</li>
|
||||
* </ul>
|
||||
* For x400Address, otherName and ediPartyName there is no common string
|
||||
* format defined.
|
||||
* </p><p>
|
||||
* Note: A directory name can be encoded in different ways into a byte
|
||||
* representation. Be aware of this if the byte representation is used for
|
||||
* comparing results.
|
||||
* </p>
|
||||
*
|
||||
* @param tag tag number
|
||||
* @param name string representation of name
|
||||
* @throws ArgumentException if the string encoding is not correct or
|
||||
* not supported.
|
||||
*/
|
||||
public GeneralName(
|
||||
int tag,
|
||||
string name)
|
||||
{
|
||||
this.tag = tag;
|
||||
|
||||
if (tag == Rfc822Name || tag == DnsName || tag == UniformResourceIdentifier)
|
||||
{
|
||||
this.obj = new DerIA5String(name);
|
||||
}
|
||||
else if (tag == RegisteredID)
|
||||
{
|
||||
this.obj = new DerObjectIdentifier(name);
|
||||
}
|
||||
else if (tag == DirectoryName)
|
||||
{
|
||||
this.obj = new X509Name(name);
|
||||
}
|
||||
else if (tag == IPAddress)
|
||||
{
|
||||
byte[] enc = toGeneralNameEncoding(name);
|
||||
if (enc == null)
|
||||
throw new ArgumentException("IP Address is invalid", "name");
|
||||
|
||||
this.obj = new DerOctetString(enc);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("can't process string for tag: " + tag, "tag");
|
||||
}
|
||||
}
|
||||
|
||||
public static GeneralName GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is GeneralName)
|
||||
{
|
||||
return (GeneralName) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
Asn1TaggedObject tagObj = (Asn1TaggedObject) obj;
|
||||
int tag = tagObj.TagNo;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case EdiPartyName:
|
||||
case OtherName:
|
||||
case X400Address:
|
||||
return new GeneralName(tag, Asn1Sequence.GetInstance(tagObj, false));
|
||||
|
||||
case DnsName:
|
||||
case Rfc822Name:
|
||||
case UniformResourceIdentifier:
|
||||
return new GeneralName(tag, DerIA5String.GetInstance(tagObj, false));
|
||||
|
||||
case DirectoryName:
|
||||
return new GeneralName(tag, X509Name.GetInstance(tagObj, true));
|
||||
case IPAddress:
|
||||
return new GeneralName(tag, Asn1OctetString.GetInstance(tagObj, false));
|
||||
case RegisteredID:
|
||||
return new GeneralName(tag, DerObjectIdentifier.GetInstance(tagObj, false));
|
||||
|
||||
default:
|
||||
throw new ArgumentException("unknown tag: " + tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (obj is byte[])
|
||||
{
|
||||
try
|
||||
{
|
||||
return GetInstance(Asn1Object.FromByteArray((byte[])obj));
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
throw new ArgumentException("unable to parse encoded general name");
|
||||
}
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in GetInstance: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static GeneralName GetInstance(
|
||||
Asn1TaggedObject tagObj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1TaggedObject.GetInstance(tagObj, true));
|
||||
}
|
||||
|
||||
public int TagNo
|
||||
{
|
||||
get { return tag; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Name
|
||||
{
|
||||
get { return obj; }
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.Append(tag);
|
||||
buf.Append(": ");
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case Rfc822Name:
|
||||
case DnsName:
|
||||
case UniformResourceIdentifier:
|
||||
buf.Append(DerIA5String.GetInstance(obj).GetString());
|
||||
break;
|
||||
case DirectoryName:
|
||||
buf.Append(X509Name.GetInstance(obj).ToString());
|
||||
break;
|
||||
default:
|
||||
buf.Append(obj.ToString());
|
||||
break;
|
||||
}
|
||||
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
private byte[] toGeneralNameEncoding(
|
||||
string ip)
|
||||
{
|
||||
if (NetUtils.IPAddress.IsValidIPv6WithNetmask(ip) || NetUtils.IPAddress.IsValidIPv6(ip))
|
||||
{
|
||||
int slashIndex = ip.IndexOf('/');
|
||||
|
||||
if (slashIndex < 0)
|
||||
{
|
||||
byte[] addr = new byte[16];
|
||||
int[] parsedIp = parseIPv6(ip);
|
||||
copyInts(parsedIp, addr, 0);
|
||||
|
||||
return addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] addr = new byte[32];
|
||||
int[] parsedIp = parseIPv6(ip.Substring(0, slashIndex));
|
||||
copyInts(parsedIp, addr, 0);
|
||||
string mask = ip.Substring(slashIndex + 1);
|
||||
if (mask.IndexOf(':') > 0)
|
||||
{
|
||||
parsedIp = parseIPv6(mask);
|
||||
}
|
||||
else
|
||||
{
|
||||
parsedIp = parseMask(mask);
|
||||
}
|
||||
copyInts(parsedIp, addr, 16);
|
||||
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
else if (NetUtils.IPAddress.IsValidIPv4WithNetmask(ip) || NetUtils.IPAddress.IsValidIPv4(ip))
|
||||
{
|
||||
int slashIndex = ip.IndexOf('/');
|
||||
|
||||
if (slashIndex < 0)
|
||||
{
|
||||
byte[] addr = new byte[4];
|
||||
|
||||
parseIPv4(ip, addr, 0);
|
||||
|
||||
return addr;
|
||||
}
|
||||
else
|
||||
{
|
||||
byte[] addr = new byte[8];
|
||||
|
||||
parseIPv4(ip.Substring(0, slashIndex), addr, 0);
|
||||
|
||||
string mask = ip.Substring(slashIndex + 1);
|
||||
if (mask.IndexOf('.') > 0)
|
||||
{
|
||||
parseIPv4(mask, addr, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
parseIPv4Mask(mask, addr, 4);
|
||||
}
|
||||
|
||||
return addr;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void parseIPv4Mask(string mask, byte[] addr, int offset)
|
||||
{
|
||||
int maskVal = int.Parse(mask);
|
||||
|
||||
for (int i = 0; i != maskVal; i++)
|
||||
{
|
||||
addr[(i / 8) + offset] |= (byte)(1 << (i % 8));
|
||||
}
|
||||
}
|
||||
|
||||
private void parseIPv4(string ip, byte[] addr, int offset)
|
||||
{
|
||||
foreach (string token in ip.Split('.', '/'))
|
||||
{
|
||||
addr[offset++] = (byte)int.Parse(token);
|
||||
}
|
||||
}
|
||||
|
||||
private int[] parseMask(string mask)
|
||||
{
|
||||
int[] res = new int[8];
|
||||
int maskVal = int.Parse(mask);
|
||||
|
||||
for (int i = 0; i != maskVal; i++)
|
||||
{
|
||||
res[i / 16] |= 1 << (i % 16);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private void copyInts(int[] parsedIp, byte[] addr, int offSet)
|
||||
{
|
||||
for (int i = 0; i != parsedIp.Length; i++)
|
||||
{
|
||||
addr[(i * 2) + offSet] = (byte)(parsedIp[i] >> 8);
|
||||
addr[(i * 2 + 1) + offSet] = (byte)parsedIp[i];
|
||||
}
|
||||
}
|
||||
|
||||
private int[] parseIPv6(string ip)
|
||||
{
|
||||
if (Org.BouncyCastle.Utilities.Platform.StartsWith(ip, "::"))
|
||||
{
|
||||
ip = ip.Substring(1);
|
||||
}
|
||||
else if (Org.BouncyCastle.Utilities.Platform.EndsWith(ip, "::"))
|
||||
{
|
||||
ip = ip.Substring(0, ip.Length - 1);
|
||||
}
|
||||
|
||||
IEnumerable<string> split = ip.Split(':');
|
||||
var sEnum = split.GetEnumerator();
|
||||
|
||||
int index = 0;
|
||||
int[] val = new int[8];
|
||||
|
||||
int doubleColon = -1;
|
||||
|
||||
while (sEnum.MoveNext())
|
||||
{
|
||||
string e = sEnum.Current;
|
||||
|
||||
if (e.Length == 0)
|
||||
{
|
||||
doubleColon = index;
|
||||
val[index++] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.IndexOf('.') < 0)
|
||||
{
|
||||
val[index++] = int.Parse(e, NumberStyles.AllowHexSpecifier);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] tokens = e.Split('.');
|
||||
|
||||
val[index++] = (int.Parse(tokens[0]) << 8) | int.Parse(tokens[1]);
|
||||
val[index++] = (int.Parse(tokens[2]) << 8) | int.Parse(tokens[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (index != val.Length)
|
||||
{
|
||||
Array.Copy(val, doubleColon, val, val.Length - (index - doubleColon), index - doubleColon);
|
||||
for (int i = doubleColon; i != val.Length - (index - doubleColon); i++)
|
||||
{
|
||||
val[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
// directoryName is explicitly tagged as it is a CHOICE
|
||||
bool isExplicit = (tag == DirectoryName);
|
||||
|
||||
return new DerTaggedObject(isExplicit, tag, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralName.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralName.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4b6d66f1447ffc478cc6d4c16a67b06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralName.cs
|
||||
uploadId: 783279
|
||||
95
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralNames.cs
vendored
Normal file
95
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralNames.cs
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class GeneralNames
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static GeneralName[] Copy(GeneralName[] names)
|
||||
{
|
||||
return (GeneralName[])names.Clone();
|
||||
}
|
||||
|
||||
public static GeneralNames GetInstance(object obj)
|
||||
{
|
||||
if (obj is GeneralNames)
|
||||
return (GeneralNames)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new GeneralNames(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static GeneralNames GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static GeneralNames FromExtensions(X509Extensions extensions, DerObjectIdentifier extOid)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, extOid));
|
||||
}
|
||||
|
||||
private readonly GeneralName[] names;
|
||||
|
||||
/// <summary>Construct a GeneralNames object containing one GeneralName.</summary>
|
||||
/// <param name="name">The name to be contained.</param>
|
||||
public GeneralNames(
|
||||
GeneralName name)
|
||||
{
|
||||
names = new GeneralName[]{ name };
|
||||
}
|
||||
|
||||
public GeneralNames(
|
||||
GeneralName[] names)
|
||||
{
|
||||
this.names = Copy(names);
|
||||
}
|
||||
|
||||
private GeneralNames(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.names = new GeneralName[seq.Count];
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
names[i] = GeneralName.GetInstance(seq[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public GeneralName[] GetNames()
|
||||
{
|
||||
return Copy(names);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* GeneralNames ::= Sequence SIZE {1..MAX} OF GeneralName
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(names);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("GeneralNames:");
|
||||
foreach (GeneralName name in names)
|
||||
{
|
||||
buf.Append(" ")
|
||||
.Append(name)
|
||||
.AppendLine();
|
||||
}
|
||||
return buf.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralNames.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralNames.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62b8cbb97ae194e4d95690a4f7e9d87d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralNames.cs
|
||||
uploadId: 783279
|
||||
189
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralSubtree.cs
vendored
Normal file
189
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralSubtree.cs
vendored
Normal file
@ -0,0 +1,189 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* Class for containing a restriction object subtrees in NameConstraints. See
|
||||
* RFC 3280.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* GeneralSubtree ::= SEQUENCE
|
||||
* {
|
||||
* baseName GeneralName,
|
||||
* minimum [0] BaseDistance DEFAULT 0,
|
||||
* maximum [1] BaseDistance OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @see org.bouncycastle.asn1.x509.NameConstraints
|
||||
*
|
||||
*/
|
||||
public class GeneralSubtree
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly GeneralName baseName;
|
||||
private readonly DerInteger minimum;
|
||||
private readonly DerInteger maximum;
|
||||
|
||||
private GeneralSubtree(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
baseName = GeneralName.GetInstance(seq[0]);
|
||||
|
||||
switch (seq.Count)
|
||||
{
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[1]);
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0:
|
||||
minimum = DerInteger.GetInstance(o, false);
|
||||
break;
|
||||
case 1:
|
||||
maximum = DerInteger.GetInstance(o, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Bad tag number: " + o.TagNo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
{
|
||||
Asn1TaggedObject oMin = Asn1TaggedObject.GetInstance(seq[1]);
|
||||
if (oMin.TagNo != 0)
|
||||
throw new ArgumentException("Bad tag number for 'minimum': " + oMin.TagNo);
|
||||
minimum = DerInteger.GetInstance(oMin, false);
|
||||
}
|
||||
|
||||
{
|
||||
Asn1TaggedObject oMax = Asn1TaggedObject.GetInstance(seq[2]);
|
||||
if (oMax.TagNo != 1)
|
||||
throw new ArgumentException("Bad tag number for 'maximum': " + oMax.TagNo);
|
||||
maximum = DerInteger.GetInstance(oMax, false);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from a given details.
|
||||
*
|
||||
* According RFC 3280, the minimum and maximum fields are not used with any
|
||||
* name forms, thus minimum MUST be zero, and maximum MUST be absent.
|
||||
* <p>
|
||||
* If minimum is <code>null</code>, zero is assumed, if
|
||||
* maximum is <code>null</code>, maximum is absent.</p>
|
||||
*
|
||||
* @param baseName
|
||||
* A restriction.
|
||||
* @param minimum
|
||||
* Minimum
|
||||
*
|
||||
* @param maximum
|
||||
* Maximum
|
||||
*/
|
||||
public GeneralSubtree(
|
||||
GeneralName baseName,
|
||||
BigInteger minimum,
|
||||
BigInteger maximum)
|
||||
{
|
||||
this.baseName = baseName;
|
||||
if (minimum != null)
|
||||
{
|
||||
this.minimum = new DerInteger(minimum);
|
||||
}
|
||||
if (maximum != null)
|
||||
{
|
||||
this.maximum = new DerInteger(maximum);
|
||||
}
|
||||
}
|
||||
|
||||
public GeneralSubtree(
|
||||
GeneralName baseName)
|
||||
: this(baseName, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public static GeneralSubtree GetInstance(
|
||||
Asn1TaggedObject o,
|
||||
bool isExplicit)
|
||||
{
|
||||
return new GeneralSubtree(Asn1Sequence.GetInstance(o, isExplicit));
|
||||
}
|
||||
|
||||
public static GeneralSubtree GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (obj is GeneralSubtree)
|
||||
{
|
||||
return (GeneralSubtree) obj;
|
||||
}
|
||||
|
||||
return new GeneralSubtree(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public GeneralName Base
|
||||
{
|
||||
get { return baseName; }
|
||||
}
|
||||
|
||||
public BigInteger Minimum
|
||||
{
|
||||
get { return minimum == null ? BigInteger.Zero : minimum.Value; }
|
||||
}
|
||||
|
||||
public BigInteger Maximum
|
||||
{
|
||||
get { return maximum == null ? null : maximum.Value; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* <pre>
|
||||
* GeneralSubtree ::= SEQUENCE
|
||||
* {
|
||||
* baseName GeneralName,
|
||||
* minimum [0] BaseDistance DEFAULT 0,
|
||||
* maximum [1] BaseDistance OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @return a DERObject
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(baseName);
|
||||
|
||||
if (minimum != null && !minimum.HasValue(0))
|
||||
{
|
||||
v.Add(new DerTaggedObject(false, 0, minimum));
|
||||
}
|
||||
|
||||
v.AddOptionalTagged(false, 1, maximum);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralSubtree.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralSubtree.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26ba6b294d0437245a0732c51a1ea924
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/GeneralSubtree.cs
|
||||
uploadId: 783279
|
||||
250
Runtime/3rdParty/BouncyCastle/asn1/x509/Holder.cs
vendored
Normal file
250
Runtime/3rdParty/BouncyCastle/asn1/x509/Holder.cs
vendored
Normal file
@ -0,0 +1,250 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* The Holder object.
|
||||
* <p>
|
||||
* For an v2 attribute certificate this is:
|
||||
*
|
||||
* <pre>
|
||||
* Holder ::= SEQUENCE {
|
||||
* baseCertificateID [0] IssuerSerial OPTIONAL,
|
||||
* -- the issuer and serial number of
|
||||
* -- the holder's Public Key Certificate
|
||||
* entityName [1] GeneralNames OPTIONAL,
|
||||
* -- the name of the claimant or role
|
||||
* objectDigestInfo [2] ObjectDigestInfo OPTIONAL
|
||||
* -- used to directly authenticate the holder,
|
||||
* -- for example, an executable
|
||||
* }
|
||||
* </pre>
|
||||
* </p>
|
||||
* <p>
|
||||
* For an v1 attribute certificate this is:
|
||||
*
|
||||
* <pre>
|
||||
* subject CHOICE {
|
||||
* baseCertificateID [0] EXPLICIT IssuerSerial,
|
||||
* -- associated with a Public Key Certificate
|
||||
* subjectName [1] EXPLICIT GeneralNames },
|
||||
* -- associated with a name
|
||||
* </pre>
|
||||
* </p>
|
||||
*/
|
||||
public class Holder
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal readonly IssuerSerial baseCertificateID;
|
||||
internal readonly GeneralNames entityName;
|
||||
internal readonly ObjectDigestInfo objectDigestInfo;
|
||||
private readonly int version;
|
||||
|
||||
public static Holder GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is Holder)
|
||||
{
|
||||
return (Holder) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new Holder((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
if (obj is Asn1TaggedObject)
|
||||
{
|
||||
return new Holder((Asn1TaggedObject) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a holder for an v1 attribute certificate.
|
||||
*
|
||||
* @param tagObj The ASN.1 tagged holder object.
|
||||
*/
|
||||
public Holder(
|
||||
Asn1TaggedObject tagObj)
|
||||
{
|
||||
switch (tagObj.TagNo)
|
||||
{
|
||||
case 0:
|
||||
baseCertificateID = IssuerSerial.GetInstance(tagObj, true);
|
||||
break;
|
||||
case 1:
|
||||
entityName = GeneralNames.GetInstance(tagObj, true);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag in Holder");
|
||||
}
|
||||
|
||||
this.version = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a holder for an v2 attribute certificate. *
|
||||
*
|
||||
* @param seq The ASN.1 sequence.
|
||||
*/
|
||||
private Holder(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count > 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject tObj = Asn1TaggedObject.GetInstance(seq[i]);
|
||||
|
||||
switch (tObj.TagNo)
|
||||
{
|
||||
case 0:
|
||||
baseCertificateID = IssuerSerial.GetInstance(tObj, false);
|
||||
break;
|
||||
case 1:
|
||||
entityName = GeneralNames.GetInstance(tObj, false);
|
||||
break;
|
||||
case 2:
|
||||
objectDigestInfo = ObjectDigestInfo.GetInstance(tObj, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag in Holder");
|
||||
}
|
||||
}
|
||||
|
||||
this.version = 1;
|
||||
}
|
||||
|
||||
public Holder(
|
||||
IssuerSerial baseCertificateID)
|
||||
: this(baseCertificateID, 1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a holder from a IssuerSerial.
|
||||
* @param baseCertificateID The IssuerSerial.
|
||||
* @param version The version of the attribute certificate.
|
||||
*/
|
||||
public Holder(
|
||||
IssuerSerial baseCertificateID,
|
||||
int version)
|
||||
{
|
||||
this.baseCertificateID = baseCertificateID;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 1 for v2 attribute certificates or 0 for v1 attribute
|
||||
* certificates.
|
||||
* @return The version of the attribute certificate.
|
||||
*/
|
||||
public int Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a holder with an entityName for v2 attribute certificates or
|
||||
* with a subjectName for v1 attribute certificates.
|
||||
*
|
||||
* @param entityName The entity or subject name.
|
||||
*/
|
||||
public Holder(
|
||||
GeneralNames entityName)
|
||||
: this(entityName, 1)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a holder with an entityName for v2 attribute certificates or
|
||||
* with a subjectName for v1 attribute certificates.
|
||||
*
|
||||
* @param entityName The entity or subject name.
|
||||
* @param version The version of the attribute certificate.
|
||||
*/
|
||||
public Holder(
|
||||
GeneralNames entityName,
|
||||
int version)
|
||||
{
|
||||
this.entityName = entityName;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a holder from an object digest info.
|
||||
*
|
||||
* @param objectDigestInfo The object digest info object.
|
||||
*/
|
||||
public Holder(
|
||||
ObjectDigestInfo objectDigestInfo)
|
||||
{
|
||||
this.objectDigestInfo = objectDigestInfo;
|
||||
this.version = 1;
|
||||
}
|
||||
|
||||
public IssuerSerial BaseCertificateID
|
||||
{
|
||||
get { return baseCertificateID; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entityName for an v2 attribute certificate or the subjectName
|
||||
* for an v1 attribute certificate.
|
||||
*
|
||||
* @return The entityname or subjectname.
|
||||
*/
|
||||
public GeneralNames EntityName
|
||||
{
|
||||
get { return entityName; }
|
||||
}
|
||||
|
||||
public ObjectDigestInfo ObjectDigestInfo
|
||||
{
|
||||
get { return objectDigestInfo; }
|
||||
}
|
||||
|
||||
/**
|
||||
* The Holder object.
|
||||
* <pre>
|
||||
* Holder ::= Sequence {
|
||||
* baseCertificateID [0] IssuerSerial OPTIONAL,
|
||||
* -- the issuer and serial number of
|
||||
* -- the holder's Public Key Certificate
|
||||
* entityName [1] GeneralNames OPTIONAL,
|
||||
* -- the name of the claimant or role
|
||||
* objectDigestInfo [2] ObjectDigestInfo OPTIONAL
|
||||
* -- used to directly authenticate the holder,
|
||||
* -- for example, an executable
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
if (version == 1)
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(3);
|
||||
v.AddOptionalTagged(false, 0, baseCertificateID);
|
||||
v.AddOptionalTagged(false, 1, entityName);
|
||||
v.AddOptionalTagged(false, 2, objectDigestInfo);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
if (entityName != null)
|
||||
{
|
||||
return new DerTaggedObject(true, 1, entityName);
|
||||
}
|
||||
|
||||
return new DerTaggedObject(true, 0, baseCertificateID);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/Holder.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/Holder.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87729a565cf00014a8d55f27e4fdd8c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/Holder.cs
|
||||
uploadId: 783279
|
||||
156
Runtime/3rdParty/BouncyCastle/asn1/x509/IetfAttrSyntax.cs
vendored
Normal file
156
Runtime/3rdParty/BouncyCastle/asn1/x509/IetfAttrSyntax.cs
vendored
Normal file
@ -0,0 +1,156 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* Implementation of <code>IetfAttrSyntax</code> as specified by RFC3281.
|
||||
*/
|
||||
public class IetfAttrSyntax
|
||||
: Asn1Encodable
|
||||
{
|
||||
public const int ValueOctets = 1;
|
||||
public const int ValueOid = 2;
|
||||
public const int ValueUtf8 = 3;
|
||||
|
||||
internal readonly GeneralNames policyAuthority;
|
||||
internal readonly Asn1EncodableVector values = new Asn1EncodableVector();
|
||||
|
||||
internal int valueChoice = -1;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public IetfAttrSyntax(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
if (seq[0] is Asn1TaggedObject)
|
||||
{
|
||||
policyAuthority = GeneralNames.GetInstance(((Asn1TaggedObject)seq[0]), false);
|
||||
i++;
|
||||
}
|
||||
else if (seq.Count == 2)
|
||||
{ // VOMS fix
|
||||
policyAuthority = GeneralNames.GetInstance(seq[0]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (!(seq[i] is Asn1Sequence))
|
||||
{
|
||||
throw new ArgumentException("Non-IetfAttrSyntax encoding");
|
||||
}
|
||||
|
||||
seq = (Asn1Sequence) seq[i];
|
||||
|
||||
foreach (Asn1Object obj in seq)
|
||||
{
|
||||
int type;
|
||||
|
||||
if (obj is DerObjectIdentifier)
|
||||
{
|
||||
type = ValueOid;
|
||||
}
|
||||
else if (obj is DerUtf8String)
|
||||
{
|
||||
type = ValueUtf8;
|
||||
}
|
||||
else if (obj is DerOctetString)
|
||||
{
|
||||
type = ValueOctets;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("Bad value type encoding IetfAttrSyntax");
|
||||
}
|
||||
|
||||
if (valueChoice < 0)
|
||||
{
|
||||
valueChoice = type;
|
||||
}
|
||||
|
||||
if (type != valueChoice)
|
||||
{
|
||||
throw new ArgumentException("Mix of value types in IetfAttrSyntax");
|
||||
}
|
||||
|
||||
values.Add(obj);
|
||||
}
|
||||
}
|
||||
|
||||
public GeneralNames PolicyAuthority
|
||||
{
|
||||
get { return policyAuthority; }
|
||||
}
|
||||
|
||||
public int ValueType
|
||||
{
|
||||
get { return valueChoice; }
|
||||
}
|
||||
|
||||
public object[] GetValues()
|
||||
{
|
||||
if (this.ValueType == ValueOctets)
|
||||
{
|
||||
Asn1OctetString[] tmp = new Asn1OctetString[values.Count];
|
||||
|
||||
for (int i = 0; i != tmp.Length; i++)
|
||||
{
|
||||
tmp[i] = (Asn1OctetString) values[i];
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
if (this.ValueType == ValueOid)
|
||||
{
|
||||
DerObjectIdentifier[] tmp = new DerObjectIdentifier[values.Count];
|
||||
|
||||
for (int i = 0; i != tmp.Length; i++)
|
||||
{
|
||||
tmp[i] = (DerObjectIdentifier) values[i];
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
{
|
||||
DerUtf8String[] tmp = new DerUtf8String[values.Count];
|
||||
|
||||
for (int i = 0; i != tmp.Length; i++)
|
||||
{
|
||||
tmp[i] = (DerUtf8String) values[i];
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* IetfAttrSyntax ::= Sequence {
|
||||
* policyAuthority [0] GeneralNames OPTIONAL,
|
||||
* values Sequence OF CHOICE {
|
||||
* octets OCTET STRING,
|
||||
* oid OBJECT IDENTIFIER,
|
||||
* string UTF8String
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(true, 0, policyAuthority);
|
||||
v.Add(new DerSequence(values));
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IetfAttrSyntax.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IetfAttrSyntax.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8fd2111883da7e247add4fa9224dd419
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/IetfAttrSyntax.cs
|
||||
uploadId: 783279
|
||||
98
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuerSerial.cs
vendored
Normal file
98
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuerSerial.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.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class IssuerSerial
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal readonly GeneralNames issuer;
|
||||
internal readonly DerInteger serial;
|
||||
internal readonly DerBitString issuerUid;
|
||||
|
||||
public static IssuerSerial GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is IssuerSerial)
|
||||
{
|
||||
return (IssuerSerial) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new IssuerSerial((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static IssuerSerial GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
private IssuerSerial(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2 && seq.Count != 3)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
issuer = GeneralNames.GetInstance(seq[0]);
|
||||
serial = DerInteger.GetInstance(seq[1]);
|
||||
|
||||
if (seq.Count == 3)
|
||||
{
|
||||
issuerUid = DerBitString.GetInstance(seq[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public IssuerSerial(
|
||||
GeneralNames issuer,
|
||||
DerInteger serial)
|
||||
{
|
||||
this.issuer = issuer;
|
||||
this.serial = serial;
|
||||
}
|
||||
|
||||
public GeneralNames Issuer
|
||||
{
|
||||
get { return issuer; }
|
||||
}
|
||||
|
||||
public DerInteger Serial
|
||||
{
|
||||
get { return serial; }
|
||||
}
|
||||
|
||||
public DerBitString IssuerUid
|
||||
{
|
||||
get { return issuerUid; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* IssuerSerial ::= Sequence {
|
||||
* issuer GeneralNames,
|
||||
* serial CertificateSerialNumber,
|
||||
* issuerUid UniqueIdentifier OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(issuer, serial);
|
||||
v.AddOptional(issuerUid);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuerSerial.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuerSerial.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9309f0a3bd9c834479ae668b0b8d31a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/IssuerSerial.cs
|
||||
uploadId: 783279
|
||||
241
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuingDistributionPoint.cs
vendored
Normal file
241
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuingDistributionPoint.cs
vendored
Normal file
@ -0,0 +1,241 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* <pre>
|
||||
* IssuingDistributionPoint ::= SEQUENCE {
|
||||
* distributionPoint [0] DistributionPointName OPTIONAL,
|
||||
* onlyContainsUserCerts [1] BOOLEAN DEFAULT FALSE,
|
||||
* onlyContainsCACerts [2] BOOLEAN DEFAULT FALSE,
|
||||
* onlySomeReasons [3] ReasonFlags OPTIONAL,
|
||||
* indirectCRL [4] BOOLEAN DEFAULT FALSE,
|
||||
* onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
|
||||
* </pre>
|
||||
*/
|
||||
public class IssuingDistributionPoint
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DistributionPointName _distributionPoint;
|
||||
private readonly bool _onlyContainsUserCerts;
|
||||
private readonly bool _onlyContainsCACerts;
|
||||
private readonly ReasonFlags _onlySomeReasons;
|
||||
private readonly bool _indirectCRL;
|
||||
private readonly bool _onlyContainsAttributeCerts;
|
||||
|
||||
private readonly Asn1Sequence seq;
|
||||
|
||||
public static IssuingDistributionPoint GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static IssuingDistributionPoint GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is IssuingDistributionPoint)
|
||||
{
|
||||
return (IssuingDistributionPoint) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new IssuingDistributionPoint((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from given details.
|
||||
*
|
||||
* @param distributionPoint
|
||||
* May contain an URI as pointer to most current CRL.
|
||||
* @param onlyContainsUserCerts Covers revocation information for end certificates.
|
||||
* @param onlyContainsCACerts Covers revocation information for CA certificates.
|
||||
*
|
||||
* @param onlySomeReasons
|
||||
* Which revocation reasons does this point cover.
|
||||
* @param indirectCRL
|
||||
* If <code>true</code> then the CRL contains revocation
|
||||
* information about certificates ssued by other CAs.
|
||||
* @param onlyContainsAttributeCerts Covers revocation information for attribute certificates.
|
||||
*/
|
||||
public IssuingDistributionPoint(
|
||||
DistributionPointName distributionPoint,
|
||||
bool onlyContainsUserCerts,
|
||||
bool onlyContainsCACerts,
|
||||
ReasonFlags onlySomeReasons,
|
||||
bool indirectCRL,
|
||||
bool onlyContainsAttributeCerts)
|
||||
{
|
||||
this._distributionPoint = distributionPoint;
|
||||
this._indirectCRL = indirectCRL;
|
||||
this._onlyContainsAttributeCerts = onlyContainsAttributeCerts;
|
||||
this._onlyContainsCACerts = onlyContainsCACerts;
|
||||
this._onlyContainsUserCerts = onlyContainsUserCerts;
|
||||
this._onlySomeReasons = onlySomeReasons;
|
||||
|
||||
Asn1EncodableVector vec = new Asn1EncodableVector();
|
||||
if (distributionPoint != null)
|
||||
{ // CHOICE item so explicitly tagged
|
||||
vec.Add(new DerTaggedObject(true, 0, distributionPoint));
|
||||
}
|
||||
if (onlyContainsUserCerts)
|
||||
{
|
||||
vec.Add(new DerTaggedObject(false, 1, DerBoolean.True));
|
||||
}
|
||||
if (onlyContainsCACerts)
|
||||
{
|
||||
vec.Add(new DerTaggedObject(false, 2, DerBoolean.True));
|
||||
}
|
||||
if (onlySomeReasons != null)
|
||||
{
|
||||
vec.Add(new DerTaggedObject(false, 3, onlySomeReasons));
|
||||
}
|
||||
if (indirectCRL)
|
||||
{
|
||||
vec.Add(new DerTaggedObject(false, 4, DerBoolean.True));
|
||||
}
|
||||
if (onlyContainsAttributeCerts)
|
||||
{
|
||||
vec.Add(new DerTaggedObject(false, 5, DerBoolean.True));
|
||||
}
|
||||
|
||||
seq = new DerSequence(vec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from Asn1Sequence
|
||||
*/
|
||||
private IssuingDistributionPoint(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject o = Asn1TaggedObject.GetInstance(seq[i]);
|
||||
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0:
|
||||
// CHOICE so explicit
|
||||
_distributionPoint = DistributionPointName.GetInstance(o, true);
|
||||
break;
|
||||
case 1:
|
||||
_onlyContainsUserCerts = DerBoolean.GetInstance(o, false).IsTrue;
|
||||
break;
|
||||
case 2:
|
||||
_onlyContainsCACerts = DerBoolean.GetInstance(o, false).IsTrue;
|
||||
break;
|
||||
case 3:
|
||||
_onlySomeReasons = new ReasonFlags(ReasonFlags.GetInstance(o, false));
|
||||
break;
|
||||
case 4:
|
||||
_indirectCRL = DerBoolean.GetInstance(o, false).IsTrue;
|
||||
break;
|
||||
case 5:
|
||||
_onlyContainsAttributeCerts = DerBoolean.GetInstance(o, false).IsTrue;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag in IssuingDistributionPoint");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnlyContainsUserCerts
|
||||
{
|
||||
get { return _onlyContainsUserCerts; }
|
||||
}
|
||||
|
||||
public bool OnlyContainsCACerts
|
||||
{
|
||||
get { return _onlyContainsCACerts; }
|
||||
}
|
||||
|
||||
public bool IsIndirectCrl
|
||||
{
|
||||
get { return _indirectCRL; }
|
||||
}
|
||||
|
||||
public bool OnlyContainsAttributeCerts
|
||||
{
|
||||
get { return _onlyContainsAttributeCerts; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the distributionPoint.
|
||||
*/
|
||||
public DistributionPointName DistributionPoint
|
||||
{
|
||||
get { return _distributionPoint; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the onlySomeReasons.
|
||||
*/
|
||||
public ReasonFlags OnlySomeReasons
|
||||
{
|
||||
get { return _onlySomeReasons; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.AppendLine("IssuingDistributionPoint: [");
|
||||
if (_distributionPoint != null)
|
||||
{
|
||||
AppendObject(buf, "distributionPoint", _distributionPoint.ToString());
|
||||
}
|
||||
if (_onlyContainsUserCerts)
|
||||
{
|
||||
AppendObject(buf, "onlyContainsUserCerts", _onlyContainsUserCerts.ToString());
|
||||
}
|
||||
if (_onlyContainsCACerts)
|
||||
{
|
||||
AppendObject(buf, "onlyContainsCACerts", _onlyContainsCACerts.ToString());
|
||||
}
|
||||
if (_onlySomeReasons != null)
|
||||
{
|
||||
AppendObject(buf, "onlySomeReasons", _onlySomeReasons.ToString());
|
||||
}
|
||||
if (_onlyContainsAttributeCerts)
|
||||
{
|
||||
AppendObject(buf, "onlyContainsAttributeCerts", _onlyContainsAttributeCerts.ToString());
|
||||
}
|
||||
if (_indirectCRL)
|
||||
{
|
||||
AppendObject(buf, "indirectCRL", _indirectCRL.ToString());
|
||||
}
|
||||
buf.AppendLine("]");
|
||||
return buf.ToString();
|
||||
}
|
||||
|
||||
private void AppendObject(StringBuilder buf, string name, string val)
|
||||
{
|
||||
string indent = " ";
|
||||
buf.Append(indent);
|
||||
buf.Append(name);
|
||||
buf.AppendLine(":");
|
||||
buf.Append(indent);
|
||||
buf.Append(indent);
|
||||
buf.Append(val);
|
||||
buf.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuingDistributionPoint.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/IssuingDistributionPoint.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c820e26e3cf663498bd64c4625d8a44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/IssuingDistributionPoint.cs
|
||||
uploadId: 783279
|
||||
100
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyPurposeId.cs
vendored
Normal file
100
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyPurposeId.cs
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The KeyPurposeID object.
|
||||
* <pre>
|
||||
* KeyPurposeID ::= OBJECT IDENTIFIER
|
||||
* </pre>
|
||||
*/
|
||||
public sealed class KeyPurposeID
|
||||
: DerObjectIdentifier
|
||||
{
|
||||
private const string id_kp = "1.3.6.1.5.5.7.3";
|
||||
|
||||
private KeyPurposeID(string id)
|
||||
: base(id)
|
||||
{
|
||||
}
|
||||
|
||||
public static readonly KeyPurposeID AnyExtendedKeyUsage = new KeyPurposeID(X509Extensions.ExtendedKeyUsage.Id + ".0");
|
||||
|
||||
public static readonly KeyPurposeID id_kp_serverAuth = new KeyPurposeID(id_kp + ".1");
|
||||
public static readonly KeyPurposeID id_kp_clientAuth = new KeyPurposeID(id_kp + ".2");
|
||||
public static readonly KeyPurposeID id_kp_codeSigning = new KeyPurposeID(id_kp + ".3");
|
||||
public static readonly KeyPurposeID id_kp_emailProtection = new KeyPurposeID(id_kp + ".4");
|
||||
public static readonly KeyPurposeID id_kp_ipsecEndSystem = new KeyPurposeID(id_kp + ".5");
|
||||
public static readonly KeyPurposeID id_kp_ipsecTunnel = new KeyPurposeID(id_kp + ".6");
|
||||
public static readonly KeyPurposeID id_kp_ipsecUser = new KeyPurposeID(id_kp + ".7");
|
||||
public static readonly KeyPurposeID id_kp_timeStamping = new KeyPurposeID(id_kp + ".8");
|
||||
public static readonly KeyPurposeID id_kp_OCSPSigning = new KeyPurposeID(id_kp + ".9");
|
||||
public static readonly KeyPurposeID id_kp_dvcs = new KeyPurposeID(id_kp + ".10");
|
||||
public static readonly KeyPurposeID id_kp_sbgpCertAAServerAuth = new KeyPurposeID(id_kp + ".11");
|
||||
public static readonly KeyPurposeID id_kp_scvp_responder = new KeyPurposeID(id_kp + ".12");
|
||||
public static readonly KeyPurposeID id_kp_eapOverPPP = new KeyPurposeID(id_kp + ".13");
|
||||
public static readonly KeyPurposeID id_kp_eapOverLAN = new KeyPurposeID(id_kp + ".14");
|
||||
public static readonly KeyPurposeID id_kp_scvpServer = new KeyPurposeID(id_kp + ".15");
|
||||
public static readonly KeyPurposeID id_kp_scvpClient = new KeyPurposeID(id_kp + ".16");
|
||||
public static readonly KeyPurposeID id_kp_ipsecIKE = new KeyPurposeID(id_kp + ".17");
|
||||
public static readonly KeyPurposeID id_kp_capwapAC = new KeyPurposeID(id_kp + ".18");
|
||||
public static readonly KeyPurposeID id_kp_capwapWTP = new KeyPurposeID(id_kp + ".19");
|
||||
|
||||
public static readonly KeyPurposeID id_kp_cmcCA = new KeyPurposeID(id_kp + ".27");
|
||||
public static readonly KeyPurposeID id_kp_cmcRA = new KeyPurposeID(id_kp + ".28");
|
||||
public static readonly KeyPurposeID id_kp_cmKGA = new KeyPurposeID(id_kp + ".32");
|
||||
|
||||
//
|
||||
// microsoft key purpose ids
|
||||
//
|
||||
public static readonly KeyPurposeID id_kp_smartcardlogon = new KeyPurposeID("1.3.6.1.4.1.311.20.2.2");
|
||||
|
||||
public static readonly KeyPurposeID id_kp_macAddress = new KeyPurposeID("1.3.6.1.1.1.1.22");
|
||||
|
||||
/// <summary>Microsoft Server Gated Crypto (msSGC).</summary>
|
||||
/// <remarks>see https://www.alvestrand.no/objectid/1.3.6.1.4.1.311.10.3.3.html</remarks>
|
||||
public static readonly KeyPurposeID id_kp_msSGC = new KeyPurposeID("1.3.6.1.4.1.311.10.3.3");
|
||||
|
||||
private const string id_pkinit = "1.3.6.1.5.2.3";
|
||||
|
||||
public static readonly KeyPurposeID scSysNodeNumber = new KeyPurposeID(id_pkinit + ".0");
|
||||
public static readonly KeyPurposeID id_pkinit_authData = new KeyPurposeID(id_pkinit + ".1");
|
||||
public static readonly KeyPurposeID id_pkinit_DHKeyData = new KeyPurposeID(id_pkinit + ".2");
|
||||
public static readonly KeyPurposeID id_pkinit_rkeyData = new KeyPurposeID(id_pkinit + ".3");
|
||||
public static readonly KeyPurposeID keyPurposeClientAuth = new KeyPurposeID(id_pkinit + ".4");
|
||||
public static readonly KeyPurposeID keyPurposeKdc = new KeyPurposeID(id_pkinit + ".5");
|
||||
|
||||
/// <summary>Netscape Server Gated Crypto (nsSGC).</summary>
|
||||
/// <remarks>see https://www.alvestrand.no/objectid/2.16.840.1.113730.4.1.html</remarks>
|
||||
public static readonly KeyPurposeID id_kp_nsSGC = new KeyPurposeID("2.16.840.1.113730.4.1");
|
||||
|
||||
|
||||
public static readonly KeyPurposeID IdKPServerAuth = id_kp_serverAuth;
|
||||
|
||||
public static readonly KeyPurposeID IdKPClientAuth = id_kp_clientAuth;
|
||||
|
||||
public static readonly KeyPurposeID IdKPCodeSigning = id_kp_codeSigning;
|
||||
|
||||
public static readonly KeyPurposeID IdKPEmailProtection = id_kp_emailProtection;
|
||||
|
||||
public static readonly KeyPurposeID IdKPIpsecEndSystem = id_kp_ipsecEndSystem;
|
||||
|
||||
public static readonly KeyPurposeID IdKPIpsecTunnel = id_kp_ipsecTunnel;
|
||||
|
||||
public static readonly KeyPurposeID IdKPIpsecUser = id_kp_ipsecUser;
|
||||
|
||||
public static readonly KeyPurposeID IdKPTimeStamping = id_kp_timeStamping;
|
||||
|
||||
public static readonly KeyPurposeID IdKPOcspSigning = id_kp_OCSPSigning;
|
||||
|
||||
|
||||
public static readonly KeyPurposeID IdKPSmartCardLogon = id_kp_smartcardlogon;
|
||||
|
||||
|
||||
public static readonly KeyPurposeID IdKPMacAddress = id_kp_macAddress;
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyPurposeId.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyPurposeId.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 794f2c0ca74648a4e9adf54c1c131ee0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/KeyPurposeId.cs
|
||||
uploadId: 783279
|
||||
82
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyUsage.cs
vendored
Normal file
82
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyUsage.cs
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The KeyUsage object.
|
||||
* <pre>
|
||||
* id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
|
||||
*
|
||||
* KeyUsage ::= BIT STRING {
|
||||
* digitalSignature (0),
|
||||
* nonRepudiation (1),
|
||||
* keyEncipherment (2),
|
||||
* dataEncipherment (3),
|
||||
* keyAgreement (4),
|
||||
* keyCertSign (5),
|
||||
* cRLSign (6),
|
||||
* encipherOnly (7),
|
||||
* decipherOnly (8) }
|
||||
* </pre>
|
||||
*/
|
||||
public class KeyUsage
|
||||
: DerBitString
|
||||
{
|
||||
public const int DigitalSignature = (1 << 7);
|
||||
public const int NonRepudiation = (1 << 6);
|
||||
public const int KeyEncipherment = (1 << 5);
|
||||
public const int DataEncipherment = (1 << 4);
|
||||
public const int KeyAgreement = (1 << 3);
|
||||
public const int KeyCertSign = (1 << 2);
|
||||
public const int CrlSign = (1 << 1);
|
||||
public const int EncipherOnly = (1 << 0);
|
||||
public const int DecipherOnly = (1 << 15);
|
||||
|
||||
public static new KeyUsage GetInstance(object obj)
|
||||
{
|
||||
if (obj is KeyUsage)
|
||||
return (KeyUsage)obj;
|
||||
if (obj is X509Extension)
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new KeyUsage(DerBitString.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static KeyUsage FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.KeyUsage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic constructor.
|
||||
*
|
||||
* @param usage - the bitwise OR of the Key Usage flags giving the
|
||||
* allowed uses for the key.
|
||||
* e.g. (KeyUsage.keyEncipherment | KeyUsage.dataEncipherment)
|
||||
*/
|
||||
public KeyUsage(int usage)
|
||||
: base(usage)
|
||||
{
|
||||
}
|
||||
|
||||
private KeyUsage(
|
||||
DerBitString usage)
|
||||
: base(usage.GetBytes(), usage.PadBits)
|
||||
{
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
byte[] data = GetBytes();
|
||||
if (data.Length == 1)
|
||||
{
|
||||
return "KeyUsage: 0x" + (data[0] & 0xff).ToString("X");
|
||||
}
|
||||
|
||||
return "KeyUsage: 0x" + ((data[1] & 0xff) << 8 | (data[0] & 0xff)).ToString("X");
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyUsage.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/KeyUsage.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 109e5f5c22da9a645b078b26ac284d8b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/KeyUsage.cs
|
||||
uploadId: 783279
|
||||
105
Runtime/3rdParty/BouncyCastle/asn1/x509/NameConstraints.cs
vendored
Normal file
105
Runtime/3rdParty/BouncyCastle/asn1/x509/NameConstraints.cs
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class NameConstraints
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1Sequence permitted, excluded;
|
||||
|
||||
public static NameConstraints GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is NameConstraints)
|
||||
{
|
||||
return (NameConstraints) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new NameConstraints((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public NameConstraints(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
foreach (Asn1TaggedObject o in seq)
|
||||
{
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0:
|
||||
permitted = Asn1Sequence.GetInstance(o, false);
|
||||
break;
|
||||
case 1:
|
||||
excluded = Asn1Sequence.GetInstance(o, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from a given details.
|
||||
*
|
||||
* <p>permitted and excluded are Vectors of GeneralSubtree objects.</p>
|
||||
*
|
||||
* @param permitted Permitted subtrees
|
||||
* @param excluded Excluded subtrees
|
||||
*/
|
||||
public NameConstraints(
|
||||
IList<GeneralSubtree> permitted,
|
||||
IList<GeneralSubtree> excluded)
|
||||
{
|
||||
if (permitted != null)
|
||||
{
|
||||
this.permitted = CreateSequence(permitted);
|
||||
}
|
||||
|
||||
if (excluded != null)
|
||||
{
|
||||
this.excluded = CreateSequence(excluded);
|
||||
}
|
||||
}
|
||||
|
||||
private DerSequence CreateSequence(IList<GeneralSubtree> subtrees)
|
||||
{
|
||||
GeneralSubtree[] gsts = new GeneralSubtree[subtrees.Count];
|
||||
for (int i = 0; i < subtrees.Count; ++i)
|
||||
{
|
||||
gsts[i] = subtrees[i];
|
||||
}
|
||||
return new DerSequence(gsts);
|
||||
}
|
||||
|
||||
public Asn1Sequence PermittedSubtrees
|
||||
{
|
||||
get { return permitted; }
|
||||
}
|
||||
|
||||
public Asn1Sequence ExcludedSubtrees
|
||||
{
|
||||
get { return excluded; }
|
||||
}
|
||||
|
||||
/*
|
||||
* NameConstraints ::= SEQUENCE { permittedSubtrees [0] GeneralSubtrees
|
||||
* OPTIONAL, excludedSubtrees [1] GeneralSubtrees OPTIONAL }
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(false, 0, permitted);
|
||||
v.AddOptionalTagged(false, 1, excluded);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/NameConstraints.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/NameConstraints.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1742cc96c071e6f4098f85e6da1a8a6e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/NameConstraints.cs
|
||||
uploadId: 783279
|
||||
147
Runtime/3rdParty/BouncyCastle/asn1/x509/NoticeReference.cs
vendored
Normal file
147
Runtime/3rdParty/BouncyCastle/asn1/x509/NoticeReference.cs
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* <code>NoticeReference</code> class, used in
|
||||
* <code>CertificatePolicies</code> X509 V3 extensions
|
||||
* (in policy qualifiers).
|
||||
*
|
||||
* <pre>
|
||||
* NoticeReference ::= Sequence {
|
||||
* organization DisplayText,
|
||||
* noticeNumbers Sequence OF Integer }
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @see PolicyQualifierInfo
|
||||
* @see PolicyInformation
|
||||
*/
|
||||
public class NoticeReference
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DisplayText organization;
|
||||
private readonly Asn1Sequence noticeNumbers;
|
||||
|
||||
private static Asn1EncodableVector ConvertVector(IList<object> numbers)
|
||||
{
|
||||
Asn1EncodableVector av = new Asn1EncodableVector();
|
||||
|
||||
foreach (object o in numbers)
|
||||
{
|
||||
DerInteger di;
|
||||
|
||||
if (o is BigInteger)
|
||||
{
|
||||
di = new DerInteger((BigInteger)o);
|
||||
}
|
||||
else if (o is int)
|
||||
{
|
||||
di = new DerInteger((int)o);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
|
||||
av.Add(di);
|
||||
}
|
||||
return av;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>NoticeReference</code> instance.
|
||||
*
|
||||
* @param organization a <code>String</code> value
|
||||
* @param numbers a <code>Vector</code> value
|
||||
*/
|
||||
public NoticeReference(string organization, IList<object> numbers)
|
||||
: this(organization, ConvertVector(numbers))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>NoticeReference</code> instance.
|
||||
*
|
||||
* @param organization a <code>String</code> value
|
||||
* @param noticeNumbers an <code>ASN1EncodableVector</code> value
|
||||
*/
|
||||
public NoticeReference(string organization, Asn1EncodableVector noticeNumbers)
|
||||
: this(new DisplayText(organization), noticeNumbers)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>NoticeReference</code> instance.
|
||||
*
|
||||
* @param organization displayText
|
||||
* @param noticeNumbers an <code>ASN1EncodableVector</code> value
|
||||
*/
|
||||
public NoticeReference(DisplayText organization, Asn1EncodableVector noticeNumbers)
|
||||
{
|
||||
this.organization = organization;
|
||||
this.noticeNumbers = new DerSequence(noticeNumbers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>NoticeReference</code> instance.
|
||||
* <p>Useful for reconstructing a <code>NoticeReference</code>
|
||||
* instance from its encodable/encoded form.</p>
|
||||
*
|
||||
* @param as an <code>Asn1Sequence</code> value obtained from either
|
||||
* calling @{link ToAsn1Object()} for a <code>NoticeReference</code>
|
||||
* instance or from parsing it from a Der-encoded stream.
|
||||
*/
|
||||
private NoticeReference(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
organization = DisplayText.GetInstance(seq[0]);
|
||||
noticeNumbers = Asn1Sequence.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public static NoticeReference GetInstance(object obj)
|
||||
{
|
||||
if (obj is NoticeReference)
|
||||
return (NoticeReference)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new NoticeReference(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public virtual DisplayText Organization
|
||||
{
|
||||
get { return organization; }
|
||||
}
|
||||
|
||||
public virtual DerInteger[] GetNoticeNumbers()
|
||||
{
|
||||
DerInteger[] tmp = new DerInteger[noticeNumbers.Count];
|
||||
|
||||
for (int i = 0; i != noticeNumbers.Count; ++i)
|
||||
{
|
||||
tmp[i] = DerInteger.GetInstance(noticeNumbers[i]);
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Describe <code>ToAsn1Object</code> method here.
|
||||
*
|
||||
* @return a <code>Asn1Object</code> value
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(organization, noticeNumbers);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/NoticeReference.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/NoticeReference.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 877f7a64335a78a43a721cf38f293056
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/NoticeReference.cs
|
||||
uploadId: 783279
|
||||
177
Runtime/3rdParty/BouncyCastle/asn1/x509/ObjectDigestInfo.cs
vendored
Normal file
177
Runtime/3rdParty/BouncyCastle/asn1/x509/ObjectDigestInfo.cs
vendored
Normal file
@ -0,0 +1,177 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* ObjectDigestInfo ASN.1 structure used in v2 attribute certificates.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* ObjectDigestInfo ::= SEQUENCE {
|
||||
* digestedObjectType ENUMERATED {
|
||||
* publicKey (0),
|
||||
* publicKeyCert (1),
|
||||
* otherObjectTypes (2) },
|
||||
* -- otherObjectTypes MUST NOT
|
||||
* -- be used in this profile
|
||||
* otherObjectTypeID OBJECT IDENTIFIER OPTIONAL,
|
||||
* digestAlgorithm AlgorithmIdentifier,
|
||||
* objectDigest BIT STRING
|
||||
* }
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
public class ObjectDigestInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
/**
|
||||
* The public key is hashed.
|
||||
*/
|
||||
public const int PublicKey = 0;
|
||||
|
||||
/**
|
||||
* The public key certificate is hashed.
|
||||
*/
|
||||
public const int PublicKeyCert = 1;
|
||||
|
||||
/**
|
||||
* An other object is hashed.
|
||||
*/
|
||||
public const int OtherObjectDigest = 2;
|
||||
|
||||
internal readonly DerEnumerated digestedObjectType;
|
||||
internal readonly DerObjectIdentifier otherObjectTypeID;
|
||||
internal readonly AlgorithmIdentifier digestAlgorithm;
|
||||
internal readonly DerBitString objectDigest;
|
||||
|
||||
public static ObjectDigestInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is ObjectDigestInfo)
|
||||
{
|
||||
return (ObjectDigestInfo) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new ObjectDigestInfo((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public static ObjectDigestInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from given details.
|
||||
* <p>
|
||||
* If <code>digestedObjectType</code> is not {@link #publicKeyCert} or
|
||||
* {@link #publicKey} <code>otherObjectTypeID</code> must be given,
|
||||
* otherwise it is ignored.</p>
|
||||
*
|
||||
* @param digestedObjectType The digest object type.
|
||||
* @param otherObjectTypeID The object type ID for
|
||||
* <code>otherObjectDigest</code>.
|
||||
* @param digestAlgorithm The algorithm identifier for the hash.
|
||||
* @param objectDigest The hash value.
|
||||
*/
|
||||
public ObjectDigestInfo(
|
||||
int digestedObjectType,
|
||||
string otherObjectTypeID,
|
||||
AlgorithmIdentifier digestAlgorithm,
|
||||
byte[] objectDigest)
|
||||
{
|
||||
this.digestedObjectType = new DerEnumerated(digestedObjectType);
|
||||
|
||||
if (digestedObjectType == OtherObjectDigest)
|
||||
{
|
||||
this.otherObjectTypeID = new DerObjectIdentifier(otherObjectTypeID);
|
||||
}
|
||||
|
||||
this.digestAlgorithm = digestAlgorithm;
|
||||
|
||||
this.objectDigest = new DerBitString(objectDigest);
|
||||
}
|
||||
|
||||
private ObjectDigestInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count > 4 || seq.Count < 3)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
digestedObjectType = DerEnumerated.GetInstance(seq[0]);
|
||||
|
||||
int offset = 0;
|
||||
|
||||
if (seq.Count == 4)
|
||||
{
|
||||
otherObjectTypeID = DerObjectIdentifier.GetInstance(seq[1]);
|
||||
offset++;
|
||||
}
|
||||
|
||||
digestAlgorithm = AlgorithmIdentifier.GetInstance(seq[1 + offset]);
|
||||
objectDigest = DerBitString.GetInstance(seq[2 + offset]);
|
||||
}
|
||||
|
||||
public DerEnumerated DigestedObjectType
|
||||
{
|
||||
get { return digestedObjectType; }
|
||||
}
|
||||
|
||||
public DerObjectIdentifier OtherObjectTypeID
|
||||
{
|
||||
get { return otherObjectTypeID; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier DigestAlgorithm
|
||||
{
|
||||
get { return digestAlgorithm; }
|
||||
}
|
||||
|
||||
public DerBitString ObjectDigest
|
||||
{
|
||||
get { return objectDigest; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* ObjectDigestInfo ::= SEQUENCE {
|
||||
* digestedObjectType ENUMERATED {
|
||||
* publicKey (0),
|
||||
* publicKeyCert (1),
|
||||
* otherObjectTypes (2) },
|
||||
* -- otherObjectTypes MUST NOT
|
||||
* -- be used in this profile
|
||||
* otherObjectTypeID OBJECT IDENTIFIER OPTIONAL,
|
||||
* digestAlgorithm AlgorithmIdentifier,
|
||||
* objectDigest BIT STRING
|
||||
* }
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(digestedObjectType);
|
||||
v.AddOptional(otherObjectTypeID);
|
||||
v.Add(digestAlgorithm, objectDigest);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ObjectDigestInfo.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ObjectDigestInfo.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9bb1fd989a68b6419e3961c4ef4aba8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/ObjectDigestInfo.cs
|
||||
uploadId: 783279
|
||||
75
Runtime/3rdParty/BouncyCastle/asn1/x509/OtherName.cs
vendored
Normal file
75
Runtime/3rdParty/BouncyCastle/asn1/x509/OtherName.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.X509
|
||||
{
|
||||
/**
|
||||
* The OtherName object.
|
||||
* <pre>
|
||||
* OtherName ::= SEQUENCE {
|
||||
* type-id OBJECT IDENTIFIER,
|
||||
* value [0] EXPLICIT ANY DEFINED BY type-id }
|
||||
* </pre>
|
||||
*/
|
||||
public class OtherName
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier typeID;
|
||||
private readonly Asn1Encodable value;
|
||||
|
||||
/**
|
||||
* OtherName factory method.
|
||||
* @param obj the object used to construct an instance of <code>
|
||||
* OtherName</code>. It must be an instance of <code>OtherName
|
||||
* </code> or <code>ASN1Sequence</code>.
|
||||
* @return the instance of <code>OtherName</code> built from the
|
||||
* supplied object.
|
||||
* @throws java.lang.IllegalArgumentException if the object passed
|
||||
* to the factory is not an instance of <code>OtherName</code> or something that
|
||||
* can be converted into an appropriate <code>ASN1Sequence</code>.
|
||||
*/
|
||||
public static OtherName GetInstance(object obj)
|
||||
{
|
||||
if (obj is OtherName)
|
||||
return (OtherName)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new OtherName(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
/**
|
||||
* Base constructor.
|
||||
* @param typeID the type of the other name.
|
||||
* @param value the ANY object that represents the value.
|
||||
*/
|
||||
public OtherName(DerObjectIdentifier typeID, Asn1Encodable value)
|
||||
{
|
||||
this.typeID = typeID;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private OtherName(Asn1Sequence seq)
|
||||
{
|
||||
this.typeID = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
this.value = DerTaggedObject.GetInstance(seq[1]).GetObject(); // explicitly tagged
|
||||
}
|
||||
|
||||
public virtual DerObjectIdentifier TypeID
|
||||
{
|
||||
get { return typeID; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Value
|
||||
{
|
||||
get { return value; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(typeID, new DerTaggedObject(true, 0, value));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/OtherName.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/OtherName.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4029718e1f966e34ab87198e9729d02e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/OtherName.cs
|
||||
uploadId: 783279
|
||||
79
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyInformation.cs
vendored
Normal file
79
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyInformation.cs
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class PolicyInformation
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier policyIdentifier;
|
||||
private readonly Asn1Sequence policyQualifiers;
|
||||
|
||||
private PolicyInformation(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
policyIdentifier = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
policyQualifiers = Asn1Sequence.GetInstance(seq[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public PolicyInformation(
|
||||
DerObjectIdentifier policyIdentifier)
|
||||
{
|
||||
this.policyIdentifier = policyIdentifier;
|
||||
}
|
||||
|
||||
public PolicyInformation(
|
||||
DerObjectIdentifier policyIdentifier,
|
||||
Asn1Sequence policyQualifiers)
|
||||
{
|
||||
this.policyIdentifier = policyIdentifier;
|
||||
this.policyQualifiers = policyQualifiers;
|
||||
}
|
||||
|
||||
public static PolicyInformation GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is PolicyInformation)
|
||||
{
|
||||
return (PolicyInformation) obj;
|
||||
}
|
||||
|
||||
return new PolicyInformation(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public DerObjectIdentifier PolicyIdentifier
|
||||
{
|
||||
get { return policyIdentifier; }
|
||||
}
|
||||
|
||||
public Asn1Sequence PolicyQualifiers
|
||||
{
|
||||
get { return policyQualifiers; }
|
||||
}
|
||||
|
||||
/*
|
||||
* PolicyInformation ::= Sequence {
|
||||
* policyIdentifier CertPolicyId,
|
||||
* policyQualifiers Sequence SIZE (1..MAX) OF
|
||||
* PolicyQualifierInfo OPTIONAL }
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(policyIdentifier);
|
||||
v.AddOptional(policyQualifiers);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyInformation.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyInformation.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fde026e7283aaf469e8ffa39f27a34e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyInformation.cs
|
||||
uploadId: 783279
|
||||
66
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyMappings.cs
vendored
Normal file
66
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyMappings.cs
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* PolicyMappings V3 extension, described in RFC3280.
|
||||
* <pre>
|
||||
* PolicyMappings ::= Sequence SIZE (1..MAX) OF Sequence {
|
||||
* issuerDomainPolicy CertPolicyId,
|
||||
* subjectDomainPolicy CertPolicyId }
|
||||
* </pre>
|
||||
*
|
||||
* @see <a href="http://www.faqs.org/rfc/rfc3280.txt">RFC 3280, section 4.2.1.6</a>
|
||||
*/
|
||||
public class PolicyMappings
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1Sequence seq;
|
||||
|
||||
/**
|
||||
* Creates a new <code>PolicyMappings</code> instance.
|
||||
*
|
||||
* @param seq an <code>Asn1Sequence</code> constructed as specified
|
||||
* in RFC 3280
|
||||
*/
|
||||
public PolicyMappings(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>PolicyMappings</code> instance.
|
||||
*
|
||||
* @param mappings a <code>HashMap</code> value that maps
|
||||
* <code>string</code> oids
|
||||
* to other <code>string</code> oids.
|
||||
*/
|
||||
public PolicyMappings(IDictionary<string, string> mappings)
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
foreach (var entry in mappings)
|
||||
{
|
||||
string idp = entry.Key;
|
||||
string sdp = entry.Value;
|
||||
|
||||
v.Add(
|
||||
new DerSequence(
|
||||
new DerObjectIdentifier(idp),
|
||||
new DerObjectIdentifier(sdp)));
|
||||
}
|
||||
|
||||
seq = new DerSequence(v);
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyMappings.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyMappings.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79e3f73ba2740c14b84ce885cb40a4ed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyMappings.cs
|
||||
uploadId: 783279
|
||||
32
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierId.cs
vendored
Normal file
32
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierId.cs
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* PolicyQualifierId, used in the CertificatePolicies
|
||||
* X509V3 extension.
|
||||
*
|
||||
* <pre>
|
||||
* id-qt OBJECT IDENTIFIER ::= { id-pkix 2 }
|
||||
* id-qt-cps OBJECT IDENTIFIER ::= { id-qt 1 }
|
||||
* id-qt-unotice OBJECT IDENTIFIER ::= { id-qt 2 }
|
||||
* PolicyQualifierId ::=
|
||||
* OBJECT IDENTIFIER ( id-qt-cps | id-qt-unotice )
|
||||
* </pre>
|
||||
*/
|
||||
public sealed class PolicyQualifierID : DerObjectIdentifier
|
||||
{
|
||||
private const string IdQt = "1.3.6.1.5.5.7.2";
|
||||
|
||||
private PolicyQualifierID(
|
||||
string id)
|
||||
: base(id)
|
||||
{
|
||||
}
|
||||
|
||||
public static readonly PolicyQualifierID IdQtCps = new PolicyQualifierID(IdQt + ".1");
|
||||
public static readonly PolicyQualifierID IdQtUnotice = new PolicyQualifierID(IdQt + ".2");
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierId.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierId.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 603b3a74f16f32d45aa6e6343fae7e51
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierId.cs
|
||||
uploadId: 783279
|
||||
99
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierInfo.cs
vendored
Normal file
99
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierInfo.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.X509
|
||||
{
|
||||
/**
|
||||
* Policy qualifiers, used in the X509V3 CertificatePolicies
|
||||
* extension.
|
||||
*
|
||||
* <pre>
|
||||
* PolicyQualifierInfo ::= Sequence {
|
||||
* policyQualifierId PolicyQualifierId,
|
||||
* qualifier ANY DEFINED BY policyQualifierId }
|
||||
* </pre>
|
||||
*/
|
||||
public class PolicyQualifierInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier policyQualifierId;
|
||||
private readonly Asn1Encodable qualifier;
|
||||
|
||||
/**
|
||||
* Creates a new <code>PolicyQualifierInfo</code> instance.
|
||||
*
|
||||
* @param policyQualifierId a <code>PolicyQualifierId</code> value
|
||||
* @param qualifier the qualifier, defined by the above field.
|
||||
*/
|
||||
public PolicyQualifierInfo(
|
||||
DerObjectIdentifier policyQualifierId,
|
||||
Asn1Encodable qualifier)
|
||||
{
|
||||
this.policyQualifierId = policyQualifierId;
|
||||
this.qualifier = qualifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>PolicyQualifierInfo</code> containing a
|
||||
* cPSuri qualifier.
|
||||
*
|
||||
* @param cps the CPS (certification practice statement) uri as a
|
||||
* <code>string</code>.
|
||||
*/
|
||||
public PolicyQualifierInfo(
|
||||
string cps)
|
||||
{
|
||||
policyQualifierId = PolicyQualifierID.IdQtCps;
|
||||
qualifier = new DerIA5String(cps);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new <code>PolicyQualifierInfo</code> instance.
|
||||
*
|
||||
* @param as <code>PolicyQualifierInfo</code> X509 structure
|
||||
* encoded as an Asn1Sequence.
|
||||
*/
|
||||
private PolicyQualifierInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
policyQualifierId = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
qualifier = seq[1];
|
||||
}
|
||||
|
||||
public static PolicyQualifierInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is PolicyQualifierInfo)
|
||||
return (PolicyQualifierInfo)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new PolicyQualifierInfo(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public virtual DerObjectIdentifier PolicyQualifierId
|
||||
{
|
||||
get { return policyQualifierId; }
|
||||
}
|
||||
|
||||
public virtual Asn1Encodable Qualifier
|
||||
{
|
||||
get { return qualifier; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a Der-encodable representation of this instance.
|
||||
*
|
||||
* @return a <code>Asn1Object</code> value
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(policyQualifierId, qualifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierInfo.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierInfo.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5432c3ce43f6ca34bac84a4b39169d19
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/PolicyQualifierInfo.cs
|
||||
uploadId: 783279
|
||||
79
Runtime/3rdParty/BouncyCastle/asn1/x509/PrivateKeyUsagePeriod.cs
vendored
Normal file
79
Runtime/3rdParty/BouncyCastle/asn1/x509/PrivateKeyUsagePeriod.cs
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
#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.X509
|
||||
{
|
||||
/// <remarks>
|
||||
/// <pre>
|
||||
/// PrivateKeyUsagePeriod ::= SEQUENCE
|
||||
/// {
|
||||
/// notBefore [0] GeneralizedTime OPTIONAL,
|
||||
/// notAfter [1] GeneralizedTime OPTIONAL }
|
||||
/// </pre>
|
||||
/// </remarks>
|
||||
public class PrivateKeyUsagePeriod
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static PrivateKeyUsagePeriod GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is PrivateKeyUsagePeriod)
|
||||
{
|
||||
return (PrivateKeyUsagePeriod) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new PrivateKeyUsagePeriod((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
if (obj is X509Extension)
|
||||
{
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension) obj));
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in GetInstance: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private Asn1GeneralizedTime _notBefore, _notAfter;
|
||||
|
||||
private PrivateKeyUsagePeriod(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
foreach (Asn1TaggedObject tObj in seq)
|
||||
{
|
||||
if (tObj.TagNo == 0)
|
||||
{
|
||||
_notBefore = Asn1GeneralizedTime.GetInstance(tObj, false);
|
||||
}
|
||||
else if (tObj.TagNo == 1)
|
||||
{
|
||||
_notAfter = Asn1GeneralizedTime.GetInstance(tObj, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime NotBefore
|
||||
{
|
||||
get { return _notBefore; }
|
||||
}
|
||||
|
||||
public Asn1GeneralizedTime NotAfter
|
||||
{
|
||||
get { return _notAfter; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(false, 0, _notBefore);
|
||||
v.AddOptionalTagged(false, 1, _notAfter);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PrivateKeyUsagePeriod.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/PrivateKeyUsagePeriod.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8dfe6e64c057fd42a93d7bd397946e9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/PrivateKeyUsagePeriod.cs
|
||||
uploadId: 783279
|
||||
95
Runtime/3rdParty/BouncyCastle/asn1/x509/RSAPublicKeyStructure.cs
vendored
Normal file
95
Runtime/3rdParty/BouncyCastle/asn1/x509/RSAPublicKeyStructure.cs
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class RsaPublicKeyStructure
|
||||
: Asn1Encodable
|
||||
{
|
||||
private BigInteger modulus;
|
||||
private BigInteger publicExponent;
|
||||
|
||||
public static RsaPublicKeyStructure GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static RsaPublicKeyStructure GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is RsaPublicKeyStructure)
|
||||
{
|
||||
return (RsaPublicKeyStructure) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new RsaPublicKeyStructure((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid RsaPublicKeyStructure: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
|
||||
}
|
||||
|
||||
public RsaPublicKeyStructure(
|
||||
BigInteger modulus,
|
||||
BigInteger publicExponent)
|
||||
{
|
||||
if (modulus == null)
|
||||
throw new ArgumentNullException("modulus");
|
||||
if (publicExponent == null)
|
||||
throw new ArgumentNullException("publicExponent");
|
||||
if (modulus.SignValue <= 0)
|
||||
throw new ArgumentException("Not a valid RSA modulus", "modulus");
|
||||
if (publicExponent.SignValue <= 0)
|
||||
throw new ArgumentException("Not a valid RSA public exponent", "publicExponent");
|
||||
|
||||
this.modulus = modulus;
|
||||
this.publicExponent = publicExponent;
|
||||
}
|
||||
|
||||
private RsaPublicKeyStructure(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
// Note: we are accepting technically incorrect (i.e. negative) values here
|
||||
modulus = DerInteger.GetInstance(seq[0]).PositiveValue;
|
||||
publicExponent = DerInteger.GetInstance(seq[1]).PositiveValue;
|
||||
}
|
||||
|
||||
public BigInteger Modulus
|
||||
{
|
||||
get { return modulus; }
|
||||
}
|
||||
|
||||
public BigInteger PublicExponent
|
||||
{
|
||||
get { return publicExponent; }
|
||||
}
|
||||
|
||||
/**
|
||||
* This outputs the key in Pkcs1v2 format.
|
||||
* <pre>
|
||||
* RSAPublicKey ::= Sequence {
|
||||
* modulus Integer, -- n
|
||||
* publicExponent Integer, -- e
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(
|
||||
new DerInteger(Modulus),
|
||||
new DerInteger(PublicExponent));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/RSAPublicKeyStructure.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/RSAPublicKeyStructure.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e69185bf5672f942bc90bd2fd5c8dcc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/RSAPublicKeyStructure.cs
|
||||
uploadId: 783279
|
||||
49
Runtime/3rdParty/BouncyCastle/asn1/x509/ReasonFlags.cs
vendored
Normal file
49
Runtime/3rdParty/BouncyCastle/asn1/x509/ReasonFlags.cs
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The ReasonFlags object.
|
||||
* <pre>
|
||||
* ReasonFlags ::= BIT STRING {
|
||||
* unused(0),
|
||||
* keyCompromise(1),
|
||||
* cACompromise(2),
|
||||
* affiliationChanged(3),
|
||||
* superseded(4),
|
||||
* cessationOfOperation(5),
|
||||
* certficateHold(6)
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class ReasonFlags
|
||||
: DerBitString
|
||||
{
|
||||
public const int Unused = (1 << 7);
|
||||
public const int KeyCompromise = (1 << 6);
|
||||
public const int CACompromise = (1 << 5);
|
||||
public const int AffiliationChanged = (1 << 4);
|
||||
public const int Superseded = (1 << 3);
|
||||
public const int CessationOfOperation = (1 << 2);
|
||||
public const int CertificateHold = (1 << 1);
|
||||
public const int PrivilegeWithdrawn = (1 << 0);
|
||||
public const int AACompromise = (1 << 15);
|
||||
|
||||
/**
|
||||
* @param reasons - the bitwise OR of the Key Reason flags giving the
|
||||
* allowed uses for the key.
|
||||
*/
|
||||
public ReasonFlags(int reasons)
|
||||
: base(reasons)
|
||||
{
|
||||
}
|
||||
|
||||
public ReasonFlags(
|
||||
DerBitString reasons)
|
||||
: base(reasons.GetBytes(), reasons.PadBits)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ReasonFlags.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/ReasonFlags.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a7df27c00f970a4abf5b2d0a8b87f42
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/ReasonFlags.cs
|
||||
uploadId: 783279
|
||||
228
Runtime/3rdParty/BouncyCastle/asn1/x509/RoleSyntax.cs
vendored
Normal file
228
Runtime/3rdParty/BouncyCastle/asn1/x509/RoleSyntax.cs
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* Implementation of the RoleSyntax object as specified by the RFC3281.
|
||||
*
|
||||
* <pre>
|
||||
* RoleSyntax ::= SEQUENCE {
|
||||
* roleAuthority [0] GeneralNames OPTIONAL,
|
||||
* roleName [1] GeneralName
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class RoleSyntax
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly GeneralNames roleAuthority;
|
||||
private readonly GeneralName roleName;
|
||||
|
||||
/**
|
||||
* RoleSyntax factory method.
|
||||
* @param obj the object used to construct an instance of <code>
|
||||
* RoleSyntax</code>. It must be an instance of <code>RoleSyntax
|
||||
* </code> or <code>Asn1Sequence</code>.
|
||||
* @return the instance of <code>RoleSyntax</code> built from the
|
||||
* supplied object.
|
||||
* @throws java.lang.ArgumentException if the object passed
|
||||
* to the factory is not an instance of <code>RoleSyntax</code> or
|
||||
* <code>Asn1Sequence</code>.
|
||||
*/
|
||||
public static RoleSyntax GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is RoleSyntax)
|
||||
return (RoleSyntax)obj;
|
||||
|
||||
if (obj != null)
|
||||
return new RoleSyntax(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* @param roleAuthority the role authority of this RoleSyntax.
|
||||
* @param roleName the role name of this RoleSyntax.
|
||||
*/
|
||||
public RoleSyntax(
|
||||
GeneralNames roleAuthority,
|
||||
GeneralName roleName)
|
||||
{
|
||||
if (roleName == null
|
||||
|| roleName.TagNo != GeneralName.UniformResourceIdentifier
|
||||
|| ((IAsn1String) roleName.Name).GetString().Equals(""))
|
||||
{
|
||||
throw new ArgumentException("the role name MUST be non empty and MUST " +
|
||||
"use the URI option of GeneralName");
|
||||
}
|
||||
|
||||
this.roleAuthority = roleAuthority;
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. Invoking this constructor is the same as invoking
|
||||
* <code>new RoleSyntax(null, roleName)</code>.
|
||||
* @param roleName the role name of this RoleSyntax.
|
||||
*/
|
||||
public RoleSyntax(
|
||||
GeneralName roleName)
|
||||
: this(null, roleName)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility constructor. Takes a <code>string</code> argument representing
|
||||
* the role name, builds a <code>GeneralName</code> to hold the role name
|
||||
* and calls the constructor that takes a <code>GeneralName</code>.
|
||||
* @param roleName
|
||||
*/
|
||||
public RoleSyntax(
|
||||
string roleName)
|
||||
: this(new GeneralName(GeneralName.UniformResourceIdentifier,
|
||||
(roleName == null)? "": roleName))
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that builds an instance of <code>RoleSyntax</code> by
|
||||
* extracting the encoded elements from the <code>Asn1Sequence</code>
|
||||
* object supplied.
|
||||
* @param seq an instance of <code>Asn1Sequence</code> that holds
|
||||
* the encoded elements used to build this <code>RoleSyntax</code>.
|
||||
*/
|
||||
private RoleSyntax(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject taggedObject = Asn1TaggedObject.GetInstance(seq[i]);
|
||||
switch (taggedObject.TagNo)
|
||||
{
|
||||
case 0:
|
||||
roleAuthority = GeneralNames.GetInstance(taggedObject, false);
|
||||
break;
|
||||
case 1:
|
||||
roleName = GeneralName.GetInstance(taggedObject, true);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Unknown tag in RoleSyntax");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the role authority of this RoleSyntax.
|
||||
* @return an instance of <code>GeneralNames</code> holding the
|
||||
* role authority of this RoleSyntax.
|
||||
*/
|
||||
public GeneralNames RoleAuthority
|
||||
{
|
||||
get { return this.roleAuthority; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the role name of this RoleSyntax.
|
||||
* @return an instance of <code>GeneralName</code> holding the
|
||||
* role name of this RoleSyntax.
|
||||
*/
|
||||
public GeneralName RoleName
|
||||
{
|
||||
get { return this.roleName; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the role name as a <code>java.lang.string</code> object.
|
||||
* @return the role name of this RoleSyntax represented as a
|
||||
* <code>string</code> object.
|
||||
*/
|
||||
public string GetRoleNameAsString()
|
||||
{
|
||||
return ((IAsn1String) this.roleName.Name).GetString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the role authority as a <code>string[]</code> object.
|
||||
* @return the role authority of this RoleSyntax represented as a
|
||||
* <code>string[]</code> array.
|
||||
*/
|
||||
public string[] GetRoleAuthorityAsString()
|
||||
{
|
||||
if (roleAuthority == null)
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
GeneralName[] names = roleAuthority.GetNames();
|
||||
string[] namesString = new string[names.Length];
|
||||
for(int i = 0; i < names.Length; i++)
|
||||
{
|
||||
Asn1Encodable asn1Value = names[i].Name;
|
||||
if (asn1Value is IAsn1String)
|
||||
{
|
||||
namesString[i] = ((IAsn1String) asn1Value).GetString();
|
||||
}
|
||||
else
|
||||
{
|
||||
namesString[i] = asn1Value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return namesString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of the method <code>ToAsn1Object</code> as
|
||||
* required by the superclass <code>ASN1Encodable</code>.
|
||||
*
|
||||
* <pre>
|
||||
* RoleSyntax ::= SEQUENCE {
|
||||
* roleAuthority [0] GeneralNames OPTIONAL,
|
||||
* roleName [1] GeneralName
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptionalTagged(false, 0, roleAuthority);
|
||||
v.Add(new DerTaggedObject(true, 1, roleName));
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder buff = new StringBuilder("Name: " + this.GetRoleNameAsString() +
|
||||
" - Auth: ");
|
||||
|
||||
if (this.roleAuthority == null || roleAuthority.GetNames().Length == 0)
|
||||
{
|
||||
buff.Append("N/A");
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] names = this.GetRoleAuthorityAsString();
|
||||
buff.Append('[').Append(names[0]);
|
||||
for(int i = 1; i < names.Length; i++)
|
||||
{
|
||||
buff.Append(", ").Append(names[i]);
|
||||
}
|
||||
buff.Append(']');
|
||||
}
|
||||
|
||||
return buff.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/RoleSyntax.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/RoleSyntax.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d84b92d4f55d51d4cbba5f4886693fe8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/RoleSyntax.cs
|
||||
uploadId: 783279
|
||||
137
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectDirectoryAttributes.cs
vendored
Normal file
137
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectDirectoryAttributes.cs
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* This extension may contain further X.500 attributes of the subject. See also
|
||||
* RFC 3039.
|
||||
*
|
||||
* <pre>
|
||||
* SubjectDirectoryAttributes ::= Attributes
|
||||
* Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
|
||||
* Attribute ::= SEQUENCE
|
||||
* {
|
||||
* type AttributeType
|
||||
* values SET OF AttributeValue
|
||||
* }
|
||||
*
|
||||
* AttributeType ::= OBJECT IDENTIFIER
|
||||
* AttributeValue ::= ANY DEFINED BY AttributeType
|
||||
* </pre>
|
||||
*
|
||||
* @see org.bouncycastle.asn1.x509.X509Name for AttributeType ObjectIdentifiers.
|
||||
*/
|
||||
public class SubjectDirectoryAttributes
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly IList<AttributeX509> m_attributes;
|
||||
|
||||
public static SubjectDirectoryAttributes GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is SubjectDirectoryAttributes)
|
||||
{
|
||||
return (SubjectDirectoryAttributes) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new SubjectDirectoryAttributes((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from Asn1Sequence.
|
||||
*
|
||||
* The sequence is of type SubjectDirectoryAttributes:
|
||||
*
|
||||
* <pre>
|
||||
* SubjectDirectoryAttributes ::= Attributes
|
||||
* Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
|
||||
* Attribute ::= SEQUENCE
|
||||
* {
|
||||
* type AttributeType
|
||||
* values SET OF AttributeValue
|
||||
* }
|
||||
*
|
||||
* AttributeType ::= OBJECT IDENTIFIER
|
||||
* AttributeValue ::= ANY DEFINED BY AttributeType
|
||||
* </pre>
|
||||
*
|
||||
* @param seq
|
||||
* The ASN.1 sequence.
|
||||
*/
|
||||
private SubjectDirectoryAttributes(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
m_attributes = new List<AttributeX509>();
|
||||
|
||||
foreach (object o in seq)
|
||||
{
|
||||
Asn1Sequence s = Asn1Sequence.GetInstance(o);
|
||||
m_attributes.Add(AttributeX509.GetInstance(s));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor from an ArrayList of attributes.
|
||||
*
|
||||
* The ArrayList consists of attributes of type {@link Attribute Attribute}
|
||||
*
|
||||
* @param attributes The attributes.
|
||||
*
|
||||
*/
|
||||
public SubjectDirectoryAttributes(IList<AttributeX509> attributes)
|
||||
{
|
||||
m_attributes = new List<AttributeX509>(attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* <pre>
|
||||
* SubjectDirectoryAttributes ::= Attributes
|
||||
* Attributes ::= SEQUENCE SIZE (1..MAX) OF Attribute
|
||||
* Attribute ::= SEQUENCE
|
||||
* {
|
||||
* type AttributeType
|
||||
* values SET OF AttributeValue
|
||||
* }
|
||||
*
|
||||
* AttributeType ::= OBJECT IDENTIFIER
|
||||
* AttributeValue ::= ANY DEFINED BY AttributeType
|
||||
* </pre>
|
||||
*
|
||||
* @return a DERObject
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
AttributeX509[] v = new AttributeX509[m_attributes.Count];
|
||||
for (int i = 0; i < m_attributes.Count; ++i)
|
||||
{
|
||||
v[i] = m_attributes[i];
|
||||
}
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the attributes.
|
||||
*/
|
||||
public IEnumerable<AttributeX509> Attributes
|
||||
{
|
||||
get { return CollectionUtilities.Proxy(m_attributes); }
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectDirectoryAttributes.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectDirectoryAttributes.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e63f3e4524e010544b8d379637ab3a11
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectDirectoryAttributes.cs
|
||||
uploadId: 783279
|
||||
136
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectKeyIdentifier.cs
vendored
Normal file
136
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectKeyIdentifier.cs
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The SubjectKeyIdentifier object.
|
||||
* <pre>
|
||||
* SubjectKeyIdentifier::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public class SubjectKeyIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static SubjectKeyIdentifier GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1OctetString.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static SubjectKeyIdentifier GetInstance(object obj)
|
||||
{
|
||||
if (obj is SubjectKeyIdentifier)
|
||||
return (SubjectKeyIdentifier)obj;
|
||||
if (obj is SubjectPublicKeyInfo)
|
||||
return new SubjectKeyIdentifier((SubjectPublicKeyInfo)obj);
|
||||
if (obj is X509Extension)
|
||||
return GetInstance(X509Extension.ConvertValueToObject((X509Extension)obj));
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new SubjectKeyIdentifier(Asn1OctetString.GetInstance(obj));
|
||||
}
|
||||
|
||||
public static SubjectKeyIdentifier FromExtensions(X509Extensions extensions)
|
||||
{
|
||||
return GetInstance(X509Extensions.GetExtensionParsedValue(extensions, X509Extensions.SubjectKeyIdentifier));
|
||||
}
|
||||
|
||||
private readonly byte[] keyIdentifier;
|
||||
|
||||
public SubjectKeyIdentifier(
|
||||
byte[] keyID)
|
||||
{
|
||||
if (keyID == null)
|
||||
throw new ArgumentNullException("keyID");
|
||||
|
||||
this.keyIdentifier = Arrays.Clone(keyID);
|
||||
}
|
||||
|
||||
public SubjectKeyIdentifier(
|
||||
Asn1OctetString keyID)
|
||||
: this(keyID.GetOctets())
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the keyIdentifier using a SHA1 hash over the BIT STRING
|
||||
* from SubjectPublicKeyInfo as defined in RFC3280.
|
||||
*
|
||||
* @param spki the subject public key info.
|
||||
*/
|
||||
public SubjectKeyIdentifier(
|
||||
SubjectPublicKeyInfo spki)
|
||||
{
|
||||
this.keyIdentifier = GetDigest(spki);
|
||||
}
|
||||
|
||||
public byte[] GetKeyIdentifier()
|
||||
{
|
||||
return Arrays.Clone(keyIdentifier);
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerOctetString(GetKeyIdentifier());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a RFC 3280 type 1 key identifier. As in:
|
||||
* <pre>
|
||||
* (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
|
||||
* value of the BIT STRING subjectPublicKey (excluding the tag,
|
||||
* length, and number of unused bits).
|
||||
* </pre>
|
||||
* @param keyInfo the key info object containing the subjectPublicKey field.
|
||||
* @return the key identifier.
|
||||
*/
|
||||
public static SubjectKeyIdentifier CreateSha1KeyIdentifier(
|
||||
SubjectPublicKeyInfo keyInfo)
|
||||
{
|
||||
return new SubjectKeyIdentifier(keyInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a RFC 3280 type 2 key identifier. As in:
|
||||
* <pre>
|
||||
* (2) The keyIdentifier is composed of a four bit type field with
|
||||
* the value 0100 followed by the least significant 60 bits of the
|
||||
* SHA-1 hash of the value of the BIT STRING subjectPublicKey.
|
||||
* </pre>
|
||||
* @param keyInfo the key info object containing the subjectPublicKey field.
|
||||
* @return the key identifier.
|
||||
*/
|
||||
public static SubjectKeyIdentifier CreateTruncatedSha1KeyIdentifier(
|
||||
SubjectPublicKeyInfo keyInfo)
|
||||
{
|
||||
byte[] dig = GetDigest(keyInfo);
|
||||
byte[] id = new byte[8];
|
||||
|
||||
Array.Copy(dig, dig.Length - 8, id, 0, id.Length);
|
||||
|
||||
id[0] &= 0x0f;
|
||||
id[0] |= 0x40;
|
||||
|
||||
return new SubjectKeyIdentifier(id);
|
||||
}
|
||||
|
||||
private static byte[] GetDigest(
|
||||
SubjectPublicKeyInfo spki)
|
||||
{
|
||||
IDigest digest = new Sha1Digest();
|
||||
byte[] resBuf = new byte[digest.GetDigestSize()];
|
||||
|
||||
byte[] bytes = spki.PublicKeyData.GetBytes();
|
||||
digest.BlockUpdate(bytes, 0, bytes.Length);
|
||||
digest.DoFinal(resBuf, 0);
|
||||
return resBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectKeyIdentifier.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectKeyIdentifier.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10e4966ea65e15f488280b6f40d23903
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectKeyIdentifier.cs
|
||||
uploadId: 783279
|
||||
105
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectPublicKeyInfo.cs
vendored
Normal file
105
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectPublicKeyInfo.cs
vendored
Normal file
@ -0,0 +1,105 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
/**
|
||||
* The object that contains the public key stored in a certficate.
|
||||
* <p>
|
||||
* The GetEncoded() method in the public keys in the JCE produces a DER
|
||||
* encoded one of these.</p>
|
||||
*/
|
||||
public class SubjectPublicKeyInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly AlgorithmIdentifier algID;
|
||||
private readonly DerBitString keyData;
|
||||
|
||||
public static SubjectPublicKeyInfo GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static SubjectPublicKeyInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is SubjectPublicKeyInfo)
|
||||
return (SubjectPublicKeyInfo) obj;
|
||||
|
||||
if (obj != null)
|
||||
return new SubjectPublicKeyInfo(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public SubjectPublicKeyInfo(
|
||||
AlgorithmIdentifier algID,
|
||||
Asn1Encodable publicKey)
|
||||
{
|
||||
this.keyData = new DerBitString(publicKey);
|
||||
this.algID = algID;
|
||||
}
|
||||
|
||||
public SubjectPublicKeyInfo(
|
||||
AlgorithmIdentifier algID,
|
||||
byte[] publicKey)
|
||||
{
|
||||
this.keyData = new DerBitString(publicKey);
|
||||
this.algID = algID;
|
||||
}
|
||||
|
||||
private SubjectPublicKeyInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
this.algID = AlgorithmIdentifier.GetInstance(seq[0]);
|
||||
this.keyData = DerBitString.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier AlgorithmID
|
||||
{
|
||||
get { return algID; }
|
||||
}
|
||||
|
||||
/**
|
||||
* for when the public key is an encoded object - if the bitstring
|
||||
* can't be decoded this routine raises an IOException.
|
||||
*
|
||||
* @exception IOException - if the bit string doesn't represent a Der
|
||||
* encoded object.
|
||||
*/
|
||||
public Asn1Object ParsePublicKey()
|
||||
{
|
||||
return Asn1Object.FromByteArray(keyData.GetOctets());
|
||||
}
|
||||
|
||||
/**
|
||||
* for when the public key is raw bits...
|
||||
*/
|
||||
public DerBitString PublicKeyData
|
||||
{
|
||||
get { return keyData; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SubjectPublicKeyInfo ::= Sequence {
|
||||
* algorithm AlgorithmIdentifier,
|
||||
* publicKey BIT STRING }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(algID, keyData);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectPublicKeyInfo.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectPublicKeyInfo.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbbb93bf96759c44c9a717aeae4fdd73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/SubjectPublicKeyInfo.cs
|
||||
uploadId: 783279
|
||||
285
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertList.cs
vendored
Normal file
285
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertList.cs
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
|
||||
{
|
||||
public class CrlEntry
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal Asn1Sequence seq;
|
||||
internal DerInteger userCertificate;
|
||||
internal Time revocationDate;
|
||||
internal X509Extensions crlEntryExtensions;
|
||||
|
||||
public CrlEntry(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 2 || seq.Count > 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
|
||||
this.seq = seq;
|
||||
|
||||
userCertificate = DerInteger.GetInstance(seq[0]);
|
||||
revocationDate = Time.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public DerInteger UserCertificate
|
||||
{
|
||||
get { return userCertificate; }
|
||||
}
|
||||
|
||||
public Time RevocationDate
|
||||
{
|
||||
get { return revocationDate; }
|
||||
}
|
||||
|
||||
public X509Extensions Extensions
|
||||
{
|
||||
get
|
||||
{
|
||||
if (crlEntryExtensions == null && seq.Count == 3)
|
||||
{
|
||||
crlEntryExtensions = X509Extensions.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
return crlEntryExtensions;
|
||||
}
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* PKIX RFC-2459 - TbsCertList object.
|
||||
* <pre>
|
||||
* TbsCertList ::= Sequence {
|
||||
* version Version OPTIONAL,
|
||||
* -- if present, shall be v2
|
||||
* signature AlgorithmIdentifier,
|
||||
* issuer Name,
|
||||
* thisUpdate Time,
|
||||
* nextUpdate Time OPTIONAL,
|
||||
* revokedCertificates Sequence OF Sequence {
|
||||
* userCertificate CertificateSerialNumber,
|
||||
* revocationDate Time,
|
||||
* crlEntryExtensions Extensions OPTIONAL
|
||||
* -- if present, shall be v2
|
||||
* } OPTIONAL,
|
||||
* crlExtensions [0] EXPLICIT Extensions OPTIONAL
|
||||
* -- if present, shall be v2
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class TbsCertificateList
|
||||
: Asn1Encodable
|
||||
{
|
||||
private class RevokedCertificatesEnumeration
|
||||
: IEnumerable<CrlEntry>
|
||||
{
|
||||
private readonly IEnumerable<Asn1Encodable> en;
|
||||
|
||||
internal RevokedCertificatesEnumeration(IEnumerable<Asn1Encodable> en)
|
||||
{
|
||||
this.en = en;
|
||||
}
|
||||
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
|
||||
public IEnumerator<CrlEntry> GetEnumerator()
|
||||
{
|
||||
return new RevokedCertificatesEnumerator(en.GetEnumerator());
|
||||
}
|
||||
|
||||
private class RevokedCertificatesEnumerator
|
||||
: IEnumerator<CrlEntry>
|
||||
{
|
||||
private readonly IEnumerator<Asn1Encodable> e;
|
||||
|
||||
internal RevokedCertificatesEnumerator(IEnumerator<Asn1Encodable> e)
|
||||
{
|
||||
this.e = e;
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
return e.MoveNext();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
e.Reset();
|
||||
}
|
||||
|
||||
object System.Collections.IEnumerator.Current
|
||||
{
|
||||
get { return Current; }
|
||||
}
|
||||
|
||||
public CrlEntry Current
|
||||
{
|
||||
get { return new CrlEntry(Asn1Sequence.GetInstance(e.Current)); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal Asn1Sequence seq;
|
||||
internal DerInteger version;
|
||||
internal AlgorithmIdentifier signature;
|
||||
internal X509Name issuer;
|
||||
internal Time thisUpdate;
|
||||
internal Time nextUpdate;
|
||||
internal Asn1Sequence revokedCertificates;
|
||||
internal X509Extensions crlExtensions;
|
||||
|
||||
public static TbsCertificateList GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static TbsCertificateList GetInstance(
|
||||
object obj)
|
||||
{
|
||||
TbsCertificateList list = obj as TbsCertificateList;
|
||||
|
||||
if (obj == null || list != null)
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new TbsCertificateList((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
internal TbsCertificateList(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 3 || seq.Count > 7)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
int seqPos = 0;
|
||||
|
||||
this.seq = seq;
|
||||
|
||||
if (seq[seqPos] is DerInteger)
|
||||
{
|
||||
version = DerInteger.GetInstance(seq[seqPos++]);
|
||||
}
|
||||
else
|
||||
{
|
||||
version = new DerInteger(0);
|
||||
}
|
||||
|
||||
signature = AlgorithmIdentifier.GetInstance(seq[seqPos++]);
|
||||
issuer = X509Name.GetInstance(seq[seqPos++]);
|
||||
thisUpdate = Time.GetInstance(seq[seqPos++]);
|
||||
|
||||
if (seqPos < seq.Count
|
||||
&& (seq[seqPos] is Asn1UtcTime
|
||||
|| seq[seqPos] is Asn1GeneralizedTime
|
||||
|| seq[seqPos] is Time))
|
||||
{
|
||||
nextUpdate = Time.GetInstance(seq[seqPos++]);
|
||||
}
|
||||
|
||||
if (seqPos < seq.Count
|
||||
&& !(seq[seqPos] is Asn1TaggedObject))
|
||||
{
|
||||
revokedCertificates = Asn1Sequence.GetInstance(seq[seqPos++]);
|
||||
}
|
||||
|
||||
if (seqPos < seq.Count
|
||||
&& seq[seqPos] is Asn1TaggedObject)
|
||||
{
|
||||
crlExtensions = X509Extensions.GetInstance(seq[seqPos]);
|
||||
}
|
||||
}
|
||||
|
||||
public int Version
|
||||
{
|
||||
get { return version.IntValueExact + 1; }
|
||||
}
|
||||
|
||||
public DerInteger VersionNumber
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier Signature
|
||||
{
|
||||
get { return signature; }
|
||||
}
|
||||
|
||||
public X509Name Issuer
|
||||
{
|
||||
get { return issuer; }
|
||||
}
|
||||
|
||||
public Time ThisUpdate
|
||||
{
|
||||
get { return thisUpdate; }
|
||||
}
|
||||
|
||||
public Time NextUpdate
|
||||
{
|
||||
get { return nextUpdate; }
|
||||
}
|
||||
|
||||
public CrlEntry[] GetRevokedCertificates()
|
||||
{
|
||||
if (revokedCertificates == null)
|
||||
{
|
||||
return new CrlEntry[0];
|
||||
}
|
||||
|
||||
CrlEntry[] entries = new CrlEntry[revokedCertificates.Count];
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
entries[i] = new CrlEntry(Asn1Sequence.GetInstance(revokedCertificates[i]));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public IEnumerable<CrlEntry> GetRevokedCertificateEnumeration()
|
||||
{
|
||||
if (revokedCertificates == null)
|
||||
return new List<CrlEntry>(0);
|
||||
|
||||
return new RevokedCertificatesEnumeration(revokedCertificates);
|
||||
}
|
||||
|
||||
public X509Extensions Extensions
|
||||
{
|
||||
get { return crlExtensions; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return seq;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertList.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertList.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1511051cab8c684f8babf210ce65f01
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertList.cs
|
||||
uploadId: 783279
|
||||
260
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertificateStructure.cs
vendored
Normal file
260
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertificateStructure.cs
vendored
Normal file
@ -0,0 +1,260 @@
|
||||
#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.X509
|
||||
{
|
||||
/**
|
||||
* The TbsCertificate object.
|
||||
* <pre>
|
||||
* TbsCertificate ::= Sequence {
|
||||
* version [ 0 ] Version DEFAULT v1(0),
|
||||
* serialNumber CertificateSerialNumber,
|
||||
* signature AlgorithmIdentifier,
|
||||
* issuer Name,
|
||||
* validity Validity,
|
||||
* subject Name,
|
||||
* subjectPublicKeyInfo SubjectPublicKeyInfo,
|
||||
* issuerUniqueID [ 1 ] IMPLICIT UniqueIdentifier OPTIONAL,
|
||||
* subjectUniqueID [ 2 ] IMPLICIT UniqueIdentifier OPTIONAL,
|
||||
* extensions [ 3 ] Extensions OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
* <p>
|
||||
* Note: issuerUniqueID and subjectUniqueID are both deprecated by the IETF. This class
|
||||
* will parse them, but you really shouldn't be creating new ones.</p>
|
||||
*/
|
||||
public class TbsCertificateStructure
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal Asn1Sequence seq;
|
||||
internal DerInteger version;
|
||||
internal DerInteger serialNumber;
|
||||
internal AlgorithmIdentifier signature;
|
||||
internal X509Name issuer;
|
||||
internal Time startDate, endDate;
|
||||
internal X509Name subject;
|
||||
internal SubjectPublicKeyInfo subjectPublicKeyInfo;
|
||||
internal DerBitString issuerUniqueID;
|
||||
internal DerBitString subjectUniqueID;
|
||||
internal X509Extensions extensions;
|
||||
|
||||
public static TbsCertificateStructure GetInstance(
|
||||
Asn1TaggedObject obj,
|
||||
bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static TbsCertificateStructure GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is TbsCertificateStructure)
|
||||
return (TbsCertificateStructure) obj;
|
||||
|
||||
if (obj != null)
|
||||
return new TbsCertificateStructure(Asn1Sequence.GetInstance(obj));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
internal TbsCertificateStructure(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
int seqStart = 0;
|
||||
|
||||
this.seq = seq;
|
||||
|
||||
//
|
||||
// some certficates don't include a version number - we assume v1
|
||||
//
|
||||
if (seq[0] is Asn1TaggedObject)
|
||||
{
|
||||
version = DerInteger.GetInstance((Asn1TaggedObject)seq[0], true);
|
||||
}
|
||||
else
|
||||
{
|
||||
seqStart = -1; // field 0 is missing!
|
||||
version = new DerInteger(0);
|
||||
}
|
||||
|
||||
bool isV1 = false;
|
||||
bool isV2 = false;
|
||||
|
||||
if (version.HasValue(0))
|
||||
{
|
||||
isV1 = true;
|
||||
}
|
||||
else if (version.HasValue(1))
|
||||
{
|
||||
isV2 = true;
|
||||
}
|
||||
else if (!version.HasValue(2))
|
||||
{
|
||||
throw new ArgumentException("version number not recognised");
|
||||
}
|
||||
|
||||
serialNumber = DerInteger.GetInstance(seq[seqStart + 1]);
|
||||
|
||||
signature = AlgorithmIdentifier.GetInstance(seq[seqStart + 2]);
|
||||
issuer = X509Name.GetInstance(seq[seqStart + 3]);
|
||||
|
||||
//
|
||||
// before and after dates
|
||||
//
|
||||
Asn1Sequence dates = (Asn1Sequence)seq[seqStart + 4];
|
||||
|
||||
startDate = Time.GetInstance(dates[0]);
|
||||
endDate = Time.GetInstance(dates[1]);
|
||||
|
||||
subject = X509Name.GetInstance(seq[seqStart + 5]);
|
||||
|
||||
//
|
||||
// public key info.
|
||||
//
|
||||
subjectPublicKeyInfo = SubjectPublicKeyInfo.GetInstance(seq[seqStart + 6]);
|
||||
|
||||
int extras = seq.Count - (seqStart + 6) - 1;
|
||||
if (extras != 0 && isV1)
|
||||
throw new ArgumentException("version 1 certificate contains extra data");
|
||||
|
||||
while (extras > 0)
|
||||
{
|
||||
Asn1TaggedObject extra = Asn1TaggedObject.GetInstance(seq[seqStart + 6 + extras]);
|
||||
switch (extra.TagNo)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
issuerUniqueID = DerBitString.GetInstance(extra, false);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
subjectUniqueID = DerBitString.GetInstance(extra, false);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
if (isV2)
|
||||
throw new ArgumentException("version 2 certificate cannot contain extensions");
|
||||
|
||||
extensions = X509Extensions.GetInstance(Asn1Sequence.GetInstance(extra, true));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new ArgumentException("Unknown tag encountered in structure: " + extra.TagNo);
|
||||
}
|
||||
}
|
||||
extras--;
|
||||
}
|
||||
}
|
||||
|
||||
public int Version
|
||||
{
|
||||
get { return version.IntValueExact + 1; }
|
||||
}
|
||||
|
||||
public DerInteger VersionNumber
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public DerInteger SerialNumber
|
||||
{
|
||||
get { return serialNumber; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier Signature
|
||||
{
|
||||
get { return signature; }
|
||||
}
|
||||
|
||||
public X509Name Issuer
|
||||
{
|
||||
get { return issuer; }
|
||||
}
|
||||
|
||||
public Time StartDate
|
||||
{
|
||||
get { return startDate; }
|
||||
}
|
||||
|
||||
public Time EndDate
|
||||
{
|
||||
get { return endDate; }
|
||||
}
|
||||
|
||||
public X509Name Subject
|
||||
{
|
||||
get { return subject; }
|
||||
}
|
||||
|
||||
public SubjectPublicKeyInfo SubjectPublicKeyInfo
|
||||
{
|
||||
get { return subjectPublicKeyInfo; }
|
||||
}
|
||||
|
||||
public DerBitString IssuerUniqueID
|
||||
{
|
||||
get { return issuerUniqueID; }
|
||||
}
|
||||
|
||||
public DerBitString SubjectUniqueID
|
||||
{
|
||||
get { return subjectUniqueID; }
|
||||
}
|
||||
|
||||
public X509Extensions Extensions
|
||||
{
|
||||
get { return extensions; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
string property = Org.BouncyCastle.Utilities.Platform.GetEnvironmentVariable("Best.HTTP.SecureProtocol.Org.BouncyCastle.X509.Allow_Non-DER_TBSCert");
|
||||
if (null == property || Org.BouncyCastle.Utilities.Platform.EqualsIgnoreCase("true", property))
|
||||
return seq;
|
||||
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
// DEFAULT Zero
|
||||
if (!version.HasValue(0))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 0, version));
|
||||
}
|
||||
|
||||
v.Add(serialNumber, signature, issuer);
|
||||
|
||||
//
|
||||
// before and after dates
|
||||
//
|
||||
v.Add(new DerSequence(startDate, endDate));
|
||||
|
||||
if (subject != null)
|
||||
{
|
||||
v.Add(subject);
|
||||
}
|
||||
else
|
||||
{
|
||||
v.Add(DerSequence.Empty);
|
||||
}
|
||||
|
||||
v.Add(subjectPublicKeyInfo);
|
||||
|
||||
// Note: implicit tag
|
||||
v.AddOptionalTagged(false, 1, issuerUniqueID);
|
||||
|
||||
// Note: implicit tag
|
||||
v.AddOptionalTagged(false, 2, subjectUniqueID);
|
||||
|
||||
v.AddOptionalTagged(true, 3, extensions);
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
18
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertificateStructure.cs.meta
vendored
Normal file
18
Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertificateStructure.cs.meta
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3e198666d87c8f40baffa2ebdc1bcfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 267636
|
||||
packageName: Best HTTP
|
||||
packageVersion: 3.0.17
|
||||
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/x509/TBSCertificateStructure.cs
|
||||
uploadId: 783279
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user