- Initial commit

This commit is contained in:
Timur Kozanov
2026-07-03 05:02:26 +03:00
commit 374ff1e689
4080 changed files with 388870 additions and 0 deletions

View File

@ -0,0 +1,61 @@
#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.CryptoPro
{
public abstract class CryptoProObjectIdentifiers
{
// GOST Algorithms OBJECT IDENTIFIERS :
// { iso(1) member-body(2) ru(643) rans(2) cryptopro(2)}
public const string GostID = "1.2.643.2.2";
public static readonly DerObjectIdentifier GostR3411 = new DerObjectIdentifier(GostID + ".9");
public static readonly DerObjectIdentifier GostR3411Hmac = new DerObjectIdentifier(GostID + ".10");
public static readonly DerObjectIdentifier GostR28147Gcfb = new DerObjectIdentifier(GostID + ".21");
public static readonly DerObjectIdentifier GostR28147Cbc = GostR28147Gcfb;
public static readonly DerObjectIdentifier ID_Gost28147_89_CryptoPro_A_ParamSet = new DerObjectIdentifier(GostID + ".31.1");
public static readonly DerObjectIdentifier GostR3410x94 = new DerObjectIdentifier(GostID + ".20");
public static readonly DerObjectIdentifier GostR3410x2001 = new DerObjectIdentifier(GostID + ".19");
public static readonly DerObjectIdentifier GostR3411x94WithGostR3410x94 = new DerObjectIdentifier(GostID + ".4");
public static readonly DerObjectIdentifier GostR3411x94WithGostR3410x2001 = new DerObjectIdentifier(GostID + ".3");
// { iso(1) member-body(2) ru(643) rans(2) cryptopro(2) hashes(30) }
public static readonly DerObjectIdentifier GostR3411x94CryptoProParamSet = new DerObjectIdentifier(GostID + ".30.1");
// { iso(1) member-body(2) ru(643) rans(2) cryptopro(2) signs(32) }
public static readonly DerObjectIdentifier GostR3410x94CryptoProA = new DerObjectIdentifier(GostID + ".32.2");
public static readonly DerObjectIdentifier GostR3410x94CryptoProB = new DerObjectIdentifier(GostID + ".32.3");
public static readonly DerObjectIdentifier GostR3410x94CryptoProC = new DerObjectIdentifier(GostID + ".32.4");
public static readonly DerObjectIdentifier GostR3410x94CryptoProD = new DerObjectIdentifier(GostID + ".32.5");
// { iso(1) member-body(2) ru(643) rans(2) cryptopro(2) exchanges(33) }
public static readonly DerObjectIdentifier GostR3410x94CryptoProXchA = new DerObjectIdentifier(GostID + ".33.1");
public static readonly DerObjectIdentifier GostR3410x94CryptoProXchB = new DerObjectIdentifier(GostID + ".33.2");
public static readonly DerObjectIdentifier GostR3410x94CryptoProXchC = new DerObjectIdentifier(GostID + ".33.3");
//{ iso(1) member-body(2)ru(643) rans(2) cryptopro(2) ecc-signs(35) }
public static readonly DerObjectIdentifier GostR3410x2001CryptoProA = new DerObjectIdentifier(GostID + ".35.1");
public static readonly DerObjectIdentifier GostR3410x2001CryptoProB = new DerObjectIdentifier(GostID + ".35.2");
public static readonly DerObjectIdentifier GostR3410x2001CryptoProC = new DerObjectIdentifier(GostID + ".35.3");
// { iso(1) member-body(2) ru(643) rans(2) cryptopro(2) ecc-exchanges(36) }
public static readonly DerObjectIdentifier GostR3410x2001CryptoProXchA = new DerObjectIdentifier(GostID + ".36.0");
public static readonly DerObjectIdentifier GostR3410x2001CryptoProXchB = new DerObjectIdentifier(GostID + ".36.1");
public static readonly DerObjectIdentifier GostElSgDH3410Default = new DerObjectIdentifier(GostID + ".36.0");
public static readonly DerObjectIdentifier GostElSgDH3410x1 = new DerObjectIdentifier(GostID + ".36.1");
public static readonly DerObjectIdentifier GostR3410x2001CryptoProESDH = new DerObjectIdentifier(GostID + ".96");
public static readonly DerObjectIdentifier GostR3410x2001DH = new DerObjectIdentifier(GostID + ".98");
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c23ba903641042c4f91e1e06f872e1c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/CryptoProObjectIdentifiers.cs
uploadId: 783279

View File

@ -0,0 +1,399 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Collections.Generic;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Rosstandart;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Multiplier;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro
{
/// <summary>Elliptic curve registry for GOST 3410-2001 / 2012.</summary>
public static class ECGost3410NamedCurves
{
private static X9ECPoint ConfigureBasepoint(ECCurve curve, BigInteger x, BigInteger y)
{
ECPoint G = curve.CreatePoint(x, y);
WNafUtilities.ConfigureBasepoint(G);
return new X9ECPoint(G, false);
}
private static ECCurve ConfigureCurve(ECCurve curve)
{
return curve;
}
private static BigInteger FromHex(string hex)
{
return new BigInteger(1, Hex.DecodeStrict(hex));
}
internal class Holder_gostR3410_2001_CryptoPro_A
: X9ECParametersHolder
{
private Holder_gostR3410_2001_CryptoPro_A() {}
internal static readonly X9ECParametersHolder Instance = new Holder_gostR3410_2001_CryptoPro_A();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97");
BigInteger mod_q = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6C611070995AD10045841B09B761B893");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD94"),
FromHex("A6"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.One,
FromHex("8D91E471E0989CDA27DF505A453F2B7635294F2DDF23E3B122ACC99C9E9F1E14"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_gostR3410_2001_CryptoPro_B
: X9ECParametersHolder
{
private Holder_gostR3410_2001_CryptoPro_B() {}
internal static readonly X9ECParametersHolder Instance = new Holder_gostR3410_2001_CryptoPro_B();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("8000000000000000000000000000000000000000000000000000000000000C99");
BigInteger mod_q = FromHex("800000000000000000000000000000015F700CFFF1A624E5E497161BCC8A198F");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("8000000000000000000000000000000000000000000000000000000000000C96"),
FromHex("3E1AF419A269A5F866A7D3C25C3DF80AE979259373FF2B182F49D4CE7E1BBC8B"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.One,
FromHex("3FA8124359F96680B83D1C3EB2C070E5C545C9858D03ECFB744BF8D717717EFC"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_gostR3410_2001_CryptoPro_C
: X9ECParametersHolder
{
private Holder_gostR3410_2001_CryptoPro_C() {}
internal static readonly X9ECParametersHolder Instance = new Holder_gostR3410_2001_CryptoPro_C();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B");
BigInteger mod_q = FromHex("9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598"),
FromHex("805A"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.Zero,
FromHex("41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_gostR3410_2001_CryptoPro_XchB
: X9ECParametersHolder
{
private Holder_gostR3410_2001_CryptoPro_XchB() {}
internal static readonly X9ECParametersHolder Instance = new Holder_gostR3410_2001_CryptoPro_XchB();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D759B");
BigInteger mod_q = FromHex("9B9F605F5A858107AB1EC85E6B41C8AA582CA3511EDDFB74F02F3A6598980BB9");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("9B9F605F5A858107AB1EC85E6B41C8AACF846E86789051D37998F7B9022D7598"),
FromHex("805A"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.Zero,
FromHex("41ECE55743711A8C3CBF3783CD08C0EE4D4DC440D4641A8F366E550DFDB3BB67"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_id_tc26_gost_3410_12_256_paramSetA
: X9ECParametersHolder
{
private Holder_id_tc26_gost_3410_12_256_paramSetA() {}
internal static readonly X9ECParametersHolder Instance = new Holder_id_tc26_gost_3410_12_256_paramSetA();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD97");
BigInteger mod_q = FromHex("400000000000000000000000000000000FD8CDDFC87B6635C115AF556C360C67");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("C2173F1513981673AF4892C23035A27CE25E2013BF95AA33B22C656F277E7335"),
FromHex("295F9BAE7428ED9CCC20E7C359A9D41A22FCCD9108E17BF7BA9337A6F8AE9513"),
mod_q, BigInteger.Four, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
FromHex("91E38443A5E82C0D880923425712B2BB658B9196932E02C78B2582FE742DAA28"),
FromHex("32879423AB1A0375895786C4BB46E9565FDE0B5344766740AF268ADB32322E5C"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_id_tc26_gost_3410_12_512_paramSetA
: X9ECParametersHolder
{
private Holder_id_tc26_gost_3410_12_512_paramSetA() {}
internal static readonly X9ECParametersHolder Instance = new Holder_id_tc26_gost_3410_12_512_paramSetA();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7");
BigInteger mod_q = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF27E69532F48D89116FF22B8D4E0560609B4B38ABFAD2B85DCACDB1411F10B275");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC4"),
FromHex("E8C2505DEDFC86DDC1BD0B2B6667F1DA34B82574761CB0E879BD081CFD0B6265EE3CB090F30D27614CB4574010DA90DD862EF9D4EBEE4761503190785A71C760"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.Three,
FromHex("7503CFE87A836AE3A61B8816E25450E6CE5E1C93ACF1ABC1778064FDCBEFA921DF1626BE4FD036E93D75E6A50E3A41E98028FE5FC235F5B889A589CB5215F2A4"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_id_tc26_gost_3410_12_512_paramSetB
: X9ECParametersHolder
{
private Holder_id_tc26_gost_3410_12_512_paramSetB() {}
internal static readonly X9ECParametersHolder Instance = new Holder_id_tc26_gost_3410_12_512_paramSetB();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006F");
BigInteger mod_q = FromHex("800000000000000000000000000000000000000000000000000000000000000149A1EC142565A545ACFDB77BD9D40CFA8B996712101BEA0EC6346C54374F25BD");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006C"),
FromHex("687D1B459DC841457E3E06CF6F5E2517B97C7D614AF138BCBF85DC806C4B289F3E965D2DB1416D217F8B276FAD1AB69C50F78BEE1FA3106EFB8CCBC7C5140116"),
mod_q, BigInteger.One, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
BigInteger.Two,
FromHex("1A8F7EDA389B094C2C071E3647A8940F3C123B697578C213BE6DD9E6C8EC7335DCB228FD1EDF4A39152CBCAAF8C0398828041055F94CEEEC7E21340780FE41BD"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
internal class Holder_id_tc26_gost_3410_12_512_paramSetC
: X9ECParametersHolder
{
private Holder_id_tc26_gost_3410_12_512_paramSetC() {}
internal static readonly X9ECParametersHolder Instance = new Holder_id_tc26_gost_3410_12_512_paramSetC();
protected override ECCurve CreateCurve()
{
BigInteger mod_p = FromHex("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFDC7");
BigInteger mod_q = FromHex("3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC98CDBA46506AB004C33A9FF5147502CC8EDA9E7A769A12694623CEF47F023ED");
return ConfigureCurve(new FpCurve(
mod_p,
FromHex("DC9203E514A721875485A529D2C722FB187BC8980EB866644DE41C68E143064546E861C0E2C9EDD92ADE71F46FCF50FF2AD97F951FDA9F2A2EB6546F39689BD3"),
FromHex("B4C4EE28CEBC6C2C8AC12952CF37F16AC7EFB6A9F69F4B57FFDA2E4F0DE5ADE038CBC2FFF719D2C18DE0284B8BFEF3B52B8CC7A5F5BF0A3C8D2319A5312557E1"),
mod_q, BigInteger.Four, true));
}
protected override X9ECParameters CreateParameters()
{
byte[] S = null;
ECCurve curve = Curve;
X9ECPoint G = ConfigureBasepoint(curve,
FromHex("E2E31EDFC23DE7BDEBE241CE593EF5DE2295B7A9CBAEF021D385F7074CEA043AA27272A7AE602BF2A7B9033DB9ED3610C6FB85487EAE97AAC5BC7928C1950148"),
FromHex("F5CE40D95B5EB899ABBCCFF5911CB8577939804D6527378B8C108C3D2090FF9BE18E2D33E3021ED2EF32D85822423B6304F726AA854BAE07D0396E9A9ADDC40F"));
return new X9ECParameters(curve, G, curve.Order, curve.Cofactor, S);
}
};
private static readonly Dictionary<string, DerObjectIdentifier> objIds =
new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<DerObjectIdentifier, X9ECParametersHolder> curves =
new Dictionary<DerObjectIdentifier, X9ECParametersHolder>();
private static readonly Dictionary<DerObjectIdentifier, string> names =
new Dictionary<DerObjectIdentifier, string>();
private static void DefineCurve(string name, DerObjectIdentifier oid, X9ECParametersHolder holder)
{
objIds.Add(name, oid);
names.Add(oid, name);
curves.Add(oid, holder);
}
static ECGost3410NamedCurves()
{
DefineCurve("GostR3410-2001-CryptoPro-A",
CryptoProObjectIdentifiers.GostR3410x2001CryptoProA,
Holder_gostR3410_2001_CryptoPro_A.Instance);
DefineCurve("GostR3410-2001-CryptoPro-B",
CryptoProObjectIdentifiers.GostR3410x2001CryptoProB,
Holder_gostR3410_2001_CryptoPro_B.Instance);
DefineCurve("GostR3410-2001-CryptoPro-C",
CryptoProObjectIdentifiers.GostR3410x2001CryptoProC,
Holder_gostR3410_2001_CryptoPro_C.Instance);
DefineCurve("GostR3410-2001-CryptoPro-XchA",
CryptoProObjectIdentifiers.GostR3410x2001CryptoProXchA,
Holder_gostR3410_2001_CryptoPro_A.Instance);
DefineCurve("GostR3410-2001-CryptoPro-XchB",
CryptoProObjectIdentifiers.GostR3410x2001CryptoProXchB,
Holder_gostR3410_2001_CryptoPro_XchB.Instance);
DefineCurve("Tc26-Gost-3410-12-256-paramSetA",
RosstandartObjectIdentifiers.id_tc26_gost_3410_12_256_paramSetA,
Holder_id_tc26_gost_3410_12_256_paramSetA.Instance);
DefineCurve("Tc26-Gost-3410-12-512-paramSetA",
RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512_paramSetA,
Holder_id_tc26_gost_3410_12_512_paramSetA.Instance);
DefineCurve("Tc26-Gost-3410-12-512-paramSetB",
RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512_paramSetB,
Holder_id_tc26_gost_3410_12_512_paramSetB.Instance);
DefineCurve("Tc26-Gost-3410-12-512-paramSetC",
RosstandartObjectIdentifiers.id_tc26_gost_3410_12_512_paramSetC,
Holder_id_tc26_gost_3410_12_512_paramSetC.Instance);
}
/// <summary>Look up the <see cref="X9ECParameters"/> for the curve with the given name.</summary>
/// <param name="name">The name of the curve.</param>
public static X9ECParameters GetByName(string name)
{
DerObjectIdentifier oid = GetOid(name);
return oid == null ? null : GetByOid(oid);
}
/// <summary>Look up an <see cref="X9ECParametersHolder"/> for the curve with the given name.</summary>
/// <remarks>
/// Allows accessing the <see cref="ECCurve">curve</see> without necessarily triggering the creation of the
/// full <see cref="X9ECParameters"/>.
/// </remarks>
/// <param name="name">The name of the curve.</param>
public static X9ECParametersHolder GetByNameLazy(string name)
{
DerObjectIdentifier oid = GetOid(name);
return oid == null ? null : GetByOidLazy(oid);
}
/// <summary>Look up the <see cref="X9ECParameters"/> for the curve with the given
/// <see cref="DerObjectIdentifier">OID</see>.</summary>
/// <param name="oid">The <see cref="DerObjectIdentifier">OID</see> for the curve.</param>
public static X9ECParameters GetByOid(DerObjectIdentifier oid)
{
return GetByOidLazy(oid)?.Parameters;
}
/// <summary>Look up an <see cref="X9ECParametersHolder"/> for the curve with the given
/// <see cref="DerObjectIdentifier">OID</see>.</summary>
/// <remarks>
/// Allows accessing the <see cref="ECCurve">curve</see> without necessarily triggering the creation of the
/// full <see cref="X9ECParameters"/>.
/// </remarks>
/// <param name="oid">The <see cref="DerObjectIdentifier">OID</see> for the curve.</param>
public static X9ECParametersHolder GetByOidLazy(DerObjectIdentifier oid)
{
return CollectionUtilities.GetValueOrNull(curves, oid);
}
/// <summary>Look up the name of the curve with the given <see cref="DerObjectIdentifier">OID</see>.</summary>
/// <param name="oid">The <see cref="DerObjectIdentifier">OID</see> for the curve.</param>
public static string GetName(DerObjectIdentifier oid)
{
return CollectionUtilities.GetValueOrNull(names, oid);
}
/// <summary>Look up the <see cref="DerObjectIdentifier">OID</see> of the curve with the given name.</summary>
/// <param name="name">The name of the curve.</param>
public static DerObjectIdentifier GetOid(string name)
{
return CollectionUtilities.GetValueOrNull(objIds, name);
}
/// <summary>Enumerate the available curve names in this registry.</summary>
public static IEnumerable<string> Names
{
get { return CollectionUtilities.Proxy(objIds.Keys); }
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 66d8e5a0881bc6c4496b585b4e8bbc64
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/ECGOST3410NamedCurves.cs
uploadId: 783279

View File

@ -0,0 +1,85 @@
#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.CryptoPro
{
public class ECGost3410ParamSetParameters
: Asn1Encodable
{
internal readonly DerInteger p, q, a, b, x, y;
public static ECGost3410ParamSetParameters GetInstance(Asn1TaggedObject obj, bool explicitly)
{
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
}
public static ECGost3410ParamSetParameters GetInstance(object obj)
{
if (obj == null || obj is ECGost3410ParamSetParameters)
{
return (ECGost3410ParamSetParameters) obj;
}
if (obj is Asn1Sequence seq)
return new ECGost3410ParamSetParameters(seq);
throw new ArgumentException("Invalid GOST3410Parameter: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
}
public ECGost3410ParamSetParameters(
BigInteger a,
BigInteger b,
BigInteger p,
BigInteger q,
int x,
BigInteger y)
{
this.a = new DerInteger(a);
this.b = new DerInteger(b);
this.p = new DerInteger(p);
this.q = new DerInteger(q);
this.x = new DerInteger(x);
this.y = new DerInteger(y);
}
public ECGost3410ParamSetParameters(
Asn1Sequence seq)
{
if (seq.Count != 6)
throw new ArgumentException("Wrong number of elements in sequence", "seq");
this.a = DerInteger.GetInstance(seq[0]);
this.b = DerInteger.GetInstance(seq[1]);
this.p = DerInteger.GetInstance(seq[2]);
this.q = DerInteger.GetInstance(seq[3]);
this.x = DerInteger.GetInstance(seq[4]);
this.y = DerInteger.GetInstance(seq[5]);
}
public BigInteger P
{
get { return p.PositiveValue; }
}
public BigInteger Q
{
get { return q.PositiveValue; }
}
public BigInteger A
{
get { return a.PositiveValue; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(a, b, p, q, x, y);
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: dba7ef28019746549ac489da0e382c5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/ECGOST3410ParamSetParameters.cs
uploadId: 783279

View File

@ -0,0 +1,58 @@
#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.CryptoPro
{
public class Gost28147Parameters
: Asn1Encodable
{
private readonly Asn1OctetString iv;
private readonly DerObjectIdentifier paramSet;
public static Gost28147Parameters GetInstance(Asn1TaggedObject obj, bool explicitly)
{
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
}
public static Gost28147Parameters GetInstance(object obj)
{
if (obj == null || obj is Gost28147Parameters)
return (Gost28147Parameters) obj;
if (obj is Asn1Sequence seq)
return new Gost28147Parameters(seq);
throw new ArgumentException("Invalid GOST3410Parameter: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
}
private Gost28147Parameters(Asn1Sequence seq)
{
if (seq.Count != 2)
throw new ArgumentException("Wrong number of elements in sequence", "seq");
this.iv = Asn1OctetString.GetInstance(seq[0]);
this.paramSet = DerObjectIdentifier.GetInstance(seq[1]);
}
/**
* <pre>
* Gost28147-89-Parameters ::=
* SEQUENCE {
* iv Gost28147-89-IV,
* encryptionParamSet OBJECT IDENTIFIER
* }
*
* Gost28147-89-IV ::= OCTET STRING (SIZE (8))
* </pre>
*/
public override Asn1Object ToAsn1Object()
{
return new DerSequence(iv, paramSet);
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 5d51ef1fdb3f40e459a78a6810363964
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/GOST28147Parameters.cs
uploadId: 783279

View File

@ -0,0 +1,112 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.Collections.Generic;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Math;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro
{
/// <summary>Registry of available named parameters for GOST 3410-94.</summary>
public static class Gost3410NamedParameters
{
private static readonly Gost3410ParamSetParameters cryptoProA = new Gost3410ParamSetParameters(
1024,
new BigInteger("127021248288932417465907042777176443525787653508916535812817507265705031260985098497423188333483401180925999995120988934130659205614996724254121049274349357074920312769561451689224110579311248812610229678534638401693520013288995000362260684222750813532307004517341633685004541062586971416883686778842537820383"),
new BigInteger("68363196144955700784444165611827252895102170888761442055095051287550314083023"),
new BigInteger("100997906755055304772081815535925224869841082572053457874823515875577147990529272777244152852699298796483356699682842027972896052747173175480590485607134746852141928680912561502802222185647539190902656116367847270145019066794290930185446216399730872221732889830323194097355403213400972588322876850946740663962")
// validationAlgorithm {
// algorithm
// id-GostR3410-94-bBis,
// parameters
// GostR3410-94-ValidationBisParameters: {
// x0 1376285941,
// c 3996757427
// }
// }
);
private static readonly Gost3410ParamSetParameters cryptoProB = new Gost3410ParamSetParameters(
1024,
new BigInteger("139454871199115825601409655107690713107041707059928031797758001454375765357722984094124368522288239833039114681648076688236921220737322672160740747771700911134550432053804647694904686120113087816240740184800477047157336662926249423571248823968542221753660143391485680840520336859458494803187341288580489525163"),
new BigInteger("79885141663410976897627118935756323747307951916507639758300472692338873533959"),
new BigInteger("42941826148615804143873447737955502392672345968607143066798112994089471231420027060385216699563848719957657284814898909770759462613437669456364882730370838934791080835932647976778601915343474400961034231316672578686920482194932878633360203384797092684342247621055760235016132614780652761028509445403338652341")
// validationAlgorithm {
// algorithm
// id-GostR3410-94-bBis,
// parameters
// GostR3410-94-ValidationBisParameters: {
// x0 1536654555,
// c 1855361757,
// d 14408629386140014567655
//4902939282056547857802241461782996702017713059974755104394739915140
//6115284791024439062735788342744854120601660303926203867703556828005
//8957203818114895398976594425537561271800850306
// }
// }
//}
);
private static readonly Gost3410ParamSetParameters cryptoProXchA = new Gost3410ParamSetParameters(
1024,
new BigInteger("142011741597563481196368286022318089743276138395243738762872573441927459393512718973631166078467600360848946623567625795282774719212241929071046134208380636394084512691828894000571524625445295769349356752728956831541775441763139384457191755096847107846595662547942312293338483924514339614727760681880609734239"),
new BigInteger("91771529896554605945588149018382750217296858393520724172743325725474374979801"),
new BigInteger("133531813272720673433859519948319001217942375967847486899482359599369642528734712461590403327731821410328012529253871914788598993103310567744136196364803064721377826656898686468463277710150809401182608770201615324990468332931294920912776241137878030224355746606283971659376426832674269780880061631528163475887")
);
private static readonly Dictionary<string, DerObjectIdentifier> objIds =
new Dictionary<string, DerObjectIdentifier>(StringComparer.OrdinalIgnoreCase);
private static readonly Dictionary<DerObjectIdentifier, Gost3410ParamSetParameters> parameters =
new Dictionary<DerObjectIdentifier, Gost3410ParamSetParameters>();
private static void DefineParameters(string name, DerObjectIdentifier oid,
Gost3410ParamSetParameters parameterSet)
{
objIds.Add(name, oid);
parameters.Add(oid, parameterSet);
}
static Gost3410NamedParameters()
{
DefineParameters("GostR3410-94-CryptoPro-A", CryptoProObjectIdentifiers.GostR3410x94CryptoProA, cryptoProA);
DefineParameters("GostR3410-94-CryptoPro-B", CryptoProObjectIdentifiers.GostR3410x94CryptoProB, cryptoProB);
DefineParameters("GostR3410-94-CryptoPro-XchA", CryptoProObjectIdentifiers.GostR3410x94CryptoProXchA,
cryptoProXchA);
}
/// <summary>Look up the <see cref="Gost3410ParamSetParameters"/> for the parameter set with the given name.
/// </summary>
/// <param name="name">The name of the parameter set.</param>
public static Gost3410ParamSetParameters GetByName(string name)
{
DerObjectIdentifier oid = GetOid(name);
return oid == null ? null : GetByOid(oid);
}
/// <summary>Look up the <see cref="Gost3410ParamSetParameters"/> for the parameter set with the given
/// <see cref="DerObjectIdentifier">OID</see>.</summary>
/// <param name="oid">The <see cref="DerObjectIdentifier">OID</see> for the parameter set.</param>
public static Gost3410ParamSetParameters GetByOid(DerObjectIdentifier oid)
{
return CollectionUtilities.GetValueOrNull(parameters, oid);
}
/// <summary>Look up the <see cref="DerObjectIdentifier">OID</see> of the parameter set with the given name.
/// </summary>
/// <param name="name">The name of the parameter set.</param>
public static DerObjectIdentifier GetOid(string name)
{
return CollectionUtilities.GetValueOrNull(objIds, name);
}
/// <summary>Enumerate the available parameter set names in this registry.</summary>
public static IEnumerable<string> Names
{
get { return CollectionUtilities.Proxy(objIds.Keys); }
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 202baced9e4bc474ea48f92a5dce885a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/GOST3410NamedParameters.cs
uploadId: 783279

View 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.Math;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro
{
public class Gost3410ParamSetParameters
: Asn1Encodable
{
private readonly int keySize;
private readonly DerInteger p, q, a;
public static Gost3410ParamSetParameters GetInstance(Asn1TaggedObject obj, bool explicitly)
{
return GetInstance(Asn1Sequence.GetInstance(obj, explicitly));
}
public static Gost3410ParamSetParameters GetInstance(object obj)
{
if (obj == null || obj is Gost3410ParamSetParameters)
return (Gost3410ParamSetParameters) obj;
if (obj is Asn1Sequence seq)
return new Gost3410ParamSetParameters(seq);
throw new ArgumentException("Invalid GOST3410Parameter: " + Org.BouncyCastle.Utilities.Platform.GetTypeName(obj));
}
public Gost3410ParamSetParameters(
int keySize,
BigInteger p,
BigInteger q,
BigInteger a)
{
this.keySize = keySize;
this.p = new DerInteger(p);
this.q = new DerInteger(q);
this.a = new DerInteger(a);
}
private Gost3410ParamSetParameters(
Asn1Sequence seq)
{
if (seq.Count != 4)
throw new ArgumentException("Wrong number of elements in sequence", "seq");
this.keySize = DerInteger.GetInstance(seq[0]).IntValueExact;
this.p = DerInteger.GetInstance(seq[1]);
this.q = DerInteger.GetInstance(seq[2]);
this.a = DerInteger.GetInstance(seq[3]);
}
public int KeySize
{
get { return keySize; }
}
public BigInteger P
{
get { return p.PositiveValue; }
}
public BigInteger Q
{
get { return q.PositiveValue; }
}
public BigInteger A
{
get { return a.PositiveValue; }
}
public override Asn1Object ToAsn1Object()
{
return new DerSequence(new DerInteger(keySize), p, q, a);
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 212fae964a87c784cb48c6d34c296562
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/GOST3410ParamSetParameters.cs
uploadId: 783279

View File

@ -0,0 +1,84 @@
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro
{
public class Gost3410PublicKeyAlgParameters
: Asn1Encodable
{
private DerObjectIdentifier publicKeyParamSet;
private DerObjectIdentifier digestParamSet;
private DerObjectIdentifier encryptionParamSet;
public static Gost3410PublicKeyAlgParameters GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit)
{
return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit));
}
public static Gost3410PublicKeyAlgParameters GetInstance(object obj)
{
if (obj == null || obj is Gost3410PublicKeyAlgParameters)
return (Gost3410PublicKeyAlgParameters)obj;
return new Gost3410PublicKeyAlgParameters(Asn1Sequence.GetInstance(obj));
}
public Gost3410PublicKeyAlgParameters(
DerObjectIdentifier publicKeyParamSet,
DerObjectIdentifier digestParamSet)
: this (publicKeyParamSet, digestParamSet, null)
{
}
public Gost3410PublicKeyAlgParameters(
DerObjectIdentifier publicKeyParamSet,
DerObjectIdentifier digestParamSet,
DerObjectIdentifier encryptionParamSet)
{
if (publicKeyParamSet == null)
throw new ArgumentNullException("publicKeyParamSet");
if (digestParamSet == null)
throw new ArgumentNullException("digestParamSet");
this.publicKeyParamSet = publicKeyParamSet;
this.digestParamSet = digestParamSet;
this.encryptionParamSet = encryptionParamSet;
}
private Gost3410PublicKeyAlgParameters(Asn1Sequence seq)
{
this.publicKeyParamSet = (DerObjectIdentifier) seq[0];
this.digestParamSet = (DerObjectIdentifier) seq[1];
if (seq.Count > 2)
{
this.encryptionParamSet = (DerObjectIdentifier) seq[2];
}
}
public DerObjectIdentifier PublicKeyParamSet
{
get { return publicKeyParamSet; }
}
public DerObjectIdentifier DigestParamSet
{
get { return digestParamSet; }
}
public DerObjectIdentifier EncryptionParamSet
{
get { return encryptionParamSet; }
}
public override Asn1Object ToAsn1Object()
{
Asn1EncodableVector v = new Asn1EncodableVector(publicKeyParamSet, digestParamSet);
v.AddOptional(encryptionParamSet);
return new DerSequence(v);
}
}
}
#pragma warning restore
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 60a88c8a465a350409779ce27c0561aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 267636
packageName: Best HTTP
packageVersion: 3.0.17
assetPath: Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/asn1/cryptopro/GOST3410PublicKeyAlgParameters.cs
uploadId: 783279