add all
This commit is contained in:
92
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentHints.cs
vendored
Normal file
92
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentHints.cs
vendored
Normal 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.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ess
|
||||
{
|
||||
public class ContentHints
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerUtf8String contentDescription;
|
||||
private readonly DerObjectIdentifier contentType;
|
||||
|
||||
public static ContentHints GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is ContentHints)
|
||||
{
|
||||
return (ContentHints)o;
|
||||
}
|
||||
|
||||
if (o is Asn1Sequence)
|
||||
{
|
||||
return new ContentHints((Asn1Sequence)o);
|
||||
}
|
||||
|
||||
throw new ArgumentException("unknown object in 'ContentHints' factory : "
|
||||
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
private ContentHints(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
IAsn1Convertible field = seq[0];
|
||||
if (field.ToAsn1Object() is DerUtf8String)
|
||||
{
|
||||
contentDescription = DerUtf8String.GetInstance(field);
|
||||
contentType = DerObjectIdentifier.GetInstance(seq[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
contentType = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public ContentHints(
|
||||
DerObjectIdentifier contentType)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.contentDescription = null;
|
||||
}
|
||||
|
||||
public ContentHints(
|
||||
DerObjectIdentifier contentType,
|
||||
DerUtf8String contentDescription)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.contentDescription = contentDescription;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public DerUtf8String ContentDescription
|
||||
{
|
||||
get { return contentDescription; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* ContentHints ::= SEQUENCE {
|
||||
* contentDescription UTF8String (SIZE (1..MAX)) OPTIONAL,
|
||||
* contentType ContentType }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptional(contentDescription);
|
||||
v.Add(contentType);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentHints.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentHints.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e9433cbc49e0f2049b844cfe16f2e5a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
71
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentIdentifier.cs
vendored
Normal file
71
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentIdentifier.cs
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
#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.Ess
|
||||
{
|
||||
public class ContentIdentifier
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1OctetString value;
|
||||
|
||||
public static ContentIdentifier GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is ContentIdentifier)
|
||||
{
|
||||
return (ContentIdentifier) o;
|
||||
}
|
||||
|
||||
if (o is Asn1OctetString)
|
||||
{
|
||||
return new ContentIdentifier((Asn1OctetString) o);
|
||||
}
|
||||
|
||||
throw new ArgumentException(
|
||||
"unknown object in 'ContentIdentifier' factory : "
|
||||
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from OCTET STRING whose octets represent the identifier.
|
||||
*/
|
||||
public ContentIdentifier(
|
||||
Asn1OctetString value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create from byte array representing the identifier.
|
||||
*/
|
||||
public ContentIdentifier(
|
||||
byte[] value)
|
||||
: this(new DerOctetString(value))
|
||||
{
|
||||
}
|
||||
|
||||
public Asn1OctetString Value
|
||||
{
|
||||
get { return value; }
|
||||
}
|
||||
|
||||
/**
|
||||
* The definition of ContentIdentifier is
|
||||
* <pre>
|
||||
* ContentIdentifier ::= OCTET STRING
|
||||
* </pre>
|
||||
* id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1)
|
||||
* member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
|
||||
* smime(16) id-aa(2) 7 }
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentIdentifier.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ContentIdentifier.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d718fb70d08b26d4793c1a8b738d1cf7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertID.cs
vendored
Normal file
93
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertID.cs
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ess
|
||||
{
|
||||
public class EssCertID
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1OctetString certHash;
|
||||
private IssuerSerial issuerSerial;
|
||||
|
||||
public static EssCertID GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is EssCertID)
|
||||
{
|
||||
return (EssCertID) o;
|
||||
}
|
||||
|
||||
if (o is Asn1Sequence)
|
||||
{
|
||||
return new EssCertID((Asn1Sequence) o);
|
||||
}
|
||||
|
||||
throw new ArgumentException(
|
||||
"unknown object in 'EssCertID' factory : "
|
||||
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
public EssCertID(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
this.certHash = Asn1OctetString.GetInstance(seq[0]);
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
issuerSerial = IssuerSerial.GetInstance(seq[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public EssCertID(
|
||||
byte[] hash)
|
||||
{
|
||||
certHash = new DerOctetString(hash);
|
||||
}
|
||||
|
||||
public EssCertID(
|
||||
byte[] hash,
|
||||
IssuerSerial issuerSerial)
|
||||
{
|
||||
this.certHash = new DerOctetString(hash);
|
||||
this.issuerSerial = issuerSerial;
|
||||
}
|
||||
|
||||
public byte[] GetCertHash()
|
||||
{
|
||||
return certHash.GetOctets();
|
||||
}
|
||||
|
||||
public IssuerSerial IssuerSerial
|
||||
{
|
||||
get { return issuerSerial; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* EssCertID ::= SEQUENCE {
|
||||
* certHash Hash,
|
||||
* issuerSerial IssuerSerial OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(certHash);
|
||||
v.AddOptional(issuerSerial);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertID.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertID.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d12b9037daa67e4a850a9f040b538dc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
145
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertIDv2.cs
vendored
Normal file
145
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertIDv2.cs
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ess
|
||||
{
|
||||
public class EssCertIDv2
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly AlgorithmIdentifier hashAlgorithm;
|
||||
private readonly byte[] certHash;
|
||||
private readonly IssuerSerial issuerSerial;
|
||||
|
||||
private static readonly AlgorithmIdentifier DefaultAlgID = new AlgorithmIdentifier(
|
||||
NistObjectIdentifiers.IdSha256);
|
||||
|
||||
public static EssCertIDv2 GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
EssCertIDv2 existing = obj as EssCertIDv2;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new EssCertIDv2(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private EssCertIDv2(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count > 3)
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
|
||||
|
||||
int count = 0;
|
||||
|
||||
if (seq[0] is Asn1OctetString)
|
||||
{
|
||||
// Default value
|
||||
this.hashAlgorithm = DefaultAlgID;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hashAlgorithm = AlgorithmIdentifier.GetInstance(seq[count++].ToAsn1Object());
|
||||
}
|
||||
|
||||
this.certHash = Asn1OctetString.GetInstance(seq[count++].ToAsn1Object()).GetOctets();
|
||||
|
||||
if (seq.Count > count)
|
||||
{
|
||||
this.issuerSerial = IssuerSerial.GetInstance(
|
||||
Asn1Sequence.GetInstance(seq[count].ToAsn1Object()));
|
||||
}
|
||||
}
|
||||
|
||||
public EssCertIDv2(byte[] certHash)
|
||||
: this(null, certHash, null)
|
||||
{
|
||||
}
|
||||
|
||||
public EssCertIDv2(
|
||||
AlgorithmIdentifier algId,
|
||||
byte[] certHash)
|
||||
: this(algId, certHash, null)
|
||||
{
|
||||
}
|
||||
|
||||
public EssCertIDv2(
|
||||
byte[] certHash,
|
||||
IssuerSerial issuerSerial)
|
||||
: this(null, certHash, issuerSerial)
|
||||
{
|
||||
}
|
||||
|
||||
public EssCertIDv2(
|
||||
AlgorithmIdentifier algId,
|
||||
byte[] certHash,
|
||||
IssuerSerial issuerSerial)
|
||||
{
|
||||
if (algId == null)
|
||||
{
|
||||
// Default value
|
||||
this.hashAlgorithm = DefaultAlgID;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.hashAlgorithm = algId;
|
||||
}
|
||||
|
||||
this.certHash = certHash;
|
||||
this.issuerSerial = issuerSerial;
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier HashAlgorithm
|
||||
{
|
||||
get { return this.hashAlgorithm; }
|
||||
}
|
||||
|
||||
public byte[] GetCertHash()
|
||||
{
|
||||
return Arrays.Clone(certHash);
|
||||
}
|
||||
|
||||
public IssuerSerial IssuerSerial
|
||||
{
|
||||
get { return issuerSerial; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* EssCertIDv2 ::= SEQUENCE {
|
||||
* hashAlgorithm AlgorithmIdentifier
|
||||
* DEFAULT {algorithm id-sha256},
|
||||
* certHash Hash,
|
||||
* issuerSerial IssuerSerial OPTIONAL
|
||||
* }
|
||||
*
|
||||
* Hash ::= OCTET STRING
|
||||
*
|
||||
* IssuerSerial ::= SEQUENCE {
|
||||
* issuer GeneralNames,
|
||||
* serialNumber CertificateSerialNumber
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
if (!hashAlgorithm.Equals(DefaultAlgID))
|
||||
{
|
||||
v.Add(hashAlgorithm);
|
||||
}
|
||||
|
||||
v.Add(new DerOctetString(certHash).ToAsn1Object());
|
||||
v.AddOptional(issuerSerial);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertIDv2.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/ESSCertIDv2.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa48900c0800a3546920b01edb65a5b1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
108
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificate.cs
vendored
Normal file
108
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificate.cs
vendored
Normal file
@@ -0,0 +1,108 @@
|
||||
#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.Ess
|
||||
{
|
||||
public class SigningCertificate
|
||||
: Asn1Encodable
|
||||
{
|
||||
private Asn1Sequence certs, policies;
|
||||
|
||||
public static SigningCertificate GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is SigningCertificate)
|
||||
{
|
||||
return (SigningCertificate) o;
|
||||
}
|
||||
|
||||
if (o is Asn1Sequence)
|
||||
{
|
||||
return new SigningCertificate((Asn1Sequence) o);
|
||||
}
|
||||
|
||||
throw new ArgumentException(
|
||||
"unknown object in 'SigningCertificate' factory : "
|
||||
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
|
||||
}
|
||||
|
||||
/**
|
||||
* constructors
|
||||
*/
|
||||
public SigningCertificate(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 1 || seq.Count > 2)
|
||||
{
|
||||
throw new ArgumentException("Bad sequence size: " + seq.Count);
|
||||
}
|
||||
|
||||
this.certs = Asn1Sequence.GetInstance(seq[0]);
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
this.policies = Asn1Sequence.GetInstance(seq[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public SigningCertificate(
|
||||
EssCertID essCertID)
|
||||
{
|
||||
certs = new DerSequence(essCertID);
|
||||
}
|
||||
|
||||
public EssCertID[] GetCerts()
|
||||
{
|
||||
EssCertID[] cs = new EssCertID[certs.Count];
|
||||
|
||||
for (int i = 0; i != certs.Count; i++)
|
||||
{
|
||||
cs[i] = EssCertID.GetInstance(certs[i]);
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
/**
|
||||
* The definition of SigningCertificate is
|
||||
* <pre>
|
||||
* SigningCertificate ::= SEQUENCE {
|
||||
* certs SEQUENCE OF EssCertID,
|
||||
* policies SEQUENCE OF PolicyInformation OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
* id-aa-signingCertificate OBJECT IDENTIFIER ::= { iso(1)
|
||||
* member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
|
||||
* smime(16) id-aa(2) 12 }
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(certs);
|
||||
v.AddOptional(policies);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificate.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificate.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e70e8e77c86e9cf47bf645362e801f88
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
112
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificateV2.cs
vendored
Normal file
112
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/ess/SigningCertificateV2.cs
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
#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.Ess
|
||||
{
|
||||
public class SigningCertificateV2
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1Sequence certs;
|
||||
private readonly Asn1Sequence policies;
|
||||
|
||||
public static SigningCertificateV2 GetInstance(
|
||||
object o)
|
||||
{
|
||||
if (o == null || o is SigningCertificateV2)
|
||||
return (SigningCertificateV2) o;
|
||||
|
||||
if (o is Asn1Sequence)
|
||||
return new SigningCertificateV2((Asn1Sequence) o);
|
||||
|
||||
throw new ArgumentException(
|
||||
"unknown object in 'SigningCertificateV2' factory : "
|
||||
+ Org.BouncyCastle.Utilities.Platform.GetTypeName(o) + ".");
|
||||
}
|
||||
|
||||
private SigningCertificateV2(
|
||||
Asn1Sequence 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 SigningCertificateV2(
|
||||
EssCertIDv2 cert)
|
||||
{
|
||||
this.certs = new DerSequence(cert);
|
||||
}
|
||||
|
||||
public SigningCertificateV2(
|
||||
EssCertIDv2[] certs)
|
||||
{
|
||||
this.certs = new DerSequence(certs);
|
||||
}
|
||||
|
||||
public SigningCertificateV2(
|
||||
EssCertIDv2[] certs,
|
||||
PolicyInformation[] policies)
|
||||
{
|
||||
this.certs = new DerSequence(certs);
|
||||
|
||||
if (policies != null)
|
||||
{
|
||||
this.policies = new DerSequence(policies);
|
||||
}
|
||||
}
|
||||
|
||||
public EssCertIDv2[] GetCerts()
|
||||
{
|
||||
EssCertIDv2[] certIds = new EssCertIDv2[certs.Count];
|
||||
for (int i = 0; i != certs.Count; i++)
|
||||
{
|
||||
certIds[i] = EssCertIDv2.GetInstance(certs[i]);
|
||||
}
|
||||
return certIds;
|
||||
}
|
||||
|
||||
public PolicyInformation[] GetPolicies()
|
||||
{
|
||||
if (policies == null)
|
||||
return null;
|
||||
|
||||
PolicyInformation[] policyInformations = new PolicyInformation[policies.Count];
|
||||
for (int i = 0; i != policies.Count; i++)
|
||||
{
|
||||
policyInformations[i] = PolicyInformation.GetInstance(policies[i]);
|
||||
}
|
||||
return policyInformations;
|
||||
}
|
||||
|
||||
/**
|
||||
* The definition of SigningCertificateV2 is
|
||||
* <pre>
|
||||
* SigningCertificateV2 ::= SEQUENCE {
|
||||
* certs SEQUENCE OF EssCertIDv2,
|
||||
* policies SEQUENCE OF PolicyInformation OPTIONAL
|
||||
* }
|
||||
* </pre>
|
||||
* id-aa-signingCertificateV2 OBJECT IDENTIFIER ::= { iso(1)
|
||||
* member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
|
||||
* smime(16) id-aa(2) 47 }
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(certs);
|
||||
v.AddOptional(policies);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06783a2331c183e42a9ebe87154438a5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user