This commit is contained in:
2026-06-15 18:18:16 +08:00
parent 97c9fba14e
commit 2b9f134e5f
4164 changed files with 386922 additions and 79 deletions

View File

@@ -0,0 +1,87 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Collections.Generic;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// RFC 3126: 4.3.1 Certificate Values Attribute Definition
/// <code>
/// CertificateValues ::= SEQUENCE OF Certificate
/// </code>
/// </remarks>
public class CertificateValues
: Asn1Encodable
{
private readonly Asn1Sequence certificates;
public static CertificateValues GetInstance(
object obj)
{
if (obj == null || obj is CertificateValues)
return (CertificateValues) obj;
if (obj is Asn1Sequence)
return new CertificateValues((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CertificateValues' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CertificateValues(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
foreach (Asn1Encodable ae in seq)
{
X509CertificateStructure.GetInstance(ae.ToAsn1Object());
}
this.certificates = seq;
}
public CertificateValues(
params X509CertificateStructure[] certificates)
{
if (certificates == null)
throw new ArgumentNullException("certificates");
this.certificates = new DerSequence(certificates);
}
public CertificateValues(
IEnumerable<X509CertificateStructure> certificates)
{
if (certificates == null)
throw new ArgumentNullException("certificates");
this.certificates = new DerSequence(
Asn1EncodableVector.FromEnumerable(certificates));
}
public X509CertificateStructure[] GetCertificates()
{
X509CertificateStructure[] result = new X509CertificateStructure[certificates.Count];
for (int i = 0; i < certificates.Count; ++i)
{
result[i] = X509CertificateStructure.GetInstance(certificates[i]);
}
return result;
}
public override Asn1Object ToAsn1Object()
{
return certificates;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 092b4648537b98d4b847275b3d4faf9a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
public abstract class CommitmentTypeIdentifier
{
public static readonly DerObjectIdentifier ProofOfOrigin = PkcsObjectIdentifiers.IdCtiEtsProofOfOrigin;
public static readonly DerObjectIdentifier ProofOfReceipt = PkcsObjectIdentifiers.IdCtiEtsProofOfReceipt;
public static readonly DerObjectIdentifier ProofOfDelivery = PkcsObjectIdentifiers.IdCtiEtsProofOfDelivery;
public static readonly DerObjectIdentifier ProofOfSender = PkcsObjectIdentifiers.IdCtiEtsProofOfSender;
public static readonly DerObjectIdentifier ProofOfApproval = PkcsObjectIdentifiers.IdCtiEtsProofOfApproval;
public static readonly DerObjectIdentifier ProofOfCreation = PkcsObjectIdentifiers.IdCtiEtsProofOfCreation;
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ec3d445a64faf9a4990e3f85b9972b01
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,94 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
public class CommitmentTypeIndication
: Asn1Encodable
{
private readonly DerObjectIdentifier commitmentTypeId;
private readonly Asn1Sequence commitmentTypeQualifier;
public static CommitmentTypeIndication GetInstance(
object obj)
{
if (obj == null || obj is CommitmentTypeIndication)
return (CommitmentTypeIndication) obj;
if (obj is Asn1Sequence)
return new CommitmentTypeIndication((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CommitmentTypeIndication' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
public CommitmentTypeIndication(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.commitmentTypeId = (DerObjectIdentifier) seq[0].ToAsn1Object();
if (seq.Count > 1)
{
this.commitmentTypeQualifier = (Asn1Sequence) seq[1].ToAsn1Object();
}
}
public CommitmentTypeIndication(
DerObjectIdentifier commitmentTypeId)
: this(commitmentTypeId, null)
{
}
public CommitmentTypeIndication(
DerObjectIdentifier commitmentTypeId,
Asn1Sequence commitmentTypeQualifier)
{
if (commitmentTypeId == null)
throw new ArgumentNullException("commitmentTypeId");
this.commitmentTypeId = commitmentTypeId;
if (commitmentTypeQualifier != null)
{
this.commitmentTypeQualifier = commitmentTypeQualifier;
}
}
public DerObjectIdentifier CommitmentTypeID
{
get { return commitmentTypeId; }
}
public Asn1Sequence CommitmentTypeQualifier
{
get { return commitmentTypeQualifier; }
}
/**
* <pre>
* CommitmentTypeIndication ::= SEQUENCE {
* commitmentTypeId CommitmentTypeIdentifier,
* commitmentTypeQualifier SEQUENCE SIZE (1..MAX) OF
* CommitmentTypeQualifier OPTIONAL }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(commitmentTypeId);
v.AddOptional(commitmentTypeQualifier);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2da3d0e0966b8f44dbf55929a796f6bc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
#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.Esf
{
/**
* Commitment type qualifiers, used in the Commitment-Type-Indication attribute (RFC3126).
*
* <pre>
* CommitmentTypeQualifier ::= SEQUENCE {
* commitmentTypeIdentifier CommitmentTypeIdentifier,
* qualifier ANY DEFINED BY commitmentTypeIdentifier OPTIONAL }
* </pre>
*/
public class CommitmentTypeQualifier
: Asn1Encodable
{
private readonly DerObjectIdentifier commitmentTypeIdentifier;
private readonly Asn1Object qualifier;
/**
* Creates a new <code>CommitmentTypeQualifier</code> instance.
*
* @param commitmentTypeIdentifier a <code>CommitmentTypeIdentifier</code> value
*/
public CommitmentTypeQualifier(
DerObjectIdentifier commitmentTypeIdentifier)
: this(commitmentTypeIdentifier, null)
{
}
/**
* Creates a new <code>CommitmentTypeQualifier</code> instance.
*
* @param commitmentTypeIdentifier a <code>CommitmentTypeIdentifier</code> value
* @param qualifier the qualifier, defined by the above field.
*/
public CommitmentTypeQualifier(
DerObjectIdentifier commitmentTypeIdentifier,
Asn1Encodable qualifier)
{
if (commitmentTypeIdentifier == null)
throw new ArgumentNullException("commitmentTypeIdentifier");
this.commitmentTypeIdentifier = commitmentTypeIdentifier;
if (qualifier != null)
{
this.qualifier = qualifier.ToAsn1Object();
}
}
/**
* Creates a new <code>CommitmentTypeQualifier</code> instance.
*
* @param as <code>CommitmentTypeQualifier</code> structure
* encoded as an Asn1Sequence.
*/
public CommitmentTypeQualifier(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
commitmentTypeIdentifier = (DerObjectIdentifier) seq[0].ToAsn1Object();
if (seq.Count > 1)
{
qualifier = seq[1].ToAsn1Object();
}
}
public static CommitmentTypeQualifier GetInstance(
object obj)
{
if (obj == null || obj is CommitmentTypeQualifier)
return (CommitmentTypeQualifier) obj;
if (obj is Asn1Sequence)
return new CommitmentTypeQualifier((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CommitmentTypeQualifier' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
public DerObjectIdentifier CommitmentTypeIdentifier
{
get { return commitmentTypeIdentifier; }
}
public Asn1Object Qualifier
{
get { return qualifier; }
}
/**
* Returns a DER-encodable representation of this instance.
*
* @return a <code>Asn1Object</code> value
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(commitmentTypeIdentifier);
v.AddOptional(qualifier);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e2eb54d61b3c7e0429e81810ee930b75
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.1 Complete Certificate Refs Attribute Definition
/// <code>
/// CompleteCertificateRefs ::= SEQUENCE OF OtherCertID
/// </code>
/// </remarks>
public class CompleteCertificateRefs
: Asn1Encodable
{
private readonly Asn1Sequence otherCertIDs;
public static CompleteCertificateRefs GetInstance(
object obj)
{
if (obj == null || obj is CompleteCertificateRefs)
return (CompleteCertificateRefs) obj;
if (obj is Asn1Sequence)
return new CompleteCertificateRefs((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CompleteCertificateRefs' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CompleteCertificateRefs(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
foreach (Asn1Encodable ae in seq)
{
OtherCertID.GetInstance(ae.ToAsn1Object());
}
this.otherCertIDs = seq;
}
public CompleteCertificateRefs(
params OtherCertID[] otherCertIDs)
{
if (otherCertIDs == null)
throw new ArgumentNullException("otherCertIDs");
this.otherCertIDs = new DerSequence(otherCertIDs);
}
public CompleteCertificateRefs(
IEnumerable<OtherCertID> otherCertIDs)
{
if (otherCertIDs == null)
throw new ArgumentNullException("otherCertIDs");
this.otherCertIDs = new DerSequence(
Asn1EncodableVector.FromEnumerable(otherCertIDs));
}
public OtherCertID[] GetOtherCertIDs()
{
OtherCertID[] result = new OtherCertID[otherCertIDs.Count];
for (int i = 0; i < otherCertIDs.Count; ++i)
{
result[i] = OtherCertID.GetInstance(otherCertIDs[i].ToAsn1Object());
}
return result;
}
public override Asn1Object ToAsn1Object()
{
return otherCertIDs;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e47f9b58addc6cb4681cf1609c99d441
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,86 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// CompleteRevocationRefs ::= SEQUENCE OF CrlOcspRef
/// </code>
/// </remarks>
public class CompleteRevocationRefs
: Asn1Encodable
{
private readonly Asn1Sequence crlOcspRefs;
public static CompleteRevocationRefs GetInstance(
object obj)
{
if (obj == null || obj is CompleteRevocationRefs)
return (CompleteRevocationRefs) obj;
if (obj is Asn1Sequence)
return new CompleteRevocationRefs((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CompleteRevocationRefs' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CompleteRevocationRefs(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
foreach (Asn1Encodable ae in seq)
{
CrlOcspRef.GetInstance(ae.ToAsn1Object());
}
this.crlOcspRefs = seq;
}
public CompleteRevocationRefs(
params CrlOcspRef[] crlOcspRefs)
{
if (crlOcspRefs == null)
throw new ArgumentNullException("crlOcspRefs");
this.crlOcspRefs = new DerSequence(crlOcspRefs);
}
public CompleteRevocationRefs(
IEnumerable<CrlOcspRef> crlOcspRefs)
{
if (crlOcspRefs == null)
throw new ArgumentNullException("crlOcspRefs");
this.crlOcspRefs = new DerSequence(
Asn1EncodableVector.FromEnumerable(crlOcspRefs));
}
public CrlOcspRef[] GetCrlOcspRefs()
{
CrlOcspRef[] result = new CrlOcspRef[crlOcspRefs.Count];
for (int i = 0; i < crlOcspRefs.Count; ++i)
{
result[i] = CrlOcspRef.GetInstance(crlOcspRefs[i].ToAsn1Object());
}
return result;
}
public override Asn1Object ToAsn1Object()
{
return crlOcspRefs;
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b7f0539207fca804897c87c6a2c1c3e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,121 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Reflection;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// CrlIdentifier ::= SEQUENCE
/// {
/// crlissuer Name,
/// crlIssuedTime UTCTime,
/// crlNumber INTEGER OPTIONAL
/// }
/// </code>
/// </remarks>
public class CrlIdentifier
: Asn1Encodable
{
private readonly X509Name crlIssuer;
private readonly Asn1UtcTime crlIssuedTime;
private readonly DerInteger crlNumber;
public static CrlIdentifier GetInstance(object obj)
{
if (obj == null)
return null;
if (obj is CrlIdentifier crlIdentifier)
return crlIdentifier;
if (obj is Asn1Sequence asn1Sequence)
return new CrlIdentifier(asn1Sequence);
throw new ArgumentException("Unknown object in 'CrlIdentifier' factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
nameof(obj));
}
private CrlIdentifier(Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException(nameof(seq));
if (seq.Count < 2 || seq.Count > 3)
throw new ArgumentException("Bad sequence size: " + seq.Count, nameof(seq));
this.crlIssuer = X509Name.GetInstance(seq[0]);
this.crlIssuedTime = Asn1UtcTime.GetInstance(seq[1]);
// Validate crlIssuedTime is in the appropriate year range
crlIssuedTime.ToDateTime(2049);
if (seq.Count > 2)
{
this.crlNumber = DerInteger.GetInstance(seq[2]);
}
}
public CrlIdentifier(X509Name crlIssuer, DateTime crlIssuedTime)
: this(crlIssuer, crlIssuedTime, null)
{
}
public CrlIdentifier(X509Name crlIssuer, DateTime crlIssuedTime, BigInteger crlNumber)
: this(crlIssuer, new Asn1UtcTime(crlIssuedTime, 2049), crlNumber)
{
}
public CrlIdentifier(X509Name crlIssuer, Asn1UtcTime crlIssuedTime)
: this(crlIssuer, crlIssuedTime, null)
{
}
public CrlIdentifier(X509Name crlIssuer, Asn1UtcTime crlIssuedTime, BigInteger crlNumber)
{
if (crlIssuer == null)
throw new ArgumentNullException(nameof(crlIssuer));
if (crlIssuedTime == null)
throw new ArgumentNullException(nameof(crlIssuedTime));
// Validate crlIssuedTime is in the appropriate year range
crlIssuedTime.ToDateTime(2049);
this.crlIssuer = crlIssuer;
this.crlIssuedTime = crlIssuedTime;
if (null != crlNumber)
{
this.crlNumber = new DerInteger(crlNumber);
}
}
public X509Name CrlIssuer
{
get { return crlIssuer; }
}
public DateTime CrlIssuedTime
{
get { return crlIssuedTime.ToDateTime(2049); }
}
public BigInteger CrlNumber
{
get { return crlNumber == null ? null : crlNumber.Value; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(crlIssuer.ToAsn1Object(), crlIssuedTime);
v.AddOptional(crlNumber);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2b010df93d63524d8d0bcc16d49dd8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// CRLListID ::= SEQUENCE
/// {
/// crls SEQUENCE OF CrlValidatedID
/// }
/// </code>
/// </remarks>
public class CrlListID
: Asn1Encodable
{
private readonly Asn1Sequence crls;
public static CrlListID GetInstance(
object obj)
{
if (obj == null || obj is CrlListID)
return (CrlListID) obj;
if (obj is Asn1Sequence)
return new CrlListID((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CrlListID' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CrlListID(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 1)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.crls = (Asn1Sequence) seq[0].ToAsn1Object();
foreach (Asn1Encodable ae in this.crls)
{
CrlValidatedID.GetInstance(ae.ToAsn1Object());
}
}
public CrlListID(
params CrlValidatedID[] crls)
{
if (crls == null)
throw new ArgumentNullException("crls");
this.crls = new DerSequence(crls);
}
public CrlListID(
IEnumerable<CrlValidatedID> crls)
{
if (crls == null)
throw new ArgumentNullException("crls");
this.crls = new DerSequence(
Asn1EncodableVector.FromEnumerable(crls));
}
public CrlValidatedID[] GetCrls()
{
CrlValidatedID[] result = new CrlValidatedID[crls.Count];
for (int i = 0; i < crls.Count; ++i)
{
result[i] = CrlValidatedID.GetInstance(crls[i].ToAsn1Object());
}
return result;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(crls);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2934f373eaa3fa439de7053968641ec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// CrlOcspRef ::= SEQUENCE {
/// crlids [0] CRLListID OPTIONAL,
/// ocspids [1] OcspListID OPTIONAL,
/// otherRev [2] OtherRevRefs OPTIONAL
/// }
/// </code>
/// </remarks>
public class CrlOcspRef
: Asn1Encodable
{
private readonly CrlListID crlids;
private readonly OcspListID ocspids;
private readonly OtherRevRefs otherRev;
public static CrlOcspRef GetInstance(
object obj)
{
if (obj == null || obj is CrlOcspRef)
return (CrlOcspRef) obj;
if (obj is Asn1Sequence)
return new CrlOcspRef((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CrlOcspRef' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CrlOcspRef(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
foreach (Asn1TaggedObject taggedObj in seq)
{
Asn1Object asn1Obj = taggedObj.GetObject();
switch (taggedObj.TagNo)
{
case 0:
this.crlids = CrlListID.GetInstance(asn1Obj);
break;
case 1:
this.ocspids = OcspListID.GetInstance(asn1Obj);
break;
case 2:
this.otherRev = OtherRevRefs.GetInstance(asn1Obj);
break;
default:
throw new ArgumentException("Illegal tag in CrlOcspRef", "seq");
}
}
}
public CrlOcspRef(
CrlListID crlids,
OcspListID ocspids,
OtherRevRefs otherRev)
{
this.crlids = crlids;
this.ocspids = ocspids;
this.otherRev = otherRev;
}
public CrlListID CrlIDs
{
get { return crlids; }
}
public OcspListID OcspIDs
{
get { return ocspids; }
}
public OtherRevRefs OtherRev
{
get { return otherRev; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
if (crlids != null)
{
v.Add(new DerTaggedObject(true, 0, crlids.ToAsn1Object()));
}
if (ocspids != null)
{
v.Add(new DerTaggedObject(true, 1, ocspids.ToAsn1Object()));
}
if (otherRev != null)
{
v.Add(new DerTaggedObject(true, 2, otherRev.ToAsn1Object()));
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c2b8ede172bb0f94880558a47cb9856b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// CrlValidatedID ::= SEQUENCE {
/// crlHash OtherHash,
/// crlIdentifier CrlIdentifier OPTIONAL}
/// </code>
/// </remarks>
public class CrlValidatedID
: Asn1Encodable
{
private readonly OtherHash crlHash;
private readonly CrlIdentifier crlIdentifier;
public static CrlValidatedID GetInstance(
object obj)
{
if (obj == null || obj is CrlValidatedID)
return (CrlValidatedID) obj;
if (obj is Asn1Sequence)
return new CrlValidatedID((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'CrlValidatedID' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private CrlValidatedID(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.crlHash = OtherHash.GetInstance(seq[0].ToAsn1Object());
if (seq.Count > 1)
{
this.crlIdentifier = CrlIdentifier.GetInstance(seq[1].ToAsn1Object());
}
}
public CrlValidatedID(
OtherHash crlHash)
: this(crlHash, null)
{
}
public CrlValidatedID(
OtherHash crlHash,
CrlIdentifier crlIdentifier)
{
if (crlHash == null)
throw new ArgumentNullException("crlHash");
this.crlHash = crlHash;
this.crlIdentifier = crlIdentifier;
}
public OtherHash CrlHash
{
get { return crlHash; }
}
public CrlIdentifier CrlIdentifier
{
get { return crlIdentifier; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(crlHash.ToAsn1Object());
if (crlIdentifier != null)
{
v.Add(crlIdentifier.ToAsn1Object());
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 92f8ddba6175fa941a7707d004cd0830
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,29 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
public abstract class EsfAttributes
{
public static readonly DerObjectIdentifier SigPolicyId = PkcsObjectIdentifiers.IdAAEtsSigPolicyID;
public static readonly DerObjectIdentifier CommitmentType = PkcsObjectIdentifiers.IdAAEtsCommitmentType;
public static readonly DerObjectIdentifier SignerLocation = PkcsObjectIdentifiers.IdAAEtsSignerLocation;
public static readonly DerObjectIdentifier SignerAttr = PkcsObjectIdentifiers.IdAAEtsSignerAttr;
public static readonly DerObjectIdentifier OtherSigCert = PkcsObjectIdentifiers.IdAAEtsOtherSigCert;
public static readonly DerObjectIdentifier ContentTimestamp = PkcsObjectIdentifiers.IdAAEtsContentTimestamp;
public static readonly DerObjectIdentifier CertificateRefs = PkcsObjectIdentifiers.IdAAEtsCertificateRefs;
public static readonly DerObjectIdentifier RevocationRefs = PkcsObjectIdentifiers.IdAAEtsRevocationRefs;
public static readonly DerObjectIdentifier CertValues = PkcsObjectIdentifiers.IdAAEtsCertValues;
public static readonly DerObjectIdentifier RevocationValues = PkcsObjectIdentifiers.IdAAEtsRevocationValues;
public static readonly DerObjectIdentifier EscTimeStamp = PkcsObjectIdentifiers.IdAAEtsEscTimeStamp;
public static readonly DerObjectIdentifier CertCrlTimestamp = PkcsObjectIdentifiers.IdAAEtsCertCrlTimestamp;
public static readonly DerObjectIdentifier ArchiveTimestamp = PkcsObjectIdentifiers.IdAAEtsArchiveTimestamp;
public static readonly DerObjectIdentifier ArchiveTimestampV2 = new DerObjectIdentifier(PkcsObjectIdentifiers.IdAA + ".48");
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dc892043a96f9ba45bb32241548a273a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,91 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// OcspIdentifier ::= SEQUENCE {
/// ocspResponderID ResponderID,
/// -- As in OCSP response data
/// producedAt GeneralizedTime
/// -- As in OCSP response data
/// }
/// </code>
/// </remarks>
public class OcspIdentifier
: Asn1Encodable
{
private readonly ResponderID ocspResponderID;
private readonly Asn1GeneralizedTime producedAt;
public static OcspIdentifier GetInstance(
object obj)
{
if (obj == null || obj is OcspIdentifier)
return (OcspIdentifier) obj;
if (obj is Asn1Sequence)
return new OcspIdentifier((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OcspIdentifier' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OcspIdentifier(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.ocspResponderID = ResponderID.GetInstance(seq[0].ToAsn1Object());
this.producedAt = (Asn1GeneralizedTime)seq[1].ToAsn1Object();
}
public OcspIdentifier(ResponderID ocspResponderID, DateTime producedAt)
{
if (ocspResponderID == null)
throw new ArgumentNullException(nameof(ocspResponderID));
this.ocspResponderID = ocspResponderID;
this.producedAt = new Asn1GeneralizedTime(producedAt);
}
public OcspIdentifier(ResponderID ocspResponderID, Asn1GeneralizedTime producedAt)
{
if (ocspResponderID == null)
throw new ArgumentNullException(nameof(ocspResponderID));
if (producedAt == null)
throw new ArgumentNullException(nameof(producedAt));
this.ocspResponderID = ocspResponderID;
this.producedAt = producedAt;
}
public ResponderID OcspResponderID
{
get { return ocspResponderID; }
}
public DateTime ProducedAt
{
get { return producedAt.ToDateTime(); }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(ocspResponderID, producedAt);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dd3d3b491378a6e4888a6db2ec78ba8c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// OcspListID ::= SEQUENCE {
/// ocspResponses SEQUENCE OF OcspResponsesID
/// }
/// </code>
/// </remarks>
public class OcspListID
: Asn1Encodable
{
private readonly Asn1Sequence ocspResponses;
public static OcspListID GetInstance(
object obj)
{
if (obj == null || obj is OcspListID)
return (OcspListID) obj;
if (obj is Asn1Sequence)
return new OcspListID((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OcspListID' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OcspListID(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 1)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.ocspResponses = (Asn1Sequence) seq[0].ToAsn1Object();
foreach (Asn1Encodable ae in this.ocspResponses)
{
OcspResponsesID.GetInstance(ae.ToAsn1Object());
}
}
public OcspListID(
params OcspResponsesID[] ocspResponses)
{
if (ocspResponses == null)
throw new ArgumentNullException("ocspResponses");
this.ocspResponses = new DerSequence(ocspResponses);
}
public OcspListID(
IEnumerable<OcspResponsesID> ocspResponses)
{
if (ocspResponses == null)
throw new ArgumentNullException("ocspResponses");
this.ocspResponses = new DerSequence(
Asn1EncodableVector.FromEnumerable(ocspResponses));
}
public OcspResponsesID[] GetOcspResponses()
{
OcspResponsesID[] result = new OcspResponsesID[ocspResponses.Count];
for (int i = 0; i < ocspResponses.Count; ++i)
{
result[i] = OcspResponsesID.GetInstance(ocspResponses[i].ToAsn1Object());
}
return result;
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(ocspResponses);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 428f1d09cf895a44194db8d397d51c0f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View 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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// OcspResponsesID ::= SEQUENCE {
/// ocspIdentifier OcspIdentifier,
/// ocspRepHash OtherHash OPTIONAL
/// }
/// </code>
/// </remarks>
public class OcspResponsesID
: Asn1Encodable
{
private readonly OcspIdentifier ocspIdentifier;
private readonly OtherHash ocspRepHash;
public static OcspResponsesID GetInstance(
object obj)
{
if (obj == null || obj is OcspResponsesID)
return (OcspResponsesID) obj;
if (obj is Asn1Sequence)
return new OcspResponsesID((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OcspResponsesID' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OcspResponsesID(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.ocspIdentifier = OcspIdentifier.GetInstance(seq[0].ToAsn1Object());
if (seq.Count > 1)
{
this.ocspRepHash = OtherHash.GetInstance(seq[1].ToAsn1Object());
}
}
public OcspResponsesID(
OcspIdentifier ocspIdentifier)
: this(ocspIdentifier, null)
{
}
public OcspResponsesID(
OcspIdentifier ocspIdentifier,
OtherHash ocspRepHash)
{
if (ocspIdentifier == null)
throw new ArgumentNullException("ocspIdentifier");
this.ocspIdentifier = ocspIdentifier;
this.ocspRepHash = ocspRepHash;
}
public OcspIdentifier OcspIdentifier
{
get { return ocspIdentifier; }
}
public OtherHash OcspRepHash
{
get { return ocspRepHash; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(
ocspIdentifier.ToAsn1Object());
if (ocspRepHash != null)
{
v.Add(ocspRepHash.ToAsn1Object());
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 772b3ba20242d6740b4138bb10e91309
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,98 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// <code>
/// OtherCertID ::= SEQUENCE {
/// otherCertHash OtherHash,
/// issuerSerial IssuerSerial OPTIONAL
/// }
/// </code>
/// </remarks>
public class OtherCertID
: Asn1Encodable
{
private readonly OtherHash otherCertHash;
private readonly IssuerSerial issuerSerial;
public static OtherCertID GetInstance(
object obj)
{
if (obj == null || obj is OtherCertID)
return (OtherCertID) obj;
if (obj is Asn1Sequence)
return new OtherCertID((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OtherCertID' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OtherCertID(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.otherCertHash = OtherHash.GetInstance(seq[0].ToAsn1Object());
if (seq.Count > 1)
{
this.issuerSerial = IssuerSerial.GetInstance(seq[1].ToAsn1Object());
}
}
public OtherCertID(
OtherHash otherCertHash)
: this(otherCertHash, null)
{
}
public OtherCertID(
OtherHash otherCertHash,
IssuerSerial issuerSerial)
{
if (otherCertHash == null)
throw new ArgumentNullException("otherCertHash");
this.otherCertHash = otherCertHash;
this.issuerSerial = issuerSerial;
}
public OtherHash OtherCertHash
{
get { return otherCertHash; }
}
public IssuerSerial IssuerSerial
{
get { return issuerSerial; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(
otherCertHash.ToAsn1Object());
if (issuerSerial != null)
{
v.Add(issuerSerial.ToAsn1Object());
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: caba59b28b7bb2b44ab5f328dabdd593
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Oiw;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// <code>
/// OtherHash ::= CHOICE {
/// sha1Hash OtherHashValue, -- This contains a SHA-1 hash
/// otherHash OtherHashAlgAndValue
/// }
///
/// OtherHashValue ::= OCTET STRING
/// </code>
/// </remarks>
public class OtherHash
: Asn1Encodable, IAsn1Choice
{
private readonly Asn1OctetString sha1Hash;
private readonly OtherHashAlgAndValue otherHash;
public static OtherHash GetInstance(
object obj)
{
if (obj == null || obj is OtherHash)
return (OtherHash) obj;
if (obj is Asn1OctetString)
return new OtherHash((Asn1OctetString) obj);
return new OtherHash(
OtherHashAlgAndValue.GetInstance(obj));
}
public OtherHash(
byte[] sha1Hash)
{
if (sha1Hash == null)
throw new ArgumentNullException("sha1Hash");
this.sha1Hash = new DerOctetString(sha1Hash);
}
public OtherHash(
Asn1OctetString sha1Hash)
{
if (sha1Hash == null)
throw new ArgumentNullException("sha1Hash");
this.sha1Hash = sha1Hash;
}
public OtherHash(
OtherHashAlgAndValue otherHash)
{
if (otherHash == null)
throw new ArgumentNullException("otherHash");
this.otherHash = otherHash;
}
public AlgorithmIdentifier HashAlgorithm
{
get
{
return otherHash == null
? new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1)
: otherHash.HashAlgorithm;
}
}
public byte[] GetHashValue()
{
return otherHash == null
? sha1Hash.GetOctets()
: otherHash.GetHashValue();
}
public override Asn1Object ToAsn1Object()
{
return otherHash == null
? sha1Hash
: otherHash.ToAsn1Object();
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 17c0c475d3163d14dacf8e21ffbaf253
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <summary>
/// Summary description for OtherHashAlgAndValue.
/// </summary>
/// <remarks>
/// <code>
/// OtherHashAlgAndValue ::= SEQUENCE {
/// hashAlgorithm AlgorithmIdentifier,
/// hashValue OtherHashValue
/// }
///
/// OtherHashValue ::= OCTET STRING
/// </code>
/// </remarks>
public class OtherHashAlgAndValue
: Asn1Encodable
{
private readonly AlgorithmIdentifier hashAlgorithm;
private readonly Asn1OctetString hashValue;
public static OtherHashAlgAndValue GetInstance(
object obj)
{
if (obj == null || obj is OtherHashAlgAndValue)
return (OtherHashAlgAndValue) obj;
if (obj is Asn1Sequence)
return new OtherHashAlgAndValue((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OtherHashAlgAndValue' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OtherHashAlgAndValue(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.hashAlgorithm = AlgorithmIdentifier.GetInstance(seq[0].ToAsn1Object());
this.hashValue = (Asn1OctetString) seq[1].ToAsn1Object();
}
public OtherHashAlgAndValue(
AlgorithmIdentifier hashAlgorithm,
byte[] hashValue)
{
if (hashAlgorithm == null)
throw new ArgumentNullException("hashAlgorithm");
if (hashValue == null)
throw new ArgumentNullException("hashValue");
this.hashAlgorithm = hashAlgorithm;
this.hashValue = new DerOctetString(hashValue);
}
public OtherHashAlgAndValue(
AlgorithmIdentifier hashAlgorithm,
Asn1OctetString hashValue)
{
if (hashAlgorithm == null)
throw new ArgumentNullException("hashAlgorithm");
if (hashValue == null)
throw new ArgumentNullException("hashValue");
this.hashAlgorithm = hashAlgorithm;
this.hashValue = hashValue;
}
public AlgorithmIdentifier HashAlgorithm
{
get { return hashAlgorithm; }
}
public byte[] GetHashValue()
{
return hashValue.GetOctets();
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(hashAlgorithm, hashValue);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 298569801435f22439a2aaeb3b72b5d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
/// <code>
/// OtherRevRefs ::= SEQUENCE
/// {
/// otherRevRefType OtherRevRefType,
/// otherRevRefs ANY DEFINED BY otherRevRefType
/// }
///
/// OtherRevRefType ::= OBJECT IDENTIFIER
/// </code>
/// </remarks>
public class OtherRevRefs
: Asn1Encodable
{
private readonly DerObjectIdentifier otherRevRefType;
private readonly Asn1Object otherRevRefs;
public static OtherRevRefs GetInstance(
object obj)
{
if (obj == null || obj is OtherRevRefs)
return (OtherRevRefs) obj;
if (obj is Asn1Sequence)
return new OtherRevRefs((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OtherRevRefs' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OtherRevRefs(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.otherRevRefType = (DerObjectIdentifier) seq[0].ToAsn1Object();
this.otherRevRefs = seq[1].ToAsn1Object();
}
public OtherRevRefs(
DerObjectIdentifier otherRevRefType,
Asn1Encodable otherRevRefs)
{
if (otherRevRefType == null)
throw new ArgumentNullException("otherRevRefType");
if (otherRevRefs == null)
throw new ArgumentNullException("otherRevRefs");
this.otherRevRefType = otherRevRefType;
this.otherRevRefs = otherRevRefs.ToAsn1Object();
}
public DerObjectIdentifier OtherRevRefType
{
get { return otherRevRefType; }
}
public Asn1Object OtherRevRefsObject
{
get { return otherRevRefs; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(otherRevRefType, otherRevRefs);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 25166e4d38113624ba3b78c6201c7cf1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,84 @@
#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.Esf
{
/// <remarks>
/// RFC 3126: 4.3.2 Revocation Values Attribute Definition
/// <code>
/// OtherRevVals ::= SEQUENCE
/// {
/// otherRevValType OtherRevValType,
/// otherRevVals ANY DEFINED BY otherRevValType
/// }
///
/// OtherRevValType ::= OBJECT IDENTIFIER
/// </code>
/// </remarks>
public class OtherRevVals
: Asn1Encodable
{
private readonly DerObjectIdentifier otherRevValType;
private readonly Asn1Object otherRevVals;
public static OtherRevVals GetInstance(
object obj)
{
if (obj == null || obj is OtherRevVals)
return (OtherRevVals) obj;
if (obj is Asn1Sequence)
return new OtherRevVals((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OtherRevVals' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OtherRevVals(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.otherRevValType = (DerObjectIdentifier) seq[0].ToAsn1Object();
this.otherRevVals = seq[1].ToAsn1Object();
}
public OtherRevVals(
DerObjectIdentifier otherRevValType,
Asn1Encodable otherRevVals)
{
if (otherRevValType == null)
throw new ArgumentNullException("otherRevValType");
if (otherRevVals == null)
throw new ArgumentNullException("otherRevVals");
this.otherRevValType = otherRevValType;
this.otherRevVals = otherRevVals.ToAsn1Object();
}
public DerObjectIdentifier OtherRevValType
{
get { return otherRevValType; }
}
public Asn1Object OtherRevValsObject
{
get { return otherRevVals; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(otherRevValType, otherRevVals);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb045476300253e419d767312265270b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,132 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Collections.Generic;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// <code>
/// OtherSigningCertificate ::= SEQUENCE {
/// certs SEQUENCE OF OtherCertID,
/// policies SEQUENCE OF PolicyInformation OPTIONAL
/// }
/// </code>
/// </remarks>
public class OtherSigningCertificate
: Asn1Encodable
{
private readonly Asn1Sequence certs;
private readonly Asn1Sequence policies;
public static OtherSigningCertificate GetInstance(
object obj)
{
if (obj == null || obj is OtherSigningCertificate)
return (OtherSigningCertificate) obj;
if (obj is Asn1Sequence)
return new OtherSigningCertificate((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'OtherSigningCertificate' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private OtherSigningCertificate(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 1 || seq.Count > 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.certs = Asn1Sequence.GetInstance(seq[0].ToAsn1Object());
if (seq.Count > 1)
{
this.policies = Asn1Sequence.GetInstance(seq[1].ToAsn1Object());
}
}
public OtherSigningCertificate(
params OtherCertID[] certs)
: this(certs, null)
{
}
public OtherSigningCertificate(
OtherCertID[] certs,
params PolicyInformation[] policies)
{
if (certs == null)
throw new ArgumentNullException("certs");
this.certs = new DerSequence(certs);
if (policies != null)
{
this.policies = new DerSequence(policies);
}
}
public OtherSigningCertificate(
IEnumerable<OtherCertID> certs)
: this(certs, null)
{
}
public OtherSigningCertificate(
IEnumerable<OtherCertID> certs,
IEnumerable<PolicyInformation> policies)
{
if (certs == null)
throw new ArgumentNullException("certs");
this.certs = new DerSequence(
Asn1EncodableVector.FromEnumerable(certs));
if (policies != null)
{
this.policies = new DerSequence(
Asn1EncodableVector.FromEnumerable(policies));
}
}
public OtherCertID[] GetCerts()
{
OtherCertID[] cs = new OtherCertID[certs.Count];
for (int i = 0; i < certs.Count; ++i)
{
cs[i] = OtherCertID.GetInstance(certs[i].ToAsn1Object());
}
return cs;
}
public PolicyInformation[] GetPolicies()
{
if (policies == null)
return null;
PolicyInformation[] ps = new PolicyInformation[policies.Count];
for (int i = 0; i < policies.Count; ++i)
{
ps[i] = PolicyInformation.GetInstance(policies[i].ToAsn1Object());
}
return ps;
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(certs);
v.AddOptional(policies);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6f7b6b9fb7323464ab4c5b7865a8a444
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,154 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Collections.Generic;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// RFC 5126: 6.3.4. revocation-values Attribute Definition
/// <code>
/// RevocationValues ::= SEQUENCE {
/// crlVals [0] SEQUENCE OF CertificateList OPTIONAL,
/// ocspVals [1] SEQUENCE OF BasicOCSPResponse OPTIONAL,
/// otherRevVals [2] OtherRevVals OPTIONAL
/// }
/// </code>
/// </remarks>
public class RevocationValues
: Asn1Encodable
{
private readonly Asn1Sequence crlVals;
private readonly Asn1Sequence ocspVals;
private readonly OtherRevVals otherRevVals;
public static RevocationValues GetInstance(
object obj)
{
if (obj == null || obj is RevocationValues)
return (RevocationValues) obj;
return new RevocationValues(Asn1Sequence.GetInstance(obj));
}
private RevocationValues(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count > 3)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
foreach (Asn1TaggedObject taggedObj in seq)
{
Asn1Object asn1Obj = taggedObj.GetObject();
switch (taggedObj.TagNo)
{
case 0:
Asn1Sequence crlValsSeq = (Asn1Sequence) asn1Obj;
foreach (Asn1Encodable ae in crlValsSeq)
{
CertificateList.GetInstance(ae.ToAsn1Object());
}
this.crlVals = crlValsSeq;
break;
case 1:
Asn1Sequence ocspValsSeq = (Asn1Sequence) asn1Obj;
foreach (Asn1Encodable ae in ocspValsSeq)
{
BasicOcspResponse.GetInstance(ae.ToAsn1Object());
}
this.ocspVals = ocspValsSeq;
break;
case 2:
this.otherRevVals = OtherRevVals.GetInstance(asn1Obj);
break;
default:
throw new ArgumentException("Illegal tag in RevocationValues", "seq");
}
}
}
public RevocationValues(
CertificateList[] crlVals,
BasicOcspResponse[] ocspVals,
OtherRevVals otherRevVals)
{
if (crlVals != null)
{
this.crlVals = new DerSequence(crlVals);
}
if (ocspVals != null)
{
this.ocspVals = new DerSequence(ocspVals);
}
this.otherRevVals = otherRevVals;
}
public RevocationValues(
IEnumerable<CertificateList> crlVals,
IEnumerable<BasicOcspResponse> ocspVals,
OtherRevVals otherRevVals)
{
if (crlVals != null)
{
this.crlVals = new DerSequence(
Asn1EncodableVector.FromEnumerable(crlVals));
}
if (ocspVals != null)
{
this.ocspVals = new DerSequence(
Asn1EncodableVector.FromEnumerable(ocspVals));
}
this.otherRevVals = otherRevVals;
}
public CertificateList[] GetCrlVals()
{
CertificateList[] result = new CertificateList[crlVals.Count];
for (int i = 0; i < crlVals.Count; ++i)
{
result[i] = CertificateList.GetInstance(crlVals[i].ToAsn1Object());
}
return result;
}
public BasicOcspResponse[] GetOcspVals()
{
BasicOcspResponse[] result = new BasicOcspResponse[ocspVals.Count];
for (int i = 0; i < ocspVals.Count; ++i)
{
result[i] = BasicOcspResponse.GetInstance(ocspVals[i].ToAsn1Object());
}
return result;
}
public OtherRevVals OtherRevVals
{
get { return otherRevVals; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
v.AddOptionalTagged(true, 0, crlVals);
v.AddOptionalTagged(true, 1, ocspVals);
if (otherRevVals != null)
{
v.Add(new DerTaggedObject(true, 2, otherRevVals.ToAsn1Object()));
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 55efe2f3e0343dd4386522217ef9cbe1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/// <remarks>
/// <code>
/// SigPolicyQualifierInfo ::= SEQUENCE {
/// sigPolicyQualifierId SigPolicyQualifierId,
/// sigQualifier ANY DEFINED BY sigPolicyQualifierId
/// }
///
/// SigPolicyQualifierId ::= OBJECT IDENTIFIER
/// </code>
/// </remarks>
public class SigPolicyQualifierInfo
: Asn1Encodable
{
private readonly DerObjectIdentifier sigPolicyQualifierId;
private readonly Asn1Object sigQualifier;
public static SigPolicyQualifierInfo GetInstance(
object obj)
{
if (obj == null || obj is SigPolicyQualifierInfo)
return (SigPolicyQualifierInfo) obj;
if (obj is Asn1Sequence)
return new SigPolicyQualifierInfo((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'SigPolicyQualifierInfo' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private SigPolicyQualifierInfo(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count != 2)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.sigPolicyQualifierId = (DerObjectIdentifier) seq[0].ToAsn1Object();
this.sigQualifier = seq[1].ToAsn1Object();
}
public SigPolicyQualifierInfo(
DerObjectIdentifier sigPolicyQualifierId,
Asn1Encodable sigQualifier)
{
this.sigPolicyQualifierId = sigPolicyQualifierId;
this.sigQualifier = sigQualifier.ToAsn1Object();
}
public DerObjectIdentifier SigPolicyQualifierId
{
get { return sigPolicyQualifierId; }
}
public Asn1Object SigQualifier
{
get { return sigQualifier; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(sigPolicyQualifierId, sigQualifier);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e7fe96c8be596134bac2ee02392ee9d1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,146 @@
#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.Esf
{
/// <remarks>
/// <code>
/// SignaturePolicyId ::= SEQUENCE {
/// sigPolicyIdentifier SigPolicyId,
/// sigPolicyHash SigPolicyHash,
/// sigPolicyQualifiers SEQUENCE SIZE (1..MAX) OF SigPolicyQualifierInfo OPTIONAL
/// }
///
/// SigPolicyId ::= OBJECT IDENTIFIER
///
/// SigPolicyHash ::= OtherHashAlgAndValue
/// </code>
/// </remarks>
public class SignaturePolicyId
: Asn1Encodable
{
private readonly DerObjectIdentifier sigPolicyIdentifier;
private readonly OtherHashAlgAndValue sigPolicyHash;
private readonly Asn1Sequence sigPolicyQualifiers;
public static SignaturePolicyId GetInstance(
object obj)
{
if (obj == null || obj is SignaturePolicyId)
return (SignaturePolicyId) obj;
if (obj is Asn1Sequence)
return new SignaturePolicyId((Asn1Sequence) obj);
throw new ArgumentException(
"Unknown object in 'SignaturePolicyId' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private SignaturePolicyId(
Asn1Sequence seq)
{
if (seq == null)
throw new ArgumentNullException("seq");
if (seq.Count < 2 || seq.Count > 3)
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
this.sigPolicyIdentifier = (DerObjectIdentifier) seq[0].ToAsn1Object();
this.sigPolicyHash = OtherHashAlgAndValue.GetInstance(seq[1].ToAsn1Object());
if (seq.Count > 2)
{
this.sigPolicyQualifiers = (Asn1Sequence) seq[2].ToAsn1Object();
}
}
public SignaturePolicyId(
DerObjectIdentifier sigPolicyIdentifier,
OtherHashAlgAndValue sigPolicyHash)
: this(sigPolicyIdentifier, sigPolicyHash, null)
{
}
public SignaturePolicyId(
DerObjectIdentifier sigPolicyIdentifier,
OtherHashAlgAndValue sigPolicyHash,
params SigPolicyQualifierInfo[] sigPolicyQualifiers)
{
if (sigPolicyIdentifier == null)
throw new ArgumentNullException("sigPolicyIdentifier");
if (sigPolicyHash == null)
throw new ArgumentNullException("sigPolicyHash");
this.sigPolicyIdentifier = sigPolicyIdentifier;
this.sigPolicyHash = sigPolicyHash;
if (sigPolicyQualifiers != null)
{
this.sigPolicyQualifiers = new DerSequence(sigPolicyQualifiers);
}
}
public SignaturePolicyId(
DerObjectIdentifier sigPolicyIdentifier,
OtherHashAlgAndValue sigPolicyHash,
IEnumerable<SigPolicyQualifierInfo> sigPolicyQualifiers)
{
if (sigPolicyIdentifier == null)
throw new ArgumentNullException("sigPolicyIdentifier");
if (sigPolicyHash == null)
throw new ArgumentNullException("sigPolicyHash");
this.sigPolicyIdentifier = sigPolicyIdentifier;
this.sigPolicyHash = sigPolicyHash;
if (sigPolicyQualifiers != null)
{
this.sigPolicyQualifiers = new DerSequence(
Asn1EncodableVector.FromEnumerable(sigPolicyQualifiers));
}
}
public DerObjectIdentifier SigPolicyIdentifier
{
get { return sigPolicyIdentifier; }
}
public OtherHashAlgAndValue SigPolicyHash
{
get { return sigPolicyHash; }
}
public SigPolicyQualifierInfo[] GetSigPolicyQualifiers()
{
if (sigPolicyQualifiers == null)
return null;
SigPolicyQualifierInfo[] infos = new SigPolicyQualifierInfo[sigPolicyQualifiers.Count];
for (int i = 0; i < sigPolicyQualifiers.Count; ++i)
{
infos[i] = SigPolicyQualifierInfo.GetInstance(sigPolicyQualifiers[i]);
}
return infos;
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(
sigPolicyIdentifier, sigPolicyHash.ToAsn1Object());
if (sigPolicyQualifiers != null)
{
v.Add(sigPolicyQualifiers.ToAsn1Object());
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 99be878f13c4b034aa698d274b195b84
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,70 @@
#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.Esf
{
/// <remarks>
/// <code>
/// SignaturePolicyIdentifier ::= CHOICE {
/// SignaturePolicyId SignaturePolicyId,
/// SignaturePolicyImplied SignaturePolicyImplied
/// }
///
/// SignaturePolicyImplied ::= NULL
/// </code>
/// </remarks>
public class SignaturePolicyIdentifier
: Asn1Encodable, IAsn1Choice
{
private readonly SignaturePolicyId sigPolicy;
public static SignaturePolicyIdentifier GetInstance(
object obj)
{
if (obj == null || obj is SignaturePolicyIdentifier)
return (SignaturePolicyIdentifier) obj;
if (obj is SignaturePolicyId)
return new SignaturePolicyIdentifier((SignaturePolicyId) obj);
if (obj is Asn1Null)
return new SignaturePolicyIdentifier();
throw new ArgumentException(
"Unknown object in 'SignaturePolicyIdentifier' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
public SignaturePolicyIdentifier()
{
this.sigPolicy = null;
}
public SignaturePolicyIdentifier(
SignaturePolicyId signaturePolicyId)
{
if (signaturePolicyId == null)
throw new ArgumentNullException("signaturePolicyId");
this.sigPolicy = signaturePolicyId;
}
public SignaturePolicyId SignaturePolicyId
{
get { return sigPolicy; }
}
public override Asn1Object ToAsn1Object()
{
return sigPolicy == null
? DerNull.Instance
: sigPolicy.ToAsn1Object();
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 38e7b593193c0d848ad9ea61b84ba7f4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
public class SignerAttribute
: Asn1Encodable
{
private Asn1Sequence claimedAttributes;
private AttributeCertificate certifiedAttributes;
public static SignerAttribute GetInstance(
object obj)
{
if (obj == null || obj is SignerAttribute)
return (SignerAttribute) obj;
if (obj is Asn1Sequence)
return new SignerAttribute(obj);
throw new ArgumentException(
"Unknown object in 'SignerAttribute' factory: "
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
"obj");
}
private SignerAttribute(
object obj)
{
Asn1Sequence seq = (Asn1Sequence) obj;
DerTaggedObject taggedObject = (DerTaggedObject) seq[0];
if (taggedObject.TagNo == 0)
{
claimedAttributes = Asn1Sequence.GetInstance(taggedObject, true);
}
else if (taggedObject.TagNo == 1)
{
certifiedAttributes = AttributeCertificate.GetInstance(taggedObject);
}
else
{
throw new ArgumentException("illegal tag.", "obj");
}
}
public SignerAttribute(
Asn1Sequence claimedAttributes)
{
this.claimedAttributes = claimedAttributes;
}
public SignerAttribute(
AttributeCertificate certifiedAttributes)
{
this.certifiedAttributes = certifiedAttributes;
}
public virtual Asn1Sequence ClaimedAttributes
{
get { return claimedAttributes; }
}
public virtual AttributeCertificate CertifiedAttributes
{
get { return certifiedAttributes; }
}
/**
*
* <pre>
* SignerAttribute ::= SEQUENCE OF CHOICE {
* claimedAttributes [0] ClaimedAttributes,
* certifiedAttributes [1] CertifiedAttributes }
*
* ClaimedAttributes ::= SEQUENCE OF Attribute
* CertifiedAttributes ::= AttributeCertificate -- as defined in RFC 3281: see clause 4.1.
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
if (claimedAttributes != null)
{
v.Add(new DerTaggedObject(0, claimedAttributes));
}
else
{
v.Add(new DerTaggedObject(1, certifiedAttributes));
}
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c6fd77b53c8c1a1408dae6fba217b087
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,146 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X500;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
{
/**
* Signer-Location attribute (RFC3126).
*
* <pre>
* SignerLocation ::= SEQUENCE {
* countryName [0] DirectoryString OPTIONAL,
* localityName [1] DirectoryString OPTIONAL,
* postalAddress [2] PostalAddress OPTIONAL }
*
* PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
* </pre>
*/
public class SignerLocation
: Asn1Encodable
{
private DirectoryString countryName;
private DirectoryString localityName;
private Asn1Sequence postalAddress;
public SignerLocation(Asn1Sequence seq)
{
foreach (Asn1TaggedObject obj in seq)
{
switch (obj.TagNo)
{
case 0:
this.countryName = DirectoryString.GetInstance(obj, true);
break;
case 1:
this.localityName = DirectoryString.GetInstance(obj, true);
break;
case 2:
bool isExplicit = obj.IsExplicit(); // handle erroneous implicitly tagged sequences
this.postalAddress = Asn1Sequence.GetInstance(obj, isExplicit);
if (postalAddress != null && postalAddress.Count > 6)
throw new ArgumentException("postal address must contain less than 6 strings");
break;
default:
throw new ArgumentException("illegal tag");
}
}
}
private SignerLocation(
DirectoryString countryName,
DirectoryString localityName,
Asn1Sequence postalAddress)
{
if (postalAddress != null && postalAddress.Count > 6)
throw new ArgumentException("postal address must contain less than 6 strings");
this.countryName = countryName;
this.localityName = localityName;
this.postalAddress = postalAddress;
}
public SignerLocation(
DirectoryString countryName,
DirectoryString localityName,
DirectoryString[] postalAddress)
: this(countryName, localityName, new DerSequence(postalAddress))
{
}
public SignerLocation(
DerUtf8String countryName,
DerUtf8String localityName,
Asn1Sequence postalAddress)
: this(DirectoryString.GetInstance(countryName), DirectoryString.GetInstance(localityName), postalAddress)
{
}
public static SignerLocation GetInstance(object obj)
{
if (obj == null || obj is SignerLocation)
return (SignerLocation) obj;
return new SignerLocation(Asn1Sequence.GetInstance(obj));
}
public DirectoryString Country
{
get { return countryName; }
}
public DirectoryString Locality
{
get { return localityName; }
}
public DirectoryString[] GetPostal()
{
if (postalAddress == null)
return null;
DirectoryString[] dirStrings = new DirectoryString[postalAddress.Count];
for (int i = 0; i != dirStrings.Length; i++)
{
dirStrings[i] = DirectoryString.GetInstance(postalAddress[i]);
}
return dirStrings;
}
public Asn1Sequence PostalAddress
{
get { return postalAddress; }
}
/**
* <pre>
* SignerLocation ::= SEQUENCE {
* countryName [0] DirectoryString OPTIONAL,
* localityName [1] DirectoryString OPTIONAL,
* postalAddress [2] PostalAddress OPTIONAL }
*
* PostalAddress ::= SEQUENCE SIZE(1..6) OF DirectoryString
*
* DirectoryString ::= CHOICE {
* teletexString TeletexString (SIZE (1..MAX)),
* printableString PrintableString (SIZE (1..MAX)),
* universalString UniversalString (SIZE (1..MAX)),
* utf8String UTF8String (SIZE (1.. MAX)),
* bmpString BMPString (SIZE (1..MAX)) }
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector();
v.AddOptionalTagged(true, 0, countryName);
v.AddOptionalTagged(true, 1, localityName);
v.AddOptionalTagged(true, 2, postalAddress);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 30313862107873a40bb9ba65d82dbcdd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: