add all
This commit is contained in:
83
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Attribute.cs
vendored
Normal file
83
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Attribute.cs
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class AttributePkcs
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier attrType;
|
||||
private readonly Asn1Set attrValues;
|
||||
|
||||
/**
|
||||
* return an Attribute object from the given object.
|
||||
*
|
||||
* @param o the object we want converted.
|
||||
* @exception ArgumentException if the object cannot be converted.
|
||||
*/
|
||||
public static AttributePkcs GetInstance(
|
||||
object obj)
|
||||
{
|
||||
AttributePkcs attr = obj as AttributePkcs;
|
||||
if (obj == null || attr != null)
|
||||
{
|
||||
return attr;
|
||||
}
|
||||
|
||||
Asn1Sequence seq = obj as Asn1Sequence;
|
||||
if (seq != null)
|
||||
{
|
||||
return new AttributePkcs(seq);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private AttributePkcs(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
attrType = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
attrValues = Asn1Set.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public AttributePkcs(
|
||||
DerObjectIdentifier attrType,
|
||||
Asn1Set attrValues)
|
||||
{
|
||||
this.attrType = attrType;
|
||||
this.attrValues = attrValues;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier AttrType
|
||||
{
|
||||
get { return attrType; }
|
||||
}
|
||||
|
||||
public Asn1Set AttrValues
|
||||
{
|
||||
get { return attrValues; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* Attr ::= Sequence {
|
||||
* attrType OBJECT IDENTIFIER,
|
||||
* attrValues Set OF AttributeValue
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(attrType, attrValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Attribute.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Attribute.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d268672e1497ee448ce1eb3dcb4e877
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class AuthenticatedSafe
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static ContentInfo[] Copy(ContentInfo[] info)
|
||||
{
|
||||
return (ContentInfo[])info.Clone();
|
||||
}
|
||||
|
||||
public static AuthenticatedSafe GetInstance(object obj)
|
||||
{
|
||||
if (obj is AuthenticatedSafe)
|
||||
return (AuthenticatedSafe)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new AuthenticatedSafe(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private readonly ContentInfo[] info;
|
||||
private readonly bool isBer;
|
||||
|
||||
private AuthenticatedSafe(Asn1Sequence seq)
|
||||
{
|
||||
info = new ContentInfo[seq.Count];
|
||||
|
||||
for (int i = 0; i != info.Length; i++)
|
||||
{
|
||||
info[i] = ContentInfo.GetInstance(seq[i]);
|
||||
}
|
||||
|
||||
isBer = seq is BerSequence;
|
||||
}
|
||||
|
||||
public AuthenticatedSafe(
|
||||
ContentInfo[] info)
|
||||
{
|
||||
this.info = Copy(info);
|
||||
this.isBer = true;
|
||||
}
|
||||
|
||||
public ContentInfo[] GetContentInfo()
|
||||
{
|
||||
return Copy(info);
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
if (isBer)
|
||||
{
|
||||
return new BerSequence(info);
|
||||
}
|
||||
|
||||
// TODO bc-java uses DL sequence
|
||||
//return new DLSequence(info);
|
||||
return new DerSequence(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/AuthenticatedSafe.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9fb6dd81e8425c14990ae72a959720c7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
56
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertBag.cs
vendored
Normal file
56
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertBag.cs
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class CertBag
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static CertBag GetInstance(object obj)
|
||||
{
|
||||
if (obj is CertBag)
|
||||
return (CertBag)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new CertBag(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private readonly DerObjectIdentifier certID;
|
||||
private readonly Asn1Object certValue;
|
||||
|
||||
private CertBag(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
this.certID = DerObjectIdentifier.GetInstance(seq[0]);
|
||||
this.certValue = Asn1TaggedObject.GetInstance(seq[1]).GetObject();
|
||||
}
|
||||
|
||||
public CertBag(
|
||||
DerObjectIdentifier certID,
|
||||
Asn1Object certValue)
|
||||
{
|
||||
this.certID = certID;
|
||||
this.certValue = certValue;
|
||||
}
|
||||
|
||||
public virtual DerObjectIdentifier CertID
|
||||
{
|
||||
get { return certID; }
|
||||
}
|
||||
|
||||
public virtual Asn1Object CertValue
|
||||
{
|
||||
get { return certValue; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(certID, new DerTaggedObject(0, certValue));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertBag.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertBag.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b1219cc2eca6ed408abf4ec1ddc9385
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
87
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertificationRequest.cs
vendored
Normal file
87
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertificationRequest.cs
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* Pkcs10 Certfication request object.
|
||||
* <pre>
|
||||
* CertificationRequest ::= Sequence {
|
||||
* certificationRequestInfo CertificationRequestInfo,
|
||||
* signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }},
|
||||
* signature BIT STRING
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class CertificationRequest
|
||||
: Asn1Encodable
|
||||
{
|
||||
protected CertificationRequestInfo reqInfo;
|
||||
protected AlgorithmIdentifier sigAlgId;
|
||||
protected DerBitString sigBits;
|
||||
|
||||
public static CertificationRequest GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
if (obj is CertificationRequest)
|
||||
return (CertificationRequest)obj;
|
||||
return new CertificationRequest(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
protected CertificationRequest()
|
||||
{
|
||||
}
|
||||
|
||||
public CertificationRequest(
|
||||
CertificationRequestInfo requestInfo,
|
||||
AlgorithmIdentifier algorithm,
|
||||
DerBitString signature)
|
||||
{
|
||||
this.reqInfo = requestInfo;
|
||||
this.sigAlgId = algorithm;
|
||||
this.sigBits = signature;
|
||||
}
|
||||
|
||||
internal CertificationRequest(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 3)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
reqInfo = CertificationRequestInfo.GetInstance(seq[0]);
|
||||
sigAlgId = AlgorithmIdentifier.GetInstance(seq[1]);
|
||||
sigBits = DerBitString.GetInstance(seq[2]);
|
||||
}
|
||||
|
||||
public CertificationRequestInfo GetCertificationRequestInfo()
|
||||
{
|
||||
return reqInfo;
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier SignatureAlgorithm
|
||||
{
|
||||
get { return sigAlgId; }
|
||||
}
|
||||
|
||||
public DerBitString Signature
|
||||
{
|
||||
get { return sigBits; }
|
||||
}
|
||||
|
||||
public byte[] GetSignatureOctets()
|
||||
{
|
||||
return sigBits.GetOctets();
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(reqInfo, sigAlgId, sigBits);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec57ebecbac0c3c49a399591def4ab9c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
135
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertificationRequestInfo.cs
vendored
Normal file
135
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/CertificationRequestInfo.cs
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* Pkcs10 CertificationRequestInfo object.
|
||||
* <pre>
|
||||
* CertificationRequestInfo ::= Sequence {
|
||||
* version Integer { v1(0) } (v1,...),
|
||||
* subject Name,
|
||||
* subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
|
||||
* attributes [0] Attributes{{ CRIAttributes }}
|
||||
* }
|
||||
*
|
||||
* Attributes { ATTRIBUTE:IOSet } ::= Set OF Attr{{ IOSet }}
|
||||
*
|
||||
* Attr { ATTRIBUTE:IOSet } ::= Sequence {
|
||||
* type ATTRIBUTE.&id({IOSet}),
|
||||
* values Set SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public class CertificationRequestInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal DerInteger version = new DerInteger(0);
|
||||
internal X509Name subject;
|
||||
internal SubjectPublicKeyInfo subjectPKInfo;
|
||||
internal Asn1Set attributes;
|
||||
|
||||
public static CertificationRequestInfo GetInstance(object obj)
|
||||
{
|
||||
if (obj is CertificationRequestInfo)
|
||||
return (CertificationRequestInfo)obj;
|
||||
if (obj != null)
|
||||
return new CertificationRequestInfo(Asn1Sequence.GetInstance(obj));
|
||||
return null;
|
||||
}
|
||||
|
||||
public CertificationRequestInfo(
|
||||
X509Name subject,
|
||||
SubjectPublicKeyInfo pkInfo,
|
||||
Asn1Set attributes)
|
||||
{
|
||||
this.subject = subject;
|
||||
this.subjectPKInfo = pkInfo;
|
||||
this.attributes = attributes;
|
||||
|
||||
ValidateAttributes(attributes);
|
||||
|
||||
if (subject == null || version == null || subjectPKInfo == null)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Not all mandatory fields set in CertificationRequestInfo generator.");
|
||||
}
|
||||
}
|
||||
|
||||
private CertificationRequestInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
version = (DerInteger) seq[0];
|
||||
|
||||
subject = X509Name.GetInstance(seq[1]);
|
||||
subjectPKInfo = SubjectPublicKeyInfo.GetInstance(seq[2]);
|
||||
|
||||
//
|
||||
// some CertificationRequestInfo objects seem to treat this field
|
||||
// as optional.
|
||||
//
|
||||
if (seq.Count > 3)
|
||||
{
|
||||
DerTaggedObject tagobj = (DerTaggedObject) seq[3];
|
||||
attributes = Asn1Set.GetInstance(tagobj, false);
|
||||
}
|
||||
|
||||
ValidateAttributes(attributes);
|
||||
|
||||
if (subject == null || version == null || subjectPKInfo == null)
|
||||
{
|
||||
throw new ArgumentException(
|
||||
"Not all mandatory fields set in CertificationRequestInfo generator.");
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public X509Name Subject
|
||||
{
|
||||
get { return subject; }
|
||||
}
|
||||
|
||||
public SubjectPublicKeyInfo SubjectPublicKeyInfo
|
||||
{
|
||||
get { return subjectPKInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set Attributes
|
||||
{
|
||||
get { return attributes; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, subject, subjectPKInfo);
|
||||
v.AddOptionalTagged(false, 0, attributes);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
|
||||
private static void ValidateAttributes(Asn1Set attributes)
|
||||
{
|
||||
if (attributes == null)
|
||||
return;
|
||||
|
||||
foreach (Asn1Encodable ae in attributes)
|
||||
{
|
||||
Asn1Object obj = ae.ToAsn1Object();
|
||||
AttributePkcs attr = AttributePkcs.GetInstance(obj);
|
||||
if (attr.AttrType.Equals(PkcsObjectIdentifiers.Pkcs9AtChallengePassword))
|
||||
{
|
||||
if (attr.AttrValues.Count != 1)
|
||||
throw new ArgumentException("challengePassword attribute must have one value");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39d9369d046e0624fb04640d2e352bfc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
75
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/ContentInfo.cs
vendored
Normal file
75
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/ContentInfo.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.Pkcs
|
||||
{
|
||||
public class ContentInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerObjectIdentifier contentType;
|
||||
private readonly Asn1Encodable content;
|
||||
|
||||
public static ContentInfo GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
ContentInfo existing = obj as ContentInfo;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new ContentInfo(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private ContentInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
contentType = (DerObjectIdentifier) seq[0];
|
||||
|
||||
if (seq.Count > 1)
|
||||
{
|
||||
content = ((Asn1TaggedObject) seq[1]).GetObject();
|
||||
}
|
||||
}
|
||||
|
||||
public ContentInfo(
|
||||
DerObjectIdentifier contentType,
|
||||
Asn1Encodable content)
|
||||
{
|
||||
this.contentType = contentType;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return contentType; }
|
||||
}
|
||||
|
||||
public Asn1Encodable Content
|
||||
{
|
||||
get { return content; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* ContentInfo ::= Sequence {
|
||||
* contentType ContentType,
|
||||
* content
|
||||
* [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(contentType);
|
||||
|
||||
if (content != null)
|
||||
{
|
||||
v.Add(new BerTaggedObject(0, content));
|
||||
}
|
||||
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/ContentInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/ContentInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6ef23aeb3896d664f84c2b3ea17ab39a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/DHParameter.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/DHParameter.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class DHParameter
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal DerInteger p, g, l;
|
||||
|
||||
public DHParameter(
|
||||
BigInteger p,
|
||||
BigInteger g,
|
||||
int l)
|
||||
{
|
||||
this.p = new DerInteger(p);
|
||||
this.g = new DerInteger(g);
|
||||
|
||||
if (l != 0)
|
||||
{
|
||||
this.l = new DerInteger(l);
|
||||
}
|
||||
}
|
||||
|
||||
public DHParameter(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
e.MoveNext();
|
||||
p = (DerInteger)e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
g = (DerInteger)e.Current;
|
||||
|
||||
if (e.MoveNext())
|
||||
{
|
||||
l = (DerInteger) e.Current;
|
||||
}
|
||||
}
|
||||
|
||||
public BigInteger P
|
||||
{
|
||||
get { return p.PositiveValue; }
|
||||
}
|
||||
|
||||
public BigInteger G
|
||||
{
|
||||
get { return g.PositiveValue; }
|
||||
}
|
||||
|
||||
public BigInteger L
|
||||
{
|
||||
get { return l == null ? null : l.PositiveValue; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(p, g);
|
||||
v.AddOptional(l);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/DHParameter.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/DHParameter.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e7a5d221997748c4bb607ccbaea8617a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
107
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptedData.cs
vendored
Normal file
107
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptedData.cs
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
/**
|
||||
* The EncryptedData object.
|
||||
* <pre>
|
||||
* EncryptedData ::= Sequence {
|
||||
* version Version,
|
||||
* encryptedContentInfo EncryptedContentInfo
|
||||
* }
|
||||
*
|
||||
*
|
||||
* EncryptedContentInfo ::= Sequence {
|
||||
* contentType ContentType,
|
||||
* contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
|
||||
* encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
|
||||
* }
|
||||
*
|
||||
* EncryptedContent ::= OCTET STRING
|
||||
* </pre>
|
||||
*/
|
||||
public class EncryptedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1Sequence data;
|
||||
// private readonly DerObjectIdentifier bagId;
|
||||
// private readonly Asn1Object bagValue;
|
||||
|
||||
public static EncryptedData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is EncryptedData)
|
||||
{
|
||||
return (EncryptedData) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new EncryptedData((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private EncryptedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
DerInteger version = (DerInteger)seq[0];
|
||||
if (!version.HasValue(0))
|
||||
throw new ArgumentException("sequence not version 0");
|
||||
|
||||
this.data = (Asn1Sequence) seq[1];
|
||||
}
|
||||
|
||||
public EncryptedData(
|
||||
DerObjectIdentifier contentType,
|
||||
AlgorithmIdentifier encryptionAlgorithm,
|
||||
Asn1Encodable content)
|
||||
{
|
||||
data = new BerSequence(
|
||||
contentType,
|
||||
encryptionAlgorithm.ToAsn1Object(),
|
||||
new BerTaggedObject(false, 0, content));
|
||||
}
|
||||
|
||||
public DerObjectIdentifier ContentType
|
||||
{
|
||||
get { return (DerObjectIdentifier) data[0]; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier EncryptionAlgorithm
|
||||
{
|
||||
get { return AlgorithmIdentifier.GetInstance(data[1]); }
|
||||
}
|
||||
|
||||
public Asn1OctetString Content
|
||||
{
|
||||
get
|
||||
{
|
||||
if (data.Count == 3)
|
||||
{
|
||||
DerTaggedObject o = (DerTaggedObject) data[2];
|
||||
|
||||
return Asn1OctetString.GetInstance(o, false);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new BerSequence(new DerInteger(0), data);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a61974c3c96b5343916f5ae4fda77c4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,79 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class EncryptedPrivateKeyInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly AlgorithmIdentifier algId;
|
||||
private readonly Asn1OctetString data;
|
||||
|
||||
private EncryptedPrivateKeyInfo(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
algId = AlgorithmIdentifier.GetInstance(seq[0]);
|
||||
data = Asn1OctetString.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public EncryptedPrivateKeyInfo(
|
||||
AlgorithmIdentifier algId,
|
||||
byte[] encoding)
|
||||
{
|
||||
this.algId = algId;
|
||||
this.data = new DerOctetString(encoding);
|
||||
}
|
||||
|
||||
public static EncryptedPrivateKeyInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is EncryptedPrivateKeyInfo)
|
||||
{
|
||||
return (EncryptedPrivateKeyInfo) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence seq)
|
||||
return new EncryptedPrivateKeyInfo(seq);
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier EncryptionAlgorithm
|
||||
{
|
||||
get { return algId; }
|
||||
}
|
||||
|
||||
public byte[] GetEncryptedData()
|
||||
{
|
||||
return data.GetOctets();
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* EncryptedPrivateKeyInfo ::= Sequence {
|
||||
* encryptionAlgorithm AlgorithmIdentifier {{KeyEncryptionAlgorithms}},
|
||||
* encryptedData EncryptedData
|
||||
* }
|
||||
*
|
||||
* EncryptedData ::= OCTET STRING
|
||||
*
|
||||
* KeyEncryptionAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* ... -- For local profiles
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(algId, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cabd96d4b4fb45e4a9477ae611e12485
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
59
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptionScheme.cs
vendored
Normal file
59
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptionScheme.cs
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class EncryptionScheme
|
||||
: AlgorithmIdentifier
|
||||
{
|
||||
public EncryptionScheme(
|
||||
DerObjectIdentifier objectID)
|
||||
: base(objectID)
|
||||
{
|
||||
}
|
||||
|
||||
public EncryptionScheme(
|
||||
DerObjectIdentifier objectID,
|
||||
Asn1Encodable parameters)
|
||||
: base(objectID, parameters)
|
||||
{
|
||||
}
|
||||
|
||||
internal EncryptionScheme(
|
||||
Asn1Sequence seq)
|
||||
: this((DerObjectIdentifier)seq[0], seq[1])
|
||||
{
|
||||
}
|
||||
|
||||
public new static EncryptionScheme GetInstance(object obj)
|
||||
{
|
||||
if (obj is EncryptionScheme)
|
||||
{
|
||||
return (EncryptionScheme)obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new EncryptionScheme((Asn1Sequence)obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public Asn1Object Asn1Object
|
||||
{
|
||||
get { return Parameters.ToAsn1Object(); }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(Algorithm, Parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptionScheme.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/EncryptionScheme.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 11049dd1b7d45a04ea99a06552561c31
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
76
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/IssuerAndSerialNumber.cs
vendored
Normal file
76
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/IssuerAndSerialNumber.cs
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class IssuerAndSerialNumber
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly X509Name name;
|
||||
private readonly DerInteger certSerialNumber;
|
||||
|
||||
public static IssuerAndSerialNumber GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is IssuerAndSerialNumber)
|
||||
{
|
||||
return (IssuerAndSerialNumber) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new IssuerAndSerialNumber((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private IssuerAndSerialNumber(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
this.name = X509Name.GetInstance(seq[0]);
|
||||
this.certSerialNumber = DerInteger.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber(
|
||||
X509Name name,
|
||||
BigInteger certSerialNumber)
|
||||
{
|
||||
this.name = name;
|
||||
this.certSerialNumber = new DerInteger(certSerialNumber);
|
||||
}
|
||||
|
||||
public IssuerAndSerialNumber(
|
||||
X509Name name,
|
||||
DerInteger certSerialNumber)
|
||||
{
|
||||
this.name = name;
|
||||
this.certSerialNumber = certSerialNumber;
|
||||
}
|
||||
|
||||
public X509Name Name
|
||||
{
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public DerInteger CertificateSerialNumber
|
||||
{
|
||||
get { return certSerialNumber; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(name, certSerialNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b4832801ca7151458986f5012c2e8e6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
25
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/KeyDerivationFunc.cs
vendored
Normal file
25
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/KeyDerivationFunc.cs
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class KeyDerivationFunc
|
||||
: AlgorithmIdentifier
|
||||
{
|
||||
internal KeyDerivationFunc(Asn1Sequence seq)
|
||||
: base(seq)
|
||||
{
|
||||
}
|
||||
|
||||
public KeyDerivationFunc(
|
||||
DerObjectIdentifier id,
|
||||
Asn1Encodable parameters)
|
||||
: base(id, parameters)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/KeyDerivationFunc.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/KeyDerivationFunc.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f43d3668186ac844cbfdd49c34abbfbd
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
100
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/MacData.cs
vendored
Normal file
100
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/MacData.cs
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class MacData
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal DigestInfo digInfo;
|
||||
internal byte[] salt;
|
||||
internal BigInteger iterationCount;
|
||||
|
||||
public static MacData GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is MacData)
|
||||
{
|
||||
return (MacData) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new MacData((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private MacData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
this.digInfo = DigestInfo.GetInstance(seq[0]);
|
||||
this.salt = ((Asn1OctetString) seq[1]).GetOctets();
|
||||
|
||||
if (seq.Count == 3)
|
||||
{
|
||||
this.iterationCount = ((DerInteger) seq[2]).Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.iterationCount = BigInteger.One;
|
||||
}
|
||||
}
|
||||
|
||||
public MacData(
|
||||
DigestInfo digInfo,
|
||||
byte[] salt,
|
||||
int iterationCount)
|
||||
{
|
||||
this.digInfo = digInfo;
|
||||
this.salt = (byte[]) salt.Clone();
|
||||
this.iterationCount = BigInteger.ValueOf(iterationCount);
|
||||
}
|
||||
|
||||
public DigestInfo Mac
|
||||
{
|
||||
get { return digInfo; }
|
||||
}
|
||||
|
||||
public byte[] GetSalt()
|
||||
{
|
||||
return (byte[]) salt.Clone();
|
||||
}
|
||||
|
||||
public BigInteger IterationCount
|
||||
{
|
||||
get { return iterationCount; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* MacData ::= SEQUENCE {
|
||||
* mac DigestInfo,
|
||||
* macSalt OCTET STRING,
|
||||
* iterations INTEGER DEFAULT 1
|
||||
* -- Note: The default is for historic reasons and its use is deprecated. A
|
||||
* -- higher value, like 1024 is recommended.
|
||||
* </pre>
|
||||
* @return the basic DERObject construction.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(digInfo, new DerOctetString(salt));
|
||||
|
||||
if (!iterationCount.Equals(BigInteger.One))
|
||||
{
|
||||
v.Add(new DerInteger(iterationCount));
|
||||
}
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/MacData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/MacData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32c8c807cc496de4e9d6ca0bf91adc71
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBEParameter.cs
vendored
Normal file
63
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBEParameter.cs
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class PbeParameter
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly Asn1OctetString salt;
|
||||
private readonly DerInteger iterationCount;
|
||||
|
||||
public static PbeParameter GetInstance(object obj)
|
||||
{
|
||||
if (obj is PbeParameter || obj == null)
|
||||
{
|
||||
return (PbeParameter) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new PbeParameter((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
private PbeParameter(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
salt = Asn1OctetString.GetInstance(seq[0]);
|
||||
iterationCount = DerInteger.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public PbeParameter(byte[] salt, int iterationCount)
|
||||
{
|
||||
this.salt = new DerOctetString(salt);
|
||||
this.iterationCount = new DerInteger(iterationCount);
|
||||
}
|
||||
|
||||
public byte[] GetSalt()
|
||||
{
|
||||
return salt.GetOctets();
|
||||
}
|
||||
|
||||
public BigInteger IterationCount
|
||||
{
|
||||
get { return iterationCount.Value; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(salt, iterationCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBEParameter.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBEParameter.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e94bc4f5aa52ba241b77cf94c5b2e875
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBES2Parameters.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBES2Parameters.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class PbeS2Parameters
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly KeyDerivationFunc func;
|
||||
private readonly EncryptionScheme scheme;
|
||||
|
||||
public static PbeS2Parameters GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
PbeS2Parameters existing = obj as PbeS2Parameters;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new PbeS2Parameters(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public PbeS2Parameters(KeyDerivationFunc keyDevFunc, EncryptionScheme encScheme)
|
||||
{
|
||||
this.func = keyDevFunc;
|
||||
this.scheme = encScheme;
|
||||
}
|
||||
|
||||
private PbeS2Parameters(Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
Asn1Sequence funcSeq = (Asn1Sequence)seq[0].ToAsn1Object();
|
||||
|
||||
// TODO Not sure if this special case is really necessary/appropriate
|
||||
if (funcSeq[0].Equals(PkcsObjectIdentifiers.IdPbkdf2))
|
||||
{
|
||||
func = new KeyDerivationFunc(PkcsObjectIdentifiers.IdPbkdf2,
|
||||
Pbkdf2Params.GetInstance(funcSeq[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
func = new KeyDerivationFunc(funcSeq);
|
||||
}
|
||||
|
||||
scheme = EncryptionScheme.GetInstance(seq[1].ToAsn1Object());
|
||||
}
|
||||
|
||||
public KeyDerivationFunc KeyDerivationFunc
|
||||
{
|
||||
get { return func; }
|
||||
}
|
||||
|
||||
public EncryptionScheme EncryptionScheme
|
||||
{
|
||||
get { return scheme; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(func, scheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBES2Parameters.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBES2Parameters.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38bf767c1b3addb40b6d4e0993b124f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
144
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBKDF2Params.cs
vendored
Normal file
144
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBKDF2Params.cs
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class Pbkdf2Params
|
||||
: Asn1Encodable
|
||||
{
|
||||
private static AlgorithmIdentifier algid_hmacWithSHA1 = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdHmacWithSha1, DerNull.Instance);
|
||||
|
||||
private readonly Asn1OctetString octStr;
|
||||
private readonly DerInteger iterationCount, keyLength;
|
||||
private readonly AlgorithmIdentifier prf;
|
||||
|
||||
public static Pbkdf2Params GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is Pbkdf2Params)
|
||||
return (Pbkdf2Params)obj;
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
return new Pbkdf2Params((Asn1Sequence)obj);
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public Pbkdf2Params(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count < 2 || seq.Count > 4)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
this.octStr = (Asn1OctetString)seq[0];
|
||||
this.iterationCount = (DerInteger)seq[1];
|
||||
|
||||
Asn1Encodable kl = null, d = null;
|
||||
if (seq.Count > 3)
|
||||
{
|
||||
kl = seq[2];
|
||||
d = seq[3];
|
||||
}
|
||||
else if (seq.Count > 2)
|
||||
{
|
||||
if (seq[2] is DerInteger)
|
||||
{
|
||||
kl = seq[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
d = seq[2];
|
||||
}
|
||||
}
|
||||
if (kl != null)
|
||||
{
|
||||
keyLength = (DerInteger)kl;
|
||||
}
|
||||
if (d != null)
|
||||
{
|
||||
prf = AlgorithmIdentifier.GetInstance(d);
|
||||
}
|
||||
}
|
||||
|
||||
public Pbkdf2Params(
|
||||
byte[] salt,
|
||||
int iterationCount)
|
||||
{
|
||||
this.octStr = new DerOctetString(salt);
|
||||
this.iterationCount = new DerInteger(iterationCount);
|
||||
}
|
||||
|
||||
public Pbkdf2Params(
|
||||
byte[] salt,
|
||||
int iterationCount,
|
||||
int keyLength)
|
||||
: this(salt, iterationCount)
|
||||
{
|
||||
this.keyLength = new DerInteger(keyLength);
|
||||
}
|
||||
|
||||
public Pbkdf2Params(
|
||||
byte[] salt,
|
||||
int iterationCount,
|
||||
int keyLength,
|
||||
AlgorithmIdentifier prf)
|
||||
: this(salt, iterationCount, keyLength)
|
||||
{
|
||||
this.prf = prf;
|
||||
}
|
||||
|
||||
public Pbkdf2Params(
|
||||
byte[] salt,
|
||||
int iterationCount,
|
||||
AlgorithmIdentifier prf)
|
||||
: this(salt, iterationCount)
|
||||
{
|
||||
this.prf = prf;
|
||||
}
|
||||
|
||||
public byte[] GetSalt()
|
||||
{
|
||||
return octStr.GetOctets();
|
||||
}
|
||||
|
||||
public BigInteger IterationCount
|
||||
{
|
||||
get { return iterationCount.Value; }
|
||||
}
|
||||
|
||||
public BigInteger KeyLength
|
||||
{
|
||||
get { return keyLength == null ? null : keyLength.Value; }
|
||||
}
|
||||
|
||||
public bool IsDefaultPrf
|
||||
{
|
||||
get { return prf == null || prf.Equals(algid_hmacWithSHA1); }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier Prf
|
||||
{
|
||||
get { return prf != null ? prf : algid_hmacWithSHA1; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(octStr, iterationCount);
|
||||
v.AddOptional(keyLength);
|
||||
|
||||
if (!IsDefaultPrf)
|
||||
{
|
||||
v.Add(prf);
|
||||
}
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBKDF2Params.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PBKDF2Params.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 847bdf2c765ac9543bb9eaca350caf03
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCS12PBEParams.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCS12PBEParams.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class Pkcs12PbeParams
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerInteger iterations;
|
||||
private readonly Asn1OctetString iv;
|
||||
|
||||
public Pkcs12PbeParams(
|
||||
byte[] salt,
|
||||
int iterations)
|
||||
{
|
||||
this.iv = new DerOctetString(salt);
|
||||
this.iterations = new DerInteger(iterations);
|
||||
}
|
||||
|
||||
private Pkcs12PbeParams(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count != 2)
|
||||
throw new ArgumentException("Wrong number of elements in sequence", "seq");
|
||||
|
||||
iv = Asn1OctetString.GetInstance(seq[0]);
|
||||
iterations = DerInteger.GetInstance(seq[1]);
|
||||
}
|
||||
|
||||
public static Pkcs12PbeParams GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is Pkcs12PbeParams)
|
||||
{
|
||||
return (Pkcs12PbeParams) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new Pkcs12PbeParams((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public BigInteger Iterations
|
||||
{
|
||||
get { return iterations.Value; }
|
||||
}
|
||||
|
||||
public byte[] GetIV()
|
||||
{
|
||||
return iv.GetOctets();
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(iv, iterations);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCS12PBEParams.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCS12PBEParams.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d3038c74fca8ff42a93a94e90a17587
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
306
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCSObjectIdentifiers.cs
vendored
Normal file
306
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PKCSObjectIdentifiers.cs
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public abstract class PkcsObjectIdentifiers
|
||||
{
|
||||
//
|
||||
// pkcs-1 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 1 }
|
||||
//
|
||||
public const string Pkcs1 = "1.2.840.113549.1.1";
|
||||
internal static readonly DerObjectIdentifier Pkcs1Oid = new DerObjectIdentifier(Pkcs1);
|
||||
|
||||
public static readonly DerObjectIdentifier RsaEncryption = Pkcs1Oid.Branch("1");
|
||||
public static readonly DerObjectIdentifier MD2WithRsaEncryption = Pkcs1Oid.Branch("2");
|
||||
public static readonly DerObjectIdentifier MD4WithRsaEncryption = Pkcs1Oid.Branch("3");
|
||||
public static readonly DerObjectIdentifier MD5WithRsaEncryption = Pkcs1Oid.Branch("4");
|
||||
public static readonly DerObjectIdentifier Sha1WithRsaEncryption = Pkcs1Oid.Branch("5");
|
||||
public static readonly DerObjectIdentifier SrsaOaepEncryptionSet = Pkcs1Oid.Branch("6");
|
||||
public static readonly DerObjectIdentifier IdRsaesOaep = Pkcs1Oid.Branch("7");
|
||||
public static readonly DerObjectIdentifier IdMgf1 = Pkcs1Oid.Branch("8");
|
||||
public static readonly DerObjectIdentifier IdPSpecified = Pkcs1Oid.Branch("9");
|
||||
public static readonly DerObjectIdentifier IdRsassaPss = Pkcs1Oid.Branch("10");
|
||||
public static readonly DerObjectIdentifier Sha256WithRsaEncryption = Pkcs1Oid.Branch("11");
|
||||
public static readonly DerObjectIdentifier Sha384WithRsaEncryption = Pkcs1Oid.Branch("12");
|
||||
public static readonly DerObjectIdentifier Sha512WithRsaEncryption = Pkcs1Oid.Branch("13");
|
||||
public static readonly DerObjectIdentifier Sha224WithRsaEncryption = Pkcs1Oid.Branch("14");
|
||||
/** PKCS#1: 1.2.840.113549.1.1.15 */
|
||||
public static readonly DerObjectIdentifier Sha512_224WithRSAEncryption = Pkcs1Oid.Branch("15");
|
||||
/** PKCS#1: 1.2.840.113549.1.1.16 */
|
||||
public static readonly DerObjectIdentifier Sha512_256WithRSAEncryption = Pkcs1Oid.Branch("16");
|
||||
|
||||
//
|
||||
// pkcs-3 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 3 }
|
||||
//
|
||||
public const string Pkcs3 = "1.2.840.113549.1.3";
|
||||
|
||||
public static readonly DerObjectIdentifier DhKeyAgreement = new DerObjectIdentifier(Pkcs3 + ".1");
|
||||
|
||||
//
|
||||
// pkcs-5 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 5 }
|
||||
//
|
||||
public const string Pkcs5 = "1.2.840.113549.1.5";
|
||||
|
||||
public static readonly DerObjectIdentifier PbeWithMD2AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".1");
|
||||
public static readonly DerObjectIdentifier PbeWithMD2AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".4");
|
||||
public static readonly DerObjectIdentifier PbeWithMD5AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".3");
|
||||
public static readonly DerObjectIdentifier PbeWithMD5AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".6");
|
||||
public static readonly DerObjectIdentifier PbeWithSha1AndDesCbc = new DerObjectIdentifier(Pkcs5 + ".10");
|
||||
public static readonly DerObjectIdentifier PbeWithSha1AndRC2Cbc = new DerObjectIdentifier(Pkcs5 + ".11");
|
||||
|
||||
public static readonly DerObjectIdentifier IdPbeS2 = new DerObjectIdentifier(Pkcs5 + ".13");
|
||||
public static readonly DerObjectIdentifier IdPbkdf2 = new DerObjectIdentifier(Pkcs5 + ".12");
|
||||
|
||||
//
|
||||
// encryptionAlgorithm OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) 3 }
|
||||
//
|
||||
public const string EncryptionAlgorithm = "1.2.840.113549.3";
|
||||
|
||||
public static readonly DerObjectIdentifier DesEde3Cbc = new DerObjectIdentifier(EncryptionAlgorithm + ".7");
|
||||
public static readonly DerObjectIdentifier RC2Cbc = new DerObjectIdentifier(EncryptionAlgorithm + ".2");
|
||||
public static readonly DerObjectIdentifier rc4 = new DerObjectIdentifier(EncryptionAlgorithm + ".4");
|
||||
|
||||
//
|
||||
// object identifiers for digests
|
||||
//
|
||||
public const string DigestAlgorithm = "1.2.840.113549.2";
|
||||
|
||||
//
|
||||
// md2 OBJECT IDENTIFIER ::=
|
||||
// {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 2}
|
||||
//
|
||||
public static readonly DerObjectIdentifier MD2 = new DerObjectIdentifier(DigestAlgorithm + ".2");
|
||||
|
||||
//
|
||||
// md4 OBJECT IDENTIFIER ::=
|
||||
// {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 4}
|
||||
//
|
||||
public static readonly DerObjectIdentifier MD4 = new DerObjectIdentifier(DigestAlgorithm + ".4");
|
||||
|
||||
//
|
||||
// md5 OBJECT IDENTIFIER ::=
|
||||
// {iso(1) member-body(2) US(840) rsadsi(113549) DigestAlgorithm(2) 5}
|
||||
//
|
||||
public static readonly DerObjectIdentifier MD5 = new DerObjectIdentifier(DigestAlgorithm + ".5");
|
||||
|
||||
public static readonly DerObjectIdentifier IdHmacWithSha1 = new DerObjectIdentifier(DigestAlgorithm + ".7");
|
||||
public static readonly DerObjectIdentifier IdHmacWithSha224 = new DerObjectIdentifier(DigestAlgorithm + ".8");
|
||||
public static readonly DerObjectIdentifier IdHmacWithSha256 = new DerObjectIdentifier(DigestAlgorithm + ".9");
|
||||
public static readonly DerObjectIdentifier IdHmacWithSha384 = new DerObjectIdentifier(DigestAlgorithm + ".10");
|
||||
public static readonly DerObjectIdentifier IdHmacWithSha512 = new DerObjectIdentifier(DigestAlgorithm + ".11");
|
||||
|
||||
//
|
||||
// pkcs-7 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 7 }
|
||||
//
|
||||
public const string Pkcs7 = "1.2.840.113549.1.7";
|
||||
|
||||
public static readonly DerObjectIdentifier Data = new DerObjectIdentifier(Pkcs7 + ".1");
|
||||
public static readonly DerObjectIdentifier SignedData = new DerObjectIdentifier(Pkcs7 + ".2");
|
||||
public static readonly DerObjectIdentifier EnvelopedData = new DerObjectIdentifier(Pkcs7 + ".3");
|
||||
public static readonly DerObjectIdentifier SignedAndEnvelopedData = new DerObjectIdentifier(Pkcs7 + ".4");
|
||||
public static readonly DerObjectIdentifier DigestedData = new DerObjectIdentifier(Pkcs7 + ".5");
|
||||
public static readonly DerObjectIdentifier EncryptedData = new DerObjectIdentifier(Pkcs7 + ".6");
|
||||
|
||||
//
|
||||
// pkcs-9 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 9 }
|
||||
//
|
||||
public const string Pkcs9 = "1.2.840.113549.1.9";
|
||||
|
||||
public static readonly DerObjectIdentifier Pkcs9AtEmailAddress = new DerObjectIdentifier(Pkcs9 + ".1");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtUnstructuredName = new DerObjectIdentifier(Pkcs9 + ".2");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtContentType = new DerObjectIdentifier(Pkcs9 + ".3");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtMessageDigest = new DerObjectIdentifier(Pkcs9 + ".4");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtSigningTime = new DerObjectIdentifier(Pkcs9 + ".5");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtCounterSignature = new DerObjectIdentifier(Pkcs9 + ".6");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtChallengePassword = new DerObjectIdentifier(Pkcs9 + ".7");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtUnstructuredAddress = new DerObjectIdentifier(Pkcs9 + ".8");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtExtendedCertificateAttributes = new DerObjectIdentifier(Pkcs9 + ".9");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtSigningDescription = new DerObjectIdentifier(Pkcs9 + ".13");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtExtensionRequest = new DerObjectIdentifier(Pkcs9 + ".14");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtSmimeCapabilities = new DerObjectIdentifier(Pkcs9 + ".15");
|
||||
public static readonly DerObjectIdentifier IdSmime = new DerObjectIdentifier(Pkcs9 + ".16");
|
||||
|
||||
public static readonly DerObjectIdentifier Pkcs9AtFriendlyName = new DerObjectIdentifier(Pkcs9 + ".20");
|
||||
public static readonly DerObjectIdentifier Pkcs9AtLocalKeyID = new DerObjectIdentifier(Pkcs9 + ".21");
|
||||
|
||||
public const string CertTypes = Pkcs9 + ".22";
|
||||
public static readonly DerObjectIdentifier X509Certificate = new DerObjectIdentifier(CertTypes + ".1");
|
||||
public static readonly DerObjectIdentifier SdsiCertificate = new DerObjectIdentifier(CertTypes + ".2");
|
||||
|
||||
public const string CrlTypes = Pkcs9 + ".23";
|
||||
public static readonly DerObjectIdentifier X509Crl = new DerObjectIdentifier(CrlTypes + ".1");
|
||||
|
||||
public static readonly DerObjectIdentifier IdAlg = IdSmime.Branch("3");
|
||||
|
||||
public static readonly DerObjectIdentifier IdAlgEsdh = IdAlg.Branch("5");
|
||||
public static readonly DerObjectIdentifier IdAlgCms3DesWrap = IdAlg.Branch("6");
|
||||
public static readonly DerObjectIdentifier IdAlgCmsRC2Wrap = IdAlg.Branch("7");
|
||||
public static readonly DerObjectIdentifier IdAlgZlibCompress = IdAlg.Branch("8");
|
||||
public static readonly DerObjectIdentifier IdAlgPwriKek = IdAlg.Branch("9");
|
||||
public static readonly DerObjectIdentifier IdAlgSsdh = IdAlg.Branch("10");
|
||||
|
||||
/*
|
||||
* <pre>
|
||||
* -- RSA-KEM Key Transport Algorithm
|
||||
*
|
||||
* id-rsa-kem OID ::= {
|
||||
* iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
|
||||
* pkcs-9(9) smime(16) alg(3) 14
|
||||
* }
|
||||
* </pre>
|
||||
*/
|
||||
public static readonly DerObjectIdentifier IdRsaKem = IdAlg.Branch("14");
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* id-alg-AEADChaCha20Poly1305 OBJECT IDENTIFIER ::=
|
||||
* { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
|
||||
* pkcs9(9) smime(16) alg(3) 18 }
|
||||
*
|
||||
* AEADChaCha20Poly1305Nonce ::= OCTET STRING (SIZE(12))
|
||||
* </pre>
|
||||
*/
|
||||
public static readonly DerObjectIdentifier IdAlgAeadChaCha20Poly1305 = IdAlg.Branch("18");
|
||||
|
||||
|
||||
/**
|
||||
* id-alg-hss-lms-hashsig OBJECT IDENTIFIER ::= { iso(1)
|
||||
* member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9)
|
||||
* smime(16) alg(3) 17 }
|
||||
*/
|
||||
public static readonly DerObjectIdentifier IdAlgHssLmsHashsig = IdAlg.Branch("17");
|
||||
|
||||
//
|
||||
// SMIME capability sub oids.
|
||||
//
|
||||
public static readonly DerObjectIdentifier PreferSignedData = Pkcs9AtSmimeCapabilities.Branch("1");
|
||||
public static readonly DerObjectIdentifier CannotDecryptAny = Pkcs9AtSmimeCapabilities.Branch("2");
|
||||
public static readonly DerObjectIdentifier SmimeCapabilitiesVersions = Pkcs9AtSmimeCapabilities.Branch("3");
|
||||
|
||||
//
|
||||
// other SMIME attributes
|
||||
//
|
||||
public static readonly DerObjectIdentifier IdAAReceiptRequest = IdSmime.Branch("2.1");
|
||||
|
||||
//
|
||||
// id-ct OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
|
||||
// rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) ct(1)}
|
||||
//
|
||||
public const string IdCT = "1.2.840.113549.1.9.16.1";
|
||||
|
||||
public static readonly DerObjectIdentifier IdCTAuthData = new DerObjectIdentifier(IdCT + ".2");
|
||||
public static readonly DerObjectIdentifier IdCTTstInfo = new DerObjectIdentifier(IdCT + ".4");
|
||||
public static readonly DerObjectIdentifier IdCTCompressedData = new DerObjectIdentifier(IdCT + ".9");
|
||||
public static readonly DerObjectIdentifier IdCTAuthEnvelopedData = new DerObjectIdentifier(IdCT + ".23");
|
||||
public static readonly DerObjectIdentifier IdCTTimestampedData = new DerObjectIdentifier(IdCT + ".31");
|
||||
|
||||
//
|
||||
// id-cti OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
|
||||
// rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) cti(6)}
|
||||
//
|
||||
public const string IdCti = "1.2.840.113549.1.9.16.6";
|
||||
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfOrigin = new DerObjectIdentifier(IdCti + ".1");
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfReceipt = new DerObjectIdentifier(IdCti + ".2");
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfDelivery = new DerObjectIdentifier(IdCti + ".3");
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfSender = new DerObjectIdentifier(IdCti + ".4");
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfApproval = new DerObjectIdentifier(IdCti + ".5");
|
||||
public static readonly DerObjectIdentifier IdCtiEtsProofOfCreation = new DerObjectIdentifier(IdCti + ".6");
|
||||
|
||||
//
|
||||
// id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
|
||||
// rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}
|
||||
//
|
||||
public const string IdAA = "1.2.840.113549.1.9.16.2";
|
||||
public static readonly DerObjectIdentifier IdAAOid = new DerObjectIdentifier(IdAA);
|
||||
|
||||
public static readonly DerObjectIdentifier IdAAContentHint = new DerObjectIdentifier(IdAA + ".4"); // See RFC 2634
|
||||
public static readonly DerObjectIdentifier IdAAMsgSigDigest = new DerObjectIdentifier(IdAA + ".5");
|
||||
public static readonly DerObjectIdentifier IdAAContentReference = new DerObjectIdentifier(IdAA + ".10");
|
||||
|
||||
/*
|
||||
* id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
|
||||
*
|
||||
*/
|
||||
public static readonly DerObjectIdentifier IdAAEncrypKeyPref = new DerObjectIdentifier(IdAA + ".11");
|
||||
public static readonly DerObjectIdentifier IdAASigningCertificate = new DerObjectIdentifier(IdAA + ".12");
|
||||
public static readonly DerObjectIdentifier IdAASigningCertificateV2 = new DerObjectIdentifier(IdAA + ".47");
|
||||
|
||||
public static readonly DerObjectIdentifier IdAAContentIdentifier = new DerObjectIdentifier(IdAA + ".7"); // See RFC 2634
|
||||
|
||||
/*
|
||||
* RFC 3126
|
||||
*/
|
||||
public static readonly DerObjectIdentifier IdAASignatureTimeStampToken = new DerObjectIdentifier(IdAA + ".14");
|
||||
|
||||
public static readonly DerObjectIdentifier IdAAEtsSigPolicyID = new DerObjectIdentifier(IdAA + ".15");
|
||||
public static readonly DerObjectIdentifier IdAAEtsCommitmentType = new DerObjectIdentifier(IdAA + ".16");
|
||||
public static readonly DerObjectIdentifier IdAAEtsSignerLocation = new DerObjectIdentifier(IdAA + ".17");
|
||||
public static readonly DerObjectIdentifier IdAAEtsSignerAttr = new DerObjectIdentifier(IdAA + ".18");
|
||||
public static readonly DerObjectIdentifier IdAAEtsOtherSigCert = new DerObjectIdentifier(IdAA + ".19");
|
||||
public static readonly DerObjectIdentifier IdAAEtsContentTimestamp = new DerObjectIdentifier(IdAA + ".20");
|
||||
public static readonly DerObjectIdentifier IdAAEtsCertificateRefs = new DerObjectIdentifier(IdAA + ".21");
|
||||
public static readonly DerObjectIdentifier IdAAEtsRevocationRefs = new DerObjectIdentifier(IdAA + ".22");
|
||||
public static readonly DerObjectIdentifier IdAAEtsCertValues = new DerObjectIdentifier(IdAA + ".23");
|
||||
public static readonly DerObjectIdentifier IdAAEtsRevocationValues = new DerObjectIdentifier(IdAA + ".24");
|
||||
public static readonly DerObjectIdentifier IdAAEtsEscTimeStamp = new DerObjectIdentifier(IdAA + ".25");
|
||||
public static readonly DerObjectIdentifier IdAAEtsCertCrlTimestamp = new DerObjectIdentifier(IdAA + ".26");
|
||||
public static readonly DerObjectIdentifier IdAAEtsArchiveTimestamp = new DerObjectIdentifier(IdAA + ".27");
|
||||
|
||||
/** PKCS#9: 1.2.840.113549.1.9.16.2.37 - <a href="https://tools.ietf.org/html/rfc4108#section-2.2.5">RFC 4108</a> */
|
||||
public static readonly DerObjectIdentifier IdAADecryptKeyID = IdAAOid.Branch("37");
|
||||
|
||||
/** PKCS#9: 1.2.840.113549.1.9.16.2.38 - <a href="https://tools.ietf.org/html/rfc4108#section-2.2.6">RFC 4108</a> */
|
||||
public static readonly DerObjectIdentifier IdAAImplCryptoAlgs = IdAAOid.Branch("38");
|
||||
|
||||
/** PKCS#9: 1.2.840.113549.1.9.16.2.54 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
|
||||
public static readonly DerObjectIdentifier IdAAAsymmDecryptKeyID = IdAAOid.Branch("54");
|
||||
|
||||
/** PKCS#9: 1.2.840.113549.1.9.16.2.43 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
|
||||
public static readonly DerObjectIdentifier IdAAImplCompressAlgs = IdAAOid.Branch("43");
|
||||
/** PKCS#9: 1.2.840.113549.1.9.16.2.40 <a href="https://tools.ietf.org/html/rfc7030">RFC7030</a>*/
|
||||
public static readonly DerObjectIdentifier IdAACommunityIdentifiers = IdAAOid.Branch("40");
|
||||
|
||||
//
|
||||
// id-spq OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
|
||||
// rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) id-spq(5)}
|
||||
//
|
||||
public const string IdSpq = "1.2.840.113549.1.9.16.5";
|
||||
|
||||
public static readonly DerObjectIdentifier IdSpqEtsUri = new DerObjectIdentifier(IdSpq + ".1");
|
||||
public static readonly DerObjectIdentifier IdSpqEtsUNotice = new DerObjectIdentifier(IdSpq + ".2");
|
||||
|
||||
//
|
||||
// pkcs-12 OBJECT IDENTIFIER ::= {
|
||||
// iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) 12 }
|
||||
//
|
||||
public const string Pkcs12 = "1.2.840.113549.1.12";
|
||||
public const string BagTypes = Pkcs12 + ".10.1";
|
||||
|
||||
public static readonly DerObjectIdentifier KeyBag = new DerObjectIdentifier(BagTypes + ".1");
|
||||
public static readonly DerObjectIdentifier Pkcs8ShroudedKeyBag = new DerObjectIdentifier(BagTypes + ".2");
|
||||
public static readonly DerObjectIdentifier CertBag = new DerObjectIdentifier(BagTypes + ".3");
|
||||
public static readonly DerObjectIdentifier CrlBag = new DerObjectIdentifier(BagTypes + ".4");
|
||||
public static readonly DerObjectIdentifier SecretBag = new DerObjectIdentifier(BagTypes + ".5");
|
||||
public static readonly DerObjectIdentifier SafeContentsBag = new DerObjectIdentifier(BagTypes + ".6");
|
||||
|
||||
public const string Pkcs12PbeIds = Pkcs12 + ".1";
|
||||
|
||||
public static readonly DerObjectIdentifier PbeWithShaAnd128BitRC4 = new DerObjectIdentifier(Pkcs12PbeIds + ".1");
|
||||
public static readonly DerObjectIdentifier PbeWithShaAnd40BitRC4 = new DerObjectIdentifier(Pkcs12PbeIds + ".2");
|
||||
public static readonly DerObjectIdentifier PbeWithShaAnd3KeyTripleDesCbc = new DerObjectIdentifier(Pkcs12PbeIds + ".3");
|
||||
public static readonly DerObjectIdentifier PbeWithShaAnd2KeyTripleDesCbc = new DerObjectIdentifier(Pkcs12PbeIds + ".4");
|
||||
public static readonly DerObjectIdentifier PbeWithShaAnd128BitRC2Cbc = new DerObjectIdentifier(Pkcs12PbeIds + ".5");
|
||||
public static readonly DerObjectIdentifier PbewithShaAnd40BitRC2Cbc = new DerObjectIdentifier(Pkcs12PbeIds + ".6");
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b5a35db33d7f954a856e8127636bc8e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Pfx.cs
vendored
Normal file
67
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Pfx.cs
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
#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.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* the infamous Pfx from Pkcs12
|
||||
*/
|
||||
public class Pfx
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static Pfx GetInstance(object obj)
|
||||
{
|
||||
if (obj is Pfx)
|
||||
return (Pfx)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new Pfx(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private readonly ContentInfo contentInfo;
|
||||
private readonly MacData macData;
|
||||
|
||||
private Pfx(Asn1Sequence seq)
|
||||
{
|
||||
DerInteger version = DerInteger.GetInstance(seq[0]);
|
||||
if (!version.HasValue(3))
|
||||
throw new ArgumentException("wrong version for PFX PDU");
|
||||
|
||||
this.contentInfo = ContentInfo.GetInstance(seq[1]);
|
||||
|
||||
if (seq.Count == 3)
|
||||
{
|
||||
this.macData = MacData.GetInstance(seq[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public Pfx(ContentInfo contentInfo, MacData macData)
|
||||
{
|
||||
this.contentInfo = contentInfo;
|
||||
this.macData = macData;
|
||||
}
|
||||
|
||||
public ContentInfo AuthSafe
|
||||
{
|
||||
get { return contentInfo; }
|
||||
}
|
||||
|
||||
public MacData MacData
|
||||
{
|
||||
get { return macData; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(new DerInteger(3), contentInfo);
|
||||
v.AddOptional(macData);
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Pfx.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/Pfx.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7b047def731647e4fb7ae8d716ca7558
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
207
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PrivateKeyInfo.cs
vendored
Normal file
207
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PrivateKeyInfo.cs
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* RFC 5958
|
||||
*
|
||||
* <pre>
|
||||
* [IMPLICIT TAGS]
|
||||
*
|
||||
* OneAsymmetricKey ::= SEQUENCE {
|
||||
* version Version,
|
||||
* privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
|
||||
* privateKey PrivateKey,
|
||||
* attributes [0] Attributes OPTIONAL,
|
||||
* ...,
|
||||
* [[2: publicKey [1] PublicKey OPTIONAL ]],
|
||||
* ...
|
||||
* }
|
||||
*
|
||||
* PrivateKeyInfo ::= OneAsymmetricKey
|
||||
*
|
||||
* Version ::= INTEGER { v1(0), v2(1) } (v1, ..., v2)
|
||||
*
|
||||
* PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
|
||||
* { PUBLIC-KEY,
|
||||
* { PrivateKeyAlgorithms } }
|
||||
*
|
||||
* PrivateKey ::= OCTET STRING
|
||||
* -- Content varies based on type of key. The
|
||||
* -- algorithm identifier dictates the format of
|
||||
* -- the key.
|
||||
*
|
||||
* PublicKey ::= BIT STRING
|
||||
* -- Content varies based on type of key. The
|
||||
* -- algorithm identifier dictates the format of
|
||||
* -- the key.
|
||||
*
|
||||
* Attributes ::= SET OF Attribute { { OneAsymmetricKeyAttributes } }
|
||||
* </pre>
|
||||
*/
|
||||
public class PrivateKeyInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerInteger version;
|
||||
private readonly AlgorithmIdentifier privateKeyAlgorithm;
|
||||
private readonly Asn1OctetString privateKey;
|
||||
private readonly Asn1Set attributes;
|
||||
private readonly DerBitString publicKey;
|
||||
|
||||
public static PrivateKeyInfo GetInstance(Asn1TaggedObject obj, bool explicitly)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
|
||||
}
|
||||
|
||||
public static PrivateKeyInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
if (obj is PrivateKeyInfo)
|
||||
return (PrivateKeyInfo)obj;
|
||||
return new PrivateKeyInfo(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private static int GetVersionValue(DerInteger version)
|
||||
{
|
||||
BigInteger bigValue = version.Value;
|
||||
if (bigValue.CompareTo(BigInteger.Zero) < 0 || bigValue.CompareTo(BigInteger.One) > 0)
|
||||
throw new ArgumentException("invalid version for private key info", "version");
|
||||
|
||||
return bigValue.IntValue;
|
||||
}
|
||||
|
||||
public PrivateKeyInfo(
|
||||
AlgorithmIdentifier privateKeyAlgorithm,
|
||||
Asn1Encodable privateKey)
|
||||
: this(privateKeyAlgorithm, privateKey, null, null)
|
||||
{
|
||||
}
|
||||
|
||||
public PrivateKeyInfo(
|
||||
AlgorithmIdentifier privateKeyAlgorithm,
|
||||
Asn1Encodable privateKey,
|
||||
Asn1Set attributes)
|
||||
: this(privateKeyAlgorithm, privateKey, attributes, null)
|
||||
{
|
||||
}
|
||||
|
||||
public PrivateKeyInfo(
|
||||
AlgorithmIdentifier privateKeyAlgorithm,
|
||||
Asn1Encodable privateKey,
|
||||
Asn1Set attributes,
|
||||
byte[] publicKey)
|
||||
{
|
||||
this.version = new DerInteger(publicKey != null ? BigInteger.One : BigInteger.Zero);
|
||||
this.privateKeyAlgorithm = privateKeyAlgorithm;
|
||||
this.privateKey = new DerOctetString(privateKey);
|
||||
this.attributes = attributes;
|
||||
this.publicKey = publicKey == null ? null : new DerBitString(publicKey);
|
||||
}
|
||||
|
||||
private PrivateKeyInfo(Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
this.version = DerInteger.GetInstance(CollectionUtilities.RequireNext(e));
|
||||
|
||||
int versionValue = GetVersionValue(version);
|
||||
|
||||
this.privateKeyAlgorithm = AlgorithmIdentifier.GetInstance(CollectionUtilities.RequireNext(e));
|
||||
this.privateKey = Asn1OctetString.GetInstance(CollectionUtilities.RequireNext(e));
|
||||
|
||||
int lastTag = -1;
|
||||
while (e.MoveNext())
|
||||
{
|
||||
Asn1TaggedObject tagged = (Asn1TaggedObject)e.Current;
|
||||
|
||||
int tag = tagged.TagNo;
|
||||
if (tag <= lastTag)
|
||||
throw new ArgumentException("invalid optional field in private key info", "seq");
|
||||
|
||||
lastTag = tag;
|
||||
|
||||
switch (tag)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
this.attributes = Asn1Set.GetInstance(tagged, false);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
if (versionValue < 1)
|
||||
throw new ArgumentException("'publicKey' requires version v2(1) or later", "seq");
|
||||
|
||||
this.publicKey = DerBitString.GetInstance(tagged, false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new ArgumentException("unknown optional field in private key info", "seq");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public virtual Asn1Set Attributes
|
||||
{
|
||||
get { return attributes; }
|
||||
}
|
||||
|
||||
/// <summary>Return true if a public key is present, false otherwise.</summary>
|
||||
public virtual bool HasPublicKey
|
||||
{
|
||||
get { return publicKey != null; }
|
||||
}
|
||||
|
||||
public virtual AlgorithmIdentifier PrivateKeyAlgorithm
|
||||
{
|
||||
get { return privateKeyAlgorithm; }
|
||||
}
|
||||
|
||||
public virtual Asn1OctetString PrivateKeyData
|
||||
{
|
||||
get { return privateKey; }
|
||||
}
|
||||
|
||||
public virtual Asn1Object ParsePrivateKey()
|
||||
{
|
||||
return Asn1Object.FromByteArray(privateKey.GetOctets());
|
||||
}
|
||||
|
||||
/// <summary>For when the public key is an ASN.1 encoding.</summary>
|
||||
public virtual Asn1Object ParsePublicKey()
|
||||
{
|
||||
return publicKey == null ? null : Asn1Object.FromByteArray(publicKey.GetOctets());
|
||||
}
|
||||
|
||||
/// <summary>Return the public key as a raw bit string.</summary>
|
||||
public virtual DerBitString PublicKeyData
|
||||
{
|
||||
get { return publicKey; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, privateKeyAlgorithm, privateKey);
|
||||
v.AddOptionalTagged(false, 0, attributes);
|
||||
v.AddOptionalTagged(false, 1, publicKey);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PrivateKeyInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/PrivateKeyInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68f715a8fa0b2614685db9fe32778d60
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RC2CBCParameter.cs
vendored
Normal file
78
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RC2CBCParameter.cs
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class RC2CbcParameter
|
||||
: Asn1Encodable
|
||||
{
|
||||
internal DerInteger version;
|
||||
internal Asn1OctetString iv;
|
||||
|
||||
public static RC2CbcParameter GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new RC2CbcParameter((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public RC2CbcParameter(
|
||||
byte[] iv)
|
||||
{
|
||||
this.iv = new DerOctetString(iv);
|
||||
}
|
||||
|
||||
public RC2CbcParameter(
|
||||
int parameterVersion,
|
||||
byte[] iv)
|
||||
{
|
||||
this.version = new DerInteger(parameterVersion);
|
||||
this.iv = new DerOctetString(iv);
|
||||
}
|
||||
|
||||
private RC2CbcParameter(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
if (seq.Count == 1)
|
||||
{
|
||||
iv = (Asn1OctetString)seq[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
version = (DerInteger)seq[0];
|
||||
iv = (Asn1OctetString)seq[1];
|
||||
}
|
||||
}
|
||||
|
||||
public BigInteger RC2ParameterVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return version == null ? null : version.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] GetIV()
|
||||
{
|
||||
return Arrays.Clone(iv.GetOctets());
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
v.AddOptional(version);
|
||||
v.Add(iv);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RC2CBCParameter.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RC2CBCParameter.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98be317ecd40b4147b5f2951df706084
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
155
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAESOAEPparams.cs
vendored
Normal file
155
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAESOAEPparams.cs
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
#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;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class RsaesOaepParameters
|
||||
: Asn1Encodable
|
||||
{
|
||||
private AlgorithmIdentifier hashAlgorithm;
|
||||
private AlgorithmIdentifier maskGenAlgorithm;
|
||||
private AlgorithmIdentifier pSourceAlgorithm;
|
||||
|
||||
public readonly static AlgorithmIdentifier DefaultHashAlgorithm = new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1, DerNull.Instance);
|
||||
public readonly static AlgorithmIdentifier DefaultMaskGenFunction = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, DefaultHashAlgorithm);
|
||||
public readonly static AlgorithmIdentifier DefaultPSourceAlgorithm = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdPSpecified, new DerOctetString(new byte[0]));
|
||||
|
||||
public static RsaesOaepParameters GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is RsaesOaepParameters)
|
||||
{
|
||||
return (RsaesOaepParameters)obj;
|
||||
}
|
||||
else if (obj is Asn1Sequence)
|
||||
{
|
||||
return new RsaesOaepParameters((Asn1Sequence)obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* The default version
|
||||
*/
|
||||
public RsaesOaepParameters()
|
||||
: this(DefaultHashAlgorithm, DefaultMaskGenFunction, DefaultPSourceAlgorithm)
|
||||
{
|
||||
}
|
||||
|
||||
public RsaesOaepParameters(
|
||||
AlgorithmIdentifier hashAlgorithm,
|
||||
AlgorithmIdentifier maskGenAlgorithm)
|
||||
: this(hashAlgorithm, maskGenAlgorithm, DefaultPSourceAlgorithm)
|
||||
{
|
||||
}
|
||||
|
||||
public RsaesOaepParameters(
|
||||
AlgorithmIdentifier hashAlgorithm,
|
||||
AlgorithmIdentifier maskGenAlgorithm,
|
||||
AlgorithmIdentifier pSourceAlgorithm)
|
||||
{
|
||||
this.hashAlgorithm = hashAlgorithm;
|
||||
this.maskGenAlgorithm = maskGenAlgorithm;
|
||||
this.pSourceAlgorithm = pSourceAlgorithm;
|
||||
}
|
||||
|
||||
public RsaesOaepParameters(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
hashAlgorithm = DefaultHashAlgorithm;
|
||||
maskGenAlgorithm = DefaultMaskGenFunction;
|
||||
pSourceAlgorithm = DefaultPSourceAlgorithm;
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject o = (Asn1TaggedObject)seq[i];
|
||||
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0:
|
||||
hashAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
|
||||
break;
|
||||
case 1:
|
||||
maskGenAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
|
||||
break;
|
||||
case 2:
|
||||
pSourceAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier HashAlgorithm
|
||||
{
|
||||
get { return hashAlgorithm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier MaskGenAlgorithm
|
||||
{
|
||||
get { return maskGenAlgorithm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier PSourceAlgorithm
|
||||
{
|
||||
get { return pSourceAlgorithm; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* RSAES-OAEP-params ::= SEQUENCE {
|
||||
* hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
|
||||
* maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
|
||||
* pSourceAlgorithm [2] PKCS1PSourceAlgorithms DEFAULT pSpecifiedEmpty
|
||||
* }
|
||||
*
|
||||
* OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-sha1 PARAMETERS NULL }|
|
||||
* { OID id-sha256 PARAMETERS NULL }|
|
||||
* { OID id-sha384 PARAMETERS NULL }|
|
||||
* { OID id-sha512 PARAMETERS NULL },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* PKCS1PSourceAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-pSpecified PARAMETERS OCTET STRING },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
* </pre>
|
||||
* @return the asn1 primitive representing the parameters.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
if (!hashAlgorithm.Equals(DefaultHashAlgorithm))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 0, hashAlgorithm));
|
||||
}
|
||||
|
||||
if (!maskGenAlgorithm.Equals(DefaultMaskGenFunction))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 1, maskGenAlgorithm));
|
||||
}
|
||||
|
||||
if (!pSourceAlgorithm.Equals(DefaultPSourceAlgorithm))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 2, pSourceAlgorithm));
|
||||
}
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAESOAEPparams.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAESOAEPparams.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b6fc9562b657954896be11d9c85d2d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
146
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAPrivateKeyStructure.cs
vendored
Normal file
146
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSAPrivateKeyStructure.cs
vendored
Normal 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.Math;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class RsaPrivateKeyStructure
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly BigInteger modulus;
|
||||
private readonly BigInteger publicExponent;
|
||||
private readonly BigInteger privateExponent;
|
||||
private readonly BigInteger prime1;
|
||||
private readonly BigInteger prime2;
|
||||
private readonly BigInteger exponent1;
|
||||
private readonly BigInteger exponent2;
|
||||
private readonly BigInteger coefficient;
|
||||
|
||||
public static RsaPrivateKeyStructure GetInstance(Asn1TaggedObject obj, bool isExplicit)
|
||||
{
|
||||
return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
|
||||
}
|
||||
|
||||
public static RsaPrivateKeyStructure GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
if (obj is RsaPrivateKeyStructure)
|
||||
return (RsaPrivateKeyStructure)obj;
|
||||
return new RsaPrivateKeyStructure(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public RsaPrivateKeyStructure(
|
||||
BigInteger modulus,
|
||||
BigInteger publicExponent,
|
||||
BigInteger privateExponent,
|
||||
BigInteger prime1,
|
||||
BigInteger prime2,
|
||||
BigInteger exponent1,
|
||||
BigInteger exponent2,
|
||||
BigInteger coefficient)
|
||||
{
|
||||
this.modulus = modulus;
|
||||
this.publicExponent = publicExponent;
|
||||
this.privateExponent = privateExponent;
|
||||
this.prime1 = prime1;
|
||||
this.prime2 = prime2;
|
||||
this.exponent1 = exponent1;
|
||||
this.exponent2 = exponent2;
|
||||
this.coefficient = coefficient;
|
||||
}
|
||||
|
||||
private RsaPrivateKeyStructure(Asn1Sequence seq)
|
||||
{
|
||||
BigInteger version = ((DerInteger)seq[0]).Value;
|
||||
if (version.IntValue != 0)
|
||||
throw new ArgumentException("wrong version for RSA private key");
|
||||
|
||||
modulus = ((DerInteger)seq[1]).Value;
|
||||
publicExponent = ((DerInteger)seq[2]).Value;
|
||||
privateExponent = ((DerInteger)seq[3]).Value;
|
||||
prime1 = ((DerInteger)seq[4]).Value;
|
||||
prime2 = ((DerInteger)seq[5]).Value;
|
||||
exponent1 = ((DerInteger)seq[6]).Value;
|
||||
exponent2 = ((DerInteger)seq[7]).Value;
|
||||
coefficient = ((DerInteger)seq[8]).Value;
|
||||
}
|
||||
|
||||
public BigInteger Modulus
|
||||
{
|
||||
get { return modulus; }
|
||||
}
|
||||
|
||||
public BigInteger PublicExponent
|
||||
{
|
||||
get { return publicExponent; }
|
||||
}
|
||||
|
||||
public BigInteger PrivateExponent
|
||||
{
|
||||
get { return privateExponent; }
|
||||
}
|
||||
|
||||
public BigInteger Prime1
|
||||
{
|
||||
get { return prime1; }
|
||||
}
|
||||
|
||||
public BigInteger Prime2
|
||||
{
|
||||
get { return prime2; }
|
||||
}
|
||||
|
||||
public BigInteger Exponent1
|
||||
{
|
||||
get { return exponent1; }
|
||||
}
|
||||
|
||||
public BigInteger Exponent2
|
||||
{
|
||||
get { return exponent2; }
|
||||
}
|
||||
|
||||
public BigInteger Coefficient
|
||||
{
|
||||
get { return coefficient; }
|
||||
}
|
||||
|
||||
/**
|
||||
* This outputs the key in Pkcs1v2 format.
|
||||
* <pre>
|
||||
* RsaPrivateKey ::= Sequence {
|
||||
* version Version,
|
||||
* modulus Integer, -- n
|
||||
* publicExponent Integer, -- e
|
||||
* privateExponent Integer, -- d
|
||||
* prime1 Integer, -- p
|
||||
* prime2 Integer, -- q
|
||||
* exponent1 Integer, -- d mod (p-1)
|
||||
* exponent2 Integer, -- d mod (q-1)
|
||||
* coefficient Integer -- (inverse of q) mod p
|
||||
* }
|
||||
*
|
||||
* Version ::= Integer
|
||||
* </pre>
|
||||
* <p>This routine is written to output Pkcs1 version 0, private keys.</p>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
return new DerSequence(
|
||||
new DerInteger(0), // version
|
||||
new DerInteger(Modulus),
|
||||
new DerInteger(PublicExponent),
|
||||
new DerInteger(PrivateExponent),
|
||||
new DerInteger(Prime1),
|
||||
new DerInteger(Prime2),
|
||||
new DerInteger(Exponent1),
|
||||
new DerInteger(Exponent2),
|
||||
new DerInteger(Coefficient));
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af28ed0dbcfbf6949b06528a70b42dc3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
170
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSASSAPSSparams.cs
vendored
Normal file
170
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSASSAPSSparams.cs
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
#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;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
public class RsassaPssParameters
|
||||
: Asn1Encodable
|
||||
{
|
||||
private AlgorithmIdentifier hashAlgorithm;
|
||||
private AlgorithmIdentifier maskGenAlgorithm;
|
||||
private DerInteger saltLength;
|
||||
private DerInteger trailerField;
|
||||
|
||||
public readonly static AlgorithmIdentifier DefaultHashAlgorithm = new AlgorithmIdentifier(OiwObjectIdentifiers.IdSha1, DerNull.Instance);
|
||||
public readonly static AlgorithmIdentifier DefaultMaskGenFunction = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, DefaultHashAlgorithm);
|
||||
public readonly static DerInteger DefaultSaltLength = new DerInteger(20);
|
||||
public readonly static DerInteger DefaultTrailerField = new DerInteger(1);
|
||||
|
||||
public static RsassaPssParameters GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj == null || obj is RsassaPssParameters)
|
||||
{
|
||||
return (RsassaPssParameters)obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new RsassaPssParameters((Asn1Sequence)obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
/**
|
||||
* The default version
|
||||
*/
|
||||
public RsassaPssParameters()
|
||||
{
|
||||
hashAlgorithm = DefaultHashAlgorithm;
|
||||
maskGenAlgorithm = DefaultMaskGenFunction;
|
||||
saltLength = DefaultSaltLength;
|
||||
trailerField = DefaultTrailerField;
|
||||
}
|
||||
|
||||
public RsassaPssParameters(
|
||||
AlgorithmIdentifier hashAlgorithm,
|
||||
AlgorithmIdentifier maskGenAlgorithm,
|
||||
DerInteger saltLength,
|
||||
DerInteger trailerField)
|
||||
{
|
||||
this.hashAlgorithm = hashAlgorithm;
|
||||
this.maskGenAlgorithm = maskGenAlgorithm;
|
||||
this.saltLength = saltLength;
|
||||
this.trailerField = trailerField;
|
||||
}
|
||||
|
||||
public RsassaPssParameters(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
hashAlgorithm = DefaultHashAlgorithm;
|
||||
maskGenAlgorithm = DefaultMaskGenFunction;
|
||||
saltLength = DefaultSaltLength;
|
||||
trailerField = DefaultTrailerField;
|
||||
|
||||
for (int i = 0; i != seq.Count; i++)
|
||||
{
|
||||
Asn1TaggedObject o = (Asn1TaggedObject)seq[i];
|
||||
|
||||
switch (o.TagNo)
|
||||
{
|
||||
case 0:
|
||||
hashAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
|
||||
break;
|
||||
case 1:
|
||||
maskGenAlgorithm = AlgorithmIdentifier.GetInstance(o, true);
|
||||
break;
|
||||
case 2:
|
||||
saltLength = DerInteger.GetInstance(o, true);
|
||||
break;
|
||||
case 3:
|
||||
trailerField = DerInteger.GetInstance(o, true);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier HashAlgorithm
|
||||
{
|
||||
get { return hashAlgorithm; }
|
||||
}
|
||||
|
||||
public AlgorithmIdentifier MaskGenAlgorithm
|
||||
{
|
||||
get { return maskGenAlgorithm; }
|
||||
}
|
||||
|
||||
public DerInteger SaltLength
|
||||
{
|
||||
get { return saltLength; }
|
||||
}
|
||||
|
||||
public DerInteger TrailerField
|
||||
{
|
||||
get { return trailerField; }
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* RSASSA-PSS-params ::= SEQUENCE {
|
||||
* hashAlgorithm [0] OAEP-PSSDigestAlgorithms DEFAULT sha1,
|
||||
* maskGenAlgorithm [1] PKCS1MGFAlgorithms DEFAULT mgf1SHA1,
|
||||
* saltLength [2] INTEGER DEFAULT 20,
|
||||
* trailerField [3] TrailerField DEFAULT trailerFieldBC
|
||||
* }
|
||||
*
|
||||
* OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-sha1 PARAMETERS NULL }|
|
||||
* { OID id-sha256 PARAMETERS NULL }|
|
||||
* { OID id-sha384 PARAMETERS NULL }|
|
||||
* { OID id-sha512 PARAMETERS NULL },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
*
|
||||
* PKCS1MGFAlgorithms ALGORITHM-IDENTIFIER ::= {
|
||||
* { OID id-mgf1 PARAMETERS OAEP-PSSDigestAlgorithms },
|
||||
* ... -- Allows for future expansion --
|
||||
* }
|
||||
*
|
||||
* TrailerField ::= INTEGER { trailerFieldBC(1) }
|
||||
* </pre>
|
||||
* @return the asn1 primitive representing the parameters.
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector();
|
||||
|
||||
if (!hashAlgorithm.Equals(DefaultHashAlgorithm))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 0, hashAlgorithm));
|
||||
}
|
||||
|
||||
if (!maskGenAlgorithm.Equals(DefaultMaskGenFunction))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 1, maskGenAlgorithm));
|
||||
}
|
||||
|
||||
if (!saltLength.Equals(DefaultSaltLength))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 2, saltLength));
|
||||
}
|
||||
|
||||
if (!trailerField.Equals(DefaultTrailerField))
|
||||
{
|
||||
v.Add(new DerTaggedObject(true, 3, trailerField));
|
||||
}
|
||||
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSASSAPSSparams.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/RSASSAPSSparams.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d93f906e4aef5245949be6c399b9bd4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
78
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SafeBag.cs
vendored
Normal file
78
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SafeBag.cs
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
#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.Pkcs
|
||||
{
|
||||
public class SafeBag
|
||||
: Asn1Encodable
|
||||
{
|
||||
public static SafeBag GetInstance(object obj)
|
||||
{
|
||||
if (obj is SafeBag)
|
||||
return (SafeBag)obj;
|
||||
if (obj == null)
|
||||
return null;
|
||||
return new SafeBag(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
private readonly DerObjectIdentifier bagID;
|
||||
private readonly Asn1Object bagValue;
|
||||
private readonly Asn1Set bagAttributes;
|
||||
|
||||
public SafeBag(
|
||||
DerObjectIdentifier oid,
|
||||
Asn1Object obj)
|
||||
{
|
||||
this.bagID = oid;
|
||||
this.bagValue = obj;
|
||||
this.bagAttributes = null;
|
||||
}
|
||||
|
||||
public SafeBag(
|
||||
DerObjectIdentifier oid,
|
||||
Asn1Object obj,
|
||||
Asn1Set bagAttributes)
|
||||
{
|
||||
this.bagID = oid;
|
||||
this.bagValue = obj;
|
||||
this.bagAttributes = bagAttributes;
|
||||
}
|
||||
|
||||
private SafeBag(Asn1Sequence seq)
|
||||
{
|
||||
this.bagID = (DerObjectIdentifier)seq[0];
|
||||
this.bagValue = ((DerTaggedObject)seq[1]).GetObject();
|
||||
if (seq.Count == 3)
|
||||
{
|
||||
this.bagAttributes = (Asn1Set)seq[2];
|
||||
}
|
||||
}
|
||||
|
||||
public DerObjectIdentifier BagID
|
||||
{
|
||||
get { return bagID; }
|
||||
}
|
||||
|
||||
public Asn1Object BagValue
|
||||
{
|
||||
get { return bagValue; }
|
||||
}
|
||||
|
||||
public Asn1Set BagAttributes
|
||||
{
|
||||
get { return bagAttributes; }
|
||||
}
|
||||
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(bagID, new DerTaggedObject(0, bagValue));
|
||||
v.AddOptional(bagAttributes);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SafeBag.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SafeBag.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 377fef3d32291114494f56d9d5ea884f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
145
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignedData.cs
vendored
Normal file
145
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignedData.cs
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* a Pkcs#7 signed data object.
|
||||
*/
|
||||
public class SignedData
|
||||
: Asn1Encodable
|
||||
{
|
||||
private readonly DerInteger version;
|
||||
private readonly Asn1Set digestAlgorithms;
|
||||
private readonly ContentInfo contentInfo;
|
||||
private readonly Asn1Set certificates;
|
||||
private readonly Asn1Set crls;
|
||||
private readonly Asn1Set signerInfos;
|
||||
|
||||
public static SignedData GetInstance(object obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return null;
|
||||
SignedData existing = obj as SignedData;
|
||||
if (existing != null)
|
||||
return existing;
|
||||
return new SignedData(Asn1Sequence.GetInstance(obj));
|
||||
}
|
||||
|
||||
public SignedData(
|
||||
DerInteger _version,
|
||||
Asn1Set _digestAlgorithms,
|
||||
ContentInfo _contentInfo,
|
||||
Asn1Set _certificates,
|
||||
Asn1Set _crls,
|
||||
Asn1Set _signerInfos)
|
||||
{
|
||||
version = _version;
|
||||
digestAlgorithms = _digestAlgorithms;
|
||||
contentInfo = _contentInfo;
|
||||
certificates = _certificates;
|
||||
crls = _crls;
|
||||
signerInfos = _signerInfos;
|
||||
}
|
||||
|
||||
private SignedData(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
e.MoveNext();
|
||||
version = (DerInteger) e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
digestAlgorithms = (Asn1Set) e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
contentInfo = ContentInfo.GetInstance(e.Current);
|
||||
|
||||
while (e.MoveNext())
|
||||
{
|
||||
Asn1Object o = e.Current.ToAsn1Object();
|
||||
|
||||
//
|
||||
// an interesting feature of SignedData is that there appear to be varying implementations...
|
||||
// for the moment we ignore anything which doesn't fit.
|
||||
//
|
||||
if (o is Asn1TaggedObject tagged)
|
||||
{
|
||||
switch (tagged.TagNo)
|
||||
{
|
||||
case 0:
|
||||
certificates = Asn1Set.GetInstance(tagged, false);
|
||||
break;
|
||||
case 1:
|
||||
crls = Asn1Set.GetInstance(tagged, false);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("unknown tag value " + tagged.TagNo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
signerInfos = (Asn1Set) o;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version
|
||||
{
|
||||
get { return version; }
|
||||
}
|
||||
|
||||
public Asn1Set DigestAlgorithms
|
||||
{
|
||||
get { return digestAlgorithms; }
|
||||
}
|
||||
|
||||
public ContentInfo ContentInfo
|
||||
{
|
||||
get { return contentInfo; }
|
||||
}
|
||||
|
||||
public Asn1Set Certificates
|
||||
{
|
||||
get { return certificates; }
|
||||
}
|
||||
|
||||
public Asn1Set Crls
|
||||
{
|
||||
get { return crls; }
|
||||
}
|
||||
|
||||
public Asn1Set SignerInfos
|
||||
{
|
||||
get { return signerInfos; }
|
||||
}
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SignedData ::= Sequence {
|
||||
* version Version,
|
||||
* digestAlgorithms DigestAlgorithmIdentifiers,
|
||||
* contentInfo ContentInfo,
|
||||
* certificates
|
||||
* [0] IMPLICIT ExtendedCertificatesAndCertificates
|
||||
* OPTIONAL,
|
||||
* crls
|
||||
* [1] IMPLICIT CertificateRevocationLists OPTIONAL,
|
||||
* signerInfos SignerInfos }
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, digestAlgorithms, contentInfo);
|
||||
v.AddOptionalTagged(false, 0, certificates);
|
||||
v.AddOptionalTagged(false, 1, crls);
|
||||
v.Add(signerInfos);
|
||||
return new BerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignedData.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignedData.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79707c1b9341dac4ea02ac8c31c82c84
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
146
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignerInfo.cs
vendored
Normal file
146
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignerInfo.cs
vendored
Normal 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.X509;
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs
|
||||
{
|
||||
/**
|
||||
* a Pkcs#7 signer info object.
|
||||
*/
|
||||
public class SignerInfo
|
||||
: Asn1Encodable
|
||||
{
|
||||
private DerInteger version;
|
||||
private IssuerAndSerialNumber issuerAndSerialNumber;
|
||||
private AlgorithmIdentifier digAlgorithm;
|
||||
private Asn1Set authenticatedAttributes;
|
||||
private AlgorithmIdentifier digEncryptionAlgorithm;
|
||||
private Asn1OctetString encryptedDigest;
|
||||
private Asn1Set unauthenticatedAttributes;
|
||||
|
||||
public static SignerInfo GetInstance(
|
||||
object obj)
|
||||
{
|
||||
if (obj is SignerInfo)
|
||||
{
|
||||
return (SignerInfo) obj;
|
||||
}
|
||||
|
||||
if (obj is Asn1Sequence)
|
||||
{
|
||||
return new SignerInfo((Asn1Sequence) obj);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Unknown object in factory: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj), "obj");
|
||||
}
|
||||
|
||||
public SignerInfo(
|
||||
DerInteger version,
|
||||
IssuerAndSerialNumber issuerAndSerialNumber,
|
||||
AlgorithmIdentifier digAlgorithm,
|
||||
Asn1Set authenticatedAttributes,
|
||||
AlgorithmIdentifier digEncryptionAlgorithm,
|
||||
Asn1OctetString encryptedDigest,
|
||||
Asn1Set unauthenticatedAttributes)
|
||||
{
|
||||
this.version = version;
|
||||
this.issuerAndSerialNumber = issuerAndSerialNumber;
|
||||
this.digAlgorithm = digAlgorithm;
|
||||
this.authenticatedAttributes = authenticatedAttributes;
|
||||
this.digEncryptionAlgorithm = digEncryptionAlgorithm;
|
||||
this.encryptedDigest = encryptedDigest;
|
||||
this.unauthenticatedAttributes = unauthenticatedAttributes;
|
||||
}
|
||||
|
||||
public SignerInfo(
|
||||
Asn1Sequence seq)
|
||||
{
|
||||
var e = seq.GetEnumerator();
|
||||
|
||||
e.MoveNext();
|
||||
version = (DerInteger) e.Current;
|
||||
|
||||
e.MoveNext();
|
||||
issuerAndSerialNumber = IssuerAndSerialNumber.GetInstance(e.Current);
|
||||
|
||||
e.MoveNext();
|
||||
digAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);
|
||||
|
||||
e.MoveNext();
|
||||
var obj = e.Current;
|
||||
|
||||
if (obj is Asn1TaggedObject tagged)
|
||||
{
|
||||
authenticatedAttributes = Asn1Set.GetInstance(tagged, false);
|
||||
|
||||
e.MoveNext();
|
||||
digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(e.Current);
|
||||
}
|
||||
else
|
||||
{
|
||||
authenticatedAttributes = null;
|
||||
digEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(obj);
|
||||
}
|
||||
|
||||
e.MoveNext();
|
||||
encryptedDigest = DerOctetString.GetInstance(e.Current);
|
||||
|
||||
if (e.MoveNext())
|
||||
{
|
||||
unauthenticatedAttributes = Asn1Set.GetInstance((Asn1TaggedObject)e.Current, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
unauthenticatedAttributes = null;
|
||||
}
|
||||
}
|
||||
|
||||
public DerInteger Version { get { return version; } }
|
||||
|
||||
public IssuerAndSerialNumber IssuerAndSerialNumber { get { return issuerAndSerialNumber; } }
|
||||
|
||||
public Asn1Set AuthenticatedAttributes { get { return authenticatedAttributes; } }
|
||||
|
||||
public AlgorithmIdentifier DigestAlgorithm { get { return digAlgorithm; } }
|
||||
|
||||
public Asn1OctetString EncryptedDigest { get { return encryptedDigest; } }
|
||||
|
||||
public AlgorithmIdentifier DigestEncryptionAlgorithm { get { return digEncryptionAlgorithm; } }
|
||||
|
||||
public Asn1Set UnauthenticatedAttributes { get { return unauthenticatedAttributes; } }
|
||||
|
||||
/**
|
||||
* Produce an object suitable for an Asn1OutputStream.
|
||||
* <pre>
|
||||
* SignerInfo ::= Sequence {
|
||||
* version Version,
|
||||
* issuerAndSerialNumber IssuerAndSerialNumber,
|
||||
* digestAlgorithm DigestAlgorithmIdentifier,
|
||||
* authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
|
||||
* digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
|
||||
* encryptedDigest EncryptedDigest,
|
||||
* unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
|
||||
* }
|
||||
*
|
||||
* EncryptedDigest ::= OCTET STRING
|
||||
*
|
||||
* DigestAlgorithmIdentifier ::= AlgorithmIdentifier
|
||||
*
|
||||
* DigestEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
|
||||
* </pre>
|
||||
*/
|
||||
public override Asn1Object ToAsn1Object()
|
||||
{
|
||||
Asn1EncodableVector v = new Asn1EncodableVector(version, issuerAndSerialNumber, digAlgorithm);
|
||||
v.AddOptionalTagged(false, 0, authenticatedAttributes);
|
||||
v.Add(digEncryptionAlgorithm, encryptedDigest);
|
||||
v.AddOptionalTagged(false, 1, unauthenticatedAttributes);
|
||||
return new DerSequence(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignerInfo.cs.meta
vendored
Normal file
11
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/pkcs/SignerInfo.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6502c2d8185b0614fbcb752e02f3713c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user