198 lines
6.9 KiB
C#
198 lines
6.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Anssi
|
|
{
|
|
// Token: 0x02001994 RID: 6548
|
|
[Token(Token = "0x2001994")]
|
|
[StructLayout(3)]
|
|
public class AnssiNamedCurves
|
|
{
|
|
// Token: 0x0600AFCE RID: 45006 RVA: 0x0029263C File Offset: 0x0029083C
|
|
[Token(Token = "0x600AFCE")]
|
|
[Address(RVA = "0x518E70", Offset = "0x517870", VA = "0x180518E70")]
|
|
private static ECCurve ConfigureCurve(ECCurve curve)
|
|
{
|
|
return curve;
|
|
}
|
|
|
|
// Token: 0x0600AFCF RID: 45007 RVA: 0x0029264C File Offset: 0x0029084C
|
|
[Token(Token = "0x600AFCF")]
|
|
[Address(RVA = "0x2673FB0", Offset = "0x26729B0", VA = "0x182673FB0")]
|
|
private static BigInteger FromHex(string hex)
|
|
{
|
|
byte[] array = Hex.Decode(hex);
|
|
return new BigInteger(1, array);
|
|
}
|
|
|
|
// Token: 0x0600AFD0 RID: 45008 RVA: 0x00292668 File Offset: 0x00290868
|
|
[Token(Token = "0x600AFD0")]
|
|
[Address(RVA = "0x2673E70", Offset = "0x2672870", VA = "0x182673E70")]
|
|
private static void DefineCurve(string name, DerObjectIdentifier oid, X9ECParametersHolder holder)
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.objIds;
|
|
string text = Platform.ToUpperInvariant(name);
|
|
IDictionary dictionary2 = AnssiNamedCurves.names;
|
|
IDictionary dictionary3 = AnssiNamedCurves.curves;
|
|
}
|
|
|
|
// Token: 0x0600AFD1 RID: 45009 RVA: 0x00292694 File Offset: 0x00290894
|
|
[Token(Token = "0x600AFD1")]
|
|
[Address(RVA = "0x2674500", Offset = "0x2672F00", VA = "0x182674500")]
|
|
static AnssiNamedCurves()
|
|
{
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
AnssiNamedCurves.objIds = dictionary;
|
|
IDictionary dictionary2 = Platform.CreateHashtable();
|
|
AnssiNamedCurves.curves = dictionary2;
|
|
AnssiNamedCurves.names = Platform.CreateHashtable();
|
|
IDictionary dictionary3 = AnssiNamedCurves.objIds;
|
|
string text = Platform.ToUpperInvariant("FRP256v1");
|
|
IDictionary dictionary4 = AnssiNamedCurves.names;
|
|
IDictionary dictionary5 = AnssiNamedCurves.curves;
|
|
}
|
|
|
|
// Token: 0x0600AFD2 RID: 45010 RVA: 0x002926F4 File Offset: 0x002908F4
|
|
[Token(Token = "0x600AFD2")]
|
|
[Address(RVA = "0x2674040", Offset = "0x2672A40", VA = "0x182674040")]
|
|
public static X9ECParameters GetByName(string name)
|
|
{
|
|
string text;
|
|
do
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.objIds;
|
|
text = Platform.ToUpperInvariant(name);
|
|
if (text == 0)
|
|
{
|
|
goto IL_2A;
|
|
}
|
|
}
|
|
while (text == 0);
|
|
IDictionary dictionary2 = AnssiNamedCurves.curves;
|
|
IDictionary dictionary3 = AnssiNamedCurves.objIds;
|
|
IL_2A:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600AFD3 RID: 45011 RVA: 0x00292734 File Offset: 0x00290934
|
|
[Token(Token = "0x600AFD3")]
|
|
[Address(RVA = "0x2674280", Offset = "0x2672C80", VA = "0x182674280")]
|
|
public static X9ECParameters GetByOid(DerObjectIdentifier oid)
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.curves;
|
|
IDictionary dictionary2 = AnssiNamedCurves.objIds;
|
|
X9ECParameters x9ECParameters;
|
|
return x9ECParameters;
|
|
}
|
|
|
|
// Token: 0x0600AFD4 RID: 45012 RVA: 0x0029275C File Offset: 0x0029095C
|
|
[Token(Token = "0x600AFD4")]
|
|
[Address(RVA = "0x2674400", Offset = "0x2672E00", VA = "0x182674400")]
|
|
public static DerObjectIdentifier GetOid(string name)
|
|
{
|
|
string text;
|
|
do
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.objIds;
|
|
text = Platform.ToUpperInvariant(name);
|
|
if (text == 0)
|
|
{
|
|
}
|
|
}
|
|
while (text == 0);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600AFD5 RID: 45013 RVA: 0x00292788 File Offset: 0x00290988
|
|
[Token(Token = "0x600AFD5")]
|
|
[Address(RVA = "0x2674360", Offset = "0x2672D60", VA = "0x182674360")]
|
|
public static string GetName(DerObjectIdentifier oid)
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.names;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x17001C59 RID: 7257
|
|
// (get) Token: 0x0600AFD6 RID: 45014 RVA: 0x002927A0 File Offset: 0x002909A0
|
|
[Token(Token = "0x17001C59")]
|
|
public static IEnumerable Names
|
|
{
|
|
[Token(Token = "0x600AFD6")]
|
|
[Address(RVA = "0x2674720", Offset = "0x2673120", VA = "0x182674720")]
|
|
get
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.names;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AFD7 RID: 45015 RVA: 0x002927B8 File Offset: 0x002909B8
|
|
[Token(Token = "0x600AFD7")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public AnssiNamedCurves()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040073AF RID: 29615
|
|
[Token(Token = "0x40073AF")]
|
|
private static readonly IDictionary objIds;
|
|
|
|
// Token: 0x040073B0 RID: 29616
|
|
[Token(Token = "0x40073B0")]
|
|
private static readonly IDictionary curves;
|
|
|
|
// Token: 0x040073B1 RID: 29617
|
|
[Token(Token = "0x40073B1")]
|
|
private static readonly IDictionary names;
|
|
|
|
// Token: 0x02001995 RID: 6549
|
|
[Token(Token = "0x2001995")]
|
|
internal class Frp256v1Holder : X9ECParametersHolder
|
|
{
|
|
// Token: 0x0600AFD8 RID: 45016 RVA: 0x002927CC File Offset: 0x002909CC
|
|
[Token(Token = "0x600AFD8")]
|
|
[Address(RVA = "0x3D4170", Offset = "0x3D2B70", VA = "0x1803D4170")]
|
|
private Frp256v1Holder()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600AFD9 RID: 45017 RVA: 0x002927E0 File Offset: 0x002909E0
|
|
[Token(Token = "0x600AFD9")]
|
|
[Address(RVA = "0x26850C0", Offset = "0x2683AC0", VA = "0x1826850C0", Slot = "4")]
|
|
protected override X9ECParameters CreateParameters()
|
|
{
|
|
BigInteger bigInteger = AnssiNamedCurves.FromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C03");
|
|
BigInteger bigInteger2 = AnssiNamedCurves.FromHex("F1FD178C0B3AD58F10126DE8CE42435B3961ADBCABC8CA6DE8FCF353D86E9C00");
|
|
BigInteger bigInteger3 = AnssiNamedCurves.FromHex("EE353FCA5428A9300D4ABA754A44C00FDFEC0C9AE4B1A1803075ED967B7BB73F");
|
|
BigInteger bigInteger4 = AnssiNamedCurves.FromHex("F1FD178C0B3AD58F10126DE8CE42435B53DC67E140D2BF941FFDD459C6D655E1");
|
|
BigInteger one = BigInteger.One;
|
|
FpCurve fpCurve = new FpCurve(bigInteger, bigInteger2, bigInteger3, bigInteger4, one);
|
|
byte[] array = Hex.Decode("04B6B3D4C356C139EB31183D4749D423958C27D2DCAF98B70164C97A2DD98F5CFF6142E0F7C8B204911F9271F0F3ECEF8C2701C307E8E4C9E183115A1554062CFB");
|
|
X9ECPoint x9ECPoint = new X9ECPoint(fpCurve, array);
|
|
X9ECParameters x9ECParameters;
|
|
return x9ECParameters;
|
|
}
|
|
|
|
// Token: 0x0600AFDA RID: 45018 RVA: 0x00292848 File Offset: 0x00290A48
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600AFDA")]
|
|
[Address(RVA = "0x2685260", Offset = "0x2683C60", VA = "0x182685260")]
|
|
static Frp256v1Holder()
|
|
{
|
|
AnssiNamedCurves.Frp256v1Holder frp256v1Holder = new AnssiNamedCurves.Frp256v1Holder();
|
|
}
|
|
|
|
// Token: 0x040073B2 RID: 29618
|
|
[Token(Token = "0x40073B2")]
|
|
internal static readonly X9ECParametersHolder Instance;
|
|
}
|
|
}
|
|
}
|