196 lines
6.9 KiB
C#
196 lines
6.9 KiB
C#
using System;
|
|
using System.Collections;
|
|
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: 0x02002051 RID: 8273
|
|
[Token(Token = "0x2002051")]
|
|
public class AnssiNamedCurves
|
|
{
|
|
// Token: 0x0600CF76 RID: 53110 RVA: 0x002F32EC File Offset: 0x002F14EC
|
|
[Token(Token = "0x600CF76")]
|
|
[Address(RVA = "0x4A65C0", Offset = "0x4A55C0", VA = "0x1804A65C0")]
|
|
private static ECCurve ConfigureCurve(ECCurve curve)
|
|
{
|
|
return curve;
|
|
}
|
|
|
|
// Token: 0x0600CF77 RID: 53111 RVA: 0x002F32FC File Offset: 0x002F14FC
|
|
[Token(Token = "0x600CF77")]
|
|
[Address(RVA = "0x228C6A0", Offset = "0x228B6A0", VA = "0x18228C6A0")]
|
|
private static BigInteger FromHex(string hex)
|
|
{
|
|
byte[] array = Hex.Decode(hex);
|
|
return new BigInteger(1, array);
|
|
}
|
|
|
|
// Token: 0x0600CF78 RID: 53112 RVA: 0x002F3318 File Offset: 0x002F1518
|
|
[Token(Token = "0x600CF78")]
|
|
[Address(RVA = "0x228C560", Offset = "0x228B560", VA = "0x18228C560")]
|
|
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: 0x0600CF79 RID: 53113 RVA: 0x002F3344 File Offset: 0x002F1544
|
|
[Token(Token = "0x600CF79")]
|
|
[Address(RVA = "0x228CBF0", Offset = "0x228BBF0", VA = "0x18228CBF0")]
|
|
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: 0x0600CF7A RID: 53114 RVA: 0x002F33A4 File Offset: 0x002F15A4
|
|
[Token(Token = "0x600CF7A")]
|
|
[Address(RVA = "0x228C730", Offset = "0x228B730", VA = "0x18228C730")]
|
|
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: 0x0600CF7B RID: 53115 RVA: 0x002F33E4 File Offset: 0x002F15E4
|
|
[Token(Token = "0x600CF7B")]
|
|
[Address(RVA = "0x228C970", Offset = "0x228B970", VA = "0x18228C970")]
|
|
public static X9ECParameters GetByOid(DerObjectIdentifier oid)
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.curves;
|
|
IDictionary dictionary2 = AnssiNamedCurves.objIds;
|
|
X9ECParameters x9ECParameters;
|
|
return x9ECParameters;
|
|
}
|
|
|
|
// Token: 0x0600CF7C RID: 53116 RVA: 0x002F340C File Offset: 0x002F160C
|
|
[Token(Token = "0x600CF7C")]
|
|
[Address(RVA = "0x228CAF0", Offset = "0x228BAF0", VA = "0x18228CAF0")]
|
|
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: 0x0600CF7D RID: 53117 RVA: 0x002F3438 File Offset: 0x002F1638
|
|
[Token(Token = "0x600CF7D")]
|
|
[Address(RVA = "0x228CA50", Offset = "0x228BA50", VA = "0x18228CA50")]
|
|
public static string GetName(DerObjectIdentifier oid)
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.names;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x170020F7 RID: 8439
|
|
// (get) Token: 0x0600CF7E RID: 53118 RVA: 0x002F3450 File Offset: 0x002F1650
|
|
[Token(Token = "0x170020F7")]
|
|
public static IEnumerable Names
|
|
{
|
|
[Token(Token = "0x600CF7E")]
|
|
[Address(RVA = "0x228CE10", Offset = "0x228BE10", VA = "0x18228CE10")]
|
|
get
|
|
{
|
|
IDictionary dictionary = AnssiNamedCurves.names;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600CF7F RID: 53119 RVA: 0x002F3468 File Offset: 0x002F1668
|
|
[Token(Token = "0x600CF7F")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public AnssiNamedCurves()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040083AB RID: 33707
|
|
[Token(Token = "0x40083AB")]
|
|
private static readonly IDictionary objIds;
|
|
|
|
// Token: 0x040083AC RID: 33708
|
|
[Token(Token = "0x40083AC")]
|
|
private static readonly IDictionary curves;
|
|
|
|
// Token: 0x040083AD RID: 33709
|
|
[Token(Token = "0x40083AD")]
|
|
private static readonly IDictionary names;
|
|
|
|
// Token: 0x02002052 RID: 8274
|
|
[Token(Token = "0x2002052")]
|
|
internal class Frp256v1Holder : X9ECParametersHolder
|
|
{
|
|
// Token: 0x0600CF80 RID: 53120 RVA: 0x002F347C File Offset: 0x002F167C
|
|
[Token(Token = "0x600CF80")]
|
|
[Address(RVA = "0x42BA20", Offset = "0x42AA20", VA = "0x18042BA20")]
|
|
private Frp256v1Holder()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600CF81 RID: 53121 RVA: 0x002F3490 File Offset: 0x002F1690
|
|
[Token(Token = "0x600CF81")]
|
|
[Address(RVA = "0x229B040", Offset = "0x229A040", VA = "0x18229B040", 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: 0x0600CF82 RID: 53122 RVA: 0x002F34F8 File Offset: 0x002F16F8
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600CF82")]
|
|
[Address(RVA = "0x229B1E0", Offset = "0x229A1E0", VA = "0x18229B1E0")]
|
|
static Frp256v1Holder()
|
|
{
|
|
AnssiNamedCurves.Frp256v1Holder frp256v1Holder = new AnssiNamedCurves.Frp256v1Holder();
|
|
}
|
|
|
|
// Token: 0x040083AE RID: 33710
|
|
[Token(Token = "0x40083AE")]
|
|
internal static readonly X9ECParametersHolder Instance;
|
|
}
|
|
}
|
|
}
|