This commit is contained in:
niko
2026-04-11 22:19:20 +02:00
parent 45b857ff11
commit 8fc35183db
17034 changed files with 2863552 additions and 0 deletions
@@ -0,0 +1,455 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001BD3 RID: 7123
[Token(Token = "0x2001BD3")]
public class CtrSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B210 RID: 45584 RVA: 0x0026C6E0 File Offset: 0x0026A8E0
[Token(Token = "0x600B210")]
[Address(RVA = "0x1801DA0", Offset = "0x1800BA0", VA = "0x181801DA0")]
public CtrSP800Drbg(IBlockCipher engine, int keySizeInBits, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
if (!this.IsTdea(engine) || keySizeInBits == 168)
{
}
this.mEntropySource = 0;
this.mEngine = engine;
this.mKeySizeInBits = keySizeInBits;
this.mSecurityStrength = securityStrength;
this.mSeedLength = (int)((uint)2);
bool flag = this.IsTdea(engine);
this.mIsTdea = flag;
byte[] entropy = this.GetEntropy();
}
// Token: 0x0600B211 RID: 45585 RVA: 0x0026C74C File Offset: 0x0026A94C
[Token(Token = "0x600B211")]
[Address(RVA = "0x1800A50", Offset = "0x17FF850", VA = "0x181800A50")]
private void CTR_DRBG_Instantiate_algorithm(byte[] entropy, byte[] nonce, byte[] personalisationString)
{
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
if (nonce != 0)
{
}
array[1] = nonce;
if (personalisationString != 0)
{
}
array[2] = personalisationString;
byte[] array2 = Arrays.ConcatenateAll(array);
int num = this.mSeedLength;
byte[] array3 = this.Block_Cipher_df(array2, num);
IBlockCipher blockCipher = this.mEngine;
int num2 = this.mKeySizeInBits;
num2 += 7;
byte[] array4 = new byte[0];
this.mKey = array4;
byte[] array5 = new byte[array3];
byte[] array6 = this.mKey;
this.mV = array5;
this.CTR_DRBG_Update(array3, array6, array5);
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B212 RID: 45586 RVA: 0x0026C7F8 File Offset: 0x0026A9F8
[Token(Token = "0x600B212")]
[Address(RVA = "0x1800D20", Offset = "0x17FFB20", VA = "0x181800D20")]
private void CTR_DRBG_Update(byte[] seed, byte[] key, byte[] v)
{
byte[] array = new byte[seed.Length];
IBlockCipher blockCipher = this.mEngine;
byte[] array2 = new byte[array];
IBlockCipher blockCipher2 = this.mEngine;
IBlockCipher blockCipher3 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(key));
int num = 0;
int num6;
if (num < seed.Length)
{
int num2 = v.Length;
uint num3;
num2 -= (int)num3;
byte b;
num3 += (uint)b;
IBlockCipher blockCipher4 = this.mEngine;
if (num < num2)
{
num += num;
num++;
}
int num4 = array.Length;
num4 -= num;
int num5 = 0;
num += array2;
num6 = 0;
num5 += num5;
num += 4;
num += 19;
}
int length = array.Length;
if (num6 < length)
{
num6++;
}
int num7 = 0;
int length2 = v.Length;
int num8 = 0;
Array.Copy(array, num7, v, num8, length2);
}
// Token: 0x0600B213 RID: 45587 RVA: 0x0026C8E0 File Offset: 0x0026AAE0
[Token(Token = "0x600B213")]
[Address(RVA = "0x1800C70", Offset = "0x17FFA70", VA = "0x181800C70")]
private void CTR_DRBG_Reseed_algorithm(byte[] additionalInput)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num = this.mSeedLength;
byte[] array2 = this.Block_Cipher_df(array, num);
byte[] array3 = this.mV;
byte[] array4 = this.mKey;
this.CTR_DRBG_Update(array2, array4, array3);
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B214 RID: 45588 RVA: 0x0026C92C File Offset: 0x0026AB2C
[Token(Token = "0x600B214")]
[Address(RVA = "0x1801C40", Offset = "0x1800A40", VA = "0x181801C40")]
private void XOR(byte[] output, byte[] a, byte[] b, int bOff)
{
int num = 0;
int length = output.Length;
if (num < length)
{
num++;
}
}
// Token: 0x0600B215 RID: 45589 RVA: 0x0026C950 File Offset: 0x0026AB50
[Token(Token = "0x600B215")]
[Address(RVA = "0x1800220", Offset = "0x17FF020", VA = "0x181800220")]
private void AddOneTo(byte[] longer)
{
int num = longer.Length;
uint num2;
num -= (int)num2;
byte b;
num2 += (uint)b;
}
// Token: 0x0600B216 RID: 45590 RVA: 0x0026C974 File Offset: 0x0026AB74
[Token(Token = "0x600B216")]
[Address(RVA = "0x18015A0", Offset = "0x18003A0", VA = "0x1818015A0")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x0600B217 RID: 45591 RVA: 0x0026C9A0 File Offset: 0x0026ABA0
[Token(Token = "0x600B217")]
[Address(RVA = "0x1800570", Offset = "0x17FF370", VA = "0x181800570")]
private byte[] Block_Cipher_df(byte[] inputString, int bitLength)
{
IBlockCipher blockCipher = this.mEngine;
int length = inputString.Length;
byte[] array = new byte[0];
int num = 0;
int num2 = 0;
this.copyIntToByteArray(array, length, num2);
this.copyIntToByteArray(array, length, 4);
int num3 = 0;
Array.Copy(inputString, num3, array, 8, length);
int num4 = this.mKeySizeInBits;
num3 += num4;
byte[] array2 = new byte[num3];
byte[] array3 = new byte[num3];
byte[] array4 = new byte[num3];
int num5 = this.mKeySizeInBits;
num3 += num5;
byte[] array5 = new byte[num3];
int num6 = 0;
int length2 = array5.Length;
int num7 = 0;
byte[] k_BITS = CtrSP800Drbg.K_BITS;
Array.Copy(k_BITS, num7, array5, num6, length2);
int num9;
if (k_BITS > 0)
{
array4[0] = (byte)num;
array4[0] = (byte)num;
array4[0] = (byte)num;
array4[0] = (byte)num;
this.BCC(array3, array5, array4, array);
int num8 = array2.Length;
num8 -= num;
num9 = 0;
Array.Copy(array3, num9, array2, num, num8);
int num10 = this.mKeySizeInBits;
num += num9;
num10 += num9;
num++;
}
byte[] array6 = new byte[num9];
int length3 = array5.Length;
int num11 = 0;
int num12 = 0;
Array.Copy(array2, num12, array5, num11, length3);
int length4 = array6.Length;
int num13 = 0;
int length5 = array5.Length;
Array.Copy(array2, length5, array6, num13, length4);
byte[] array7 = new byte[0];
IBlockCipher blockCipher2 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(array5));
int num14 = 0;
if (num14 < array7.Length)
{
IBlockCipher blockCipher3 = this.mEngine;
if (num14 < blockCipher2)
{
num14 += num14;
num14++;
}
int num15 = array7.Length;
num15 -= num14;
int num16 = 0;
Array.Copy(array6, num16, array7, num14, num15);
num16 += num16;
num14 += 4;
num14 += 19;
}
return array7;
}
// Token: 0x0600B218 RID: 45592 RVA: 0x0026CB94 File Offset: 0x0026AD94
[Token(Token = "0x600B218")]
[Address(RVA = "0x1800280", Offset = "0x17FF080", VA = "0x181800280")]
private void BCC(byte[] bccOut, byte[] k, byte[] iV, byte[] data)
{
IBlockCipher blockCipher = this.mEngine;
byte[] array = new byte[0];
byte[] array2 = new byte[0];
IBlockCipher blockCipher2 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(k));
IBlockCipher blockCipher3 = this.mEngine;
int num = 0;
int length = array2.Length;
if (num < length)
{
num++;
}
IBlockCipher blockCipher4 = this.mEngine;
int num2 = 0;
if (num2 < num)
{
num2 += num2;
num2++;
}
num++;
}
// Token: 0x0600B219 RID: 45593 RVA: 0x0026CC24 File Offset: 0x0026AE24
[Token(Token = "0x600B219")]
[Address(RVA = "0x1801FD0", Offset = "0x1800DD0", VA = "0x181801FD0")]
private void copyIntToByteArray(byte[] buf, int value, int offSet)
{
int num = offSet + 1;
}
// Token: 0x17001BF5 RID: 7157
// (get) Token: 0x0600B21A RID: 45594 RVA: 0x0026CC3C File Offset: 0x0026AE3C
[Token(Token = "0x17001BF5")]
public int BlockSize
{
[Token(Token = "0x600B21A")]
[Address(RVA = "0x1802070", Offset = "0x1800E70", VA = "0x181802070", Slot = "4")]
get
{
return this.mV.Length;
}
}
// Token: 0x0600B21B RID: 45595 RVA: 0x0026CC5C File Offset: 0x0026AE5C
[Token(Token = "0x600B21B")]
[Address(RVA = "0x1801100", Offset = "0x17FFF00", VA = "0x181801100", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
/*
An exception occurred when decompiling this method (0600B21B)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg.CtrSP800Drbg::Generate(System.Byte[],System.Byte[],System.Boolean)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_146:
stloc:ArgumentException(var_25_15C, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string[exp:object]("Number of bits per request limited to "), ldloc:ArgumentException[exp:object](var_24)), ldstr:string("output")))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1660
*/;
}
// Token: 0x0600B21C RID: 45596 RVA: 0x0026CDC8 File Offset: 0x0026AFC8
[Token(Token = "0x600B21C")]
[Address(RVA = "0x1801C30", Offset = "0x1800A30", VA = "0x181801C30", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
this.CTR_DRBG_Reseed_algorithm(additionalInput);
}
// Token: 0x0600B21D RID: 45597 RVA: 0x0026CDDC File Offset: 0x0026AFDC
[Token(Token = "0x600B21D")]
[Address(RVA = "0x18016F0", Offset = "0x18004F0", VA = "0x1818016F0")]
private bool IsTdea(IBlockCipher cipher)
{
bool flag;
bool flag2;
return flag || flag2;
}
// Token: 0x0600B21E RID: 45598 RVA: 0x0026CDF8 File Offset: 0x0026AFF8
[Token(Token = "0x600B21E")]
[Address(RVA = "0x1801640", Offset = "0x1800440", VA = "0x181801640")]
private int GetMaxSecurityStrength(IBlockCipher cipher, int keySizeInBits)
{
if (!this.IsTdea(cipher) || keySizeInBits == 168)
{
}
return -1;
}
// Token: 0x0600B21F RID: 45599 RVA: 0x0026CE20 File Offset: 0x0026B020
[Token(Token = "0x600B21F")]
[Address(RVA = "0x1801030", Offset = "0x17FFE30", VA = "0x181801030")]
private byte[] ExpandKey(byte[] key)
{
if (!this.mIsTdea)
{
return key;
}
byte[] array = new byte[24];
int num = 0;
int num2 = 0;
this.PadKey(key, num2, array, num);
ulong num3;
this.PadKey(key, 7, array, (int)num3);
ulong num4;
this.PadKey(key, 14, array, (int)num4);
return array;
}
// Token: 0x0600B220 RID: 45600 RVA: 0x0026CE68 File Offset: 0x0026B068
[Token(Token = "0x600B220")]
[Address(RVA = "0x1801780", Offset = "0x1800580", VA = "0x181801780")]
private void PadKey(byte[] keyMaster, int keyOff, byte[] tmp, int tmpOff)
{
int length = keyMaster.Length;
int num = keyOff + 1;
byte b;
tmp[0] = b;
int length2 = keyMaster.Length;
byte b2;
tmp[0] = b2;
int length3 = keyMaster.Length;
byte b3;
tmp[0] = b3;
int length4 = keyMaster.Length;
byte b4;
tmp[0] = b4;
int length5 = keyMaster.Length;
byte b5;
tmp[0] = b5;
int length6 = keyMaster.Length;
byte b6;
b6 += b6;
int length7 = tmp.Length;
int length8 = tmp.Length;
byte b7;
tmp[0] = b7;
}
// Token: 0x04007173 RID: 29043
[Token(Token = "0x4007173")]
private static readonly long TDEA_RESEED_MAX = (long)((uint)int.MinValue);
// Token: 0x04007174 RID: 29044
[Token(Token = "0x4007174")]
private static readonly long AES_RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x04007175 RID: 29045
[Token(Token = "0x4007175")]
private static readonly int TDEA_MAX_BITS_REQUEST;
// Token: 0x04007176 RID: 29046
[Token(Token = "0x4007176")]
private static readonly int AES_MAX_BITS_REQUEST;
// Token: 0x04007177 RID: 29047
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007177")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007178 RID: 29048
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007178")]
private readonly IBlockCipher mEngine;
// Token: 0x04007179 RID: 29049
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007179")]
private readonly int mKeySizeInBits;
// Token: 0x0400717A RID: 29050
[FieldOffset(Offset = "0x24")]
[Token(Token = "0x400717A")]
private readonly int mSeedLength;
// Token: 0x0400717B RID: 29051
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x400717B")]
private readonly int mSecurityStrength;
// Token: 0x0400717C RID: 29052
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x400717C")]
private byte[] mKey;
// Token: 0x0400717D RID: 29053
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x400717D")]
private byte[] mV;
// Token: 0x0400717E RID: 29054
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x400717E")]
private long mReseedCounter;
// Token: 0x0400717F RID: 29055
[FieldOffset(Offset = "0x48")]
[Token(Token = "0x400717F")]
private bool mIsTdea;
// Token: 0x04007180 RID: 29056
[Token(Token = "0x4007180")]
private static readonly byte[] K_BITS = Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F");
}
}
@@ -0,0 +1,129 @@
using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001BD4 RID: 7124
[Token(Token = "0x2001BD4")]
internal class DrbgUtilities
{
// Token: 0x0600B222 RID: 45602 RVA: 0x0026CF34 File Offset: 0x0026B134
[Token(Token = "0x600B222")]
[Address(RVA = "0x1891A10", Offset = "0x1890810", VA = "0x181891A10")]
static DrbgUtilities()
{
IDictionary dictionary = Platform.CreateHashtable();
}
// Token: 0x0600B223 RID: 45603 RVA: 0x0026CF50 File Offset: 0x0026B150
[Token(Token = "0x600B223")]
[Address(RVA = "0x18912C0", Offset = "0x18900C0", VA = "0x1818912C0")]
internal static int GetMaxSecurityStrength(IDigest d)
{
throw new NullReferenceException();
}
// Token: 0x0600B224 RID: 45604 RVA: 0x0026CF64 File Offset: 0x0026B164
[Token(Token = "0x600B224")]
[Address(RVA = "0x1891390", Offset = "0x1890190", VA = "0x181891390")]
internal static int GetMaxSecurityStrength(IMac m)
{
throw new NullReferenceException();
}
// Token: 0x0600B225 RID: 45605 RVA: 0x0026CF80 File Offset: 0x0026B180
[Token(Token = "0x600B225")]
[Address(RVA = "0x1891490", Offset = "0x1890290", VA = "0x181891490")]
internal static byte[] HashDF(IDigest digest, byte[] seedMaterial, int seedLength)
{
byte[] array = new byte[seedMaterial];
byte[] array2 = new byte[array.Length];
int num = 0;
if (num < digest)
{
num += num;
num++;
}
num += num;
num++;
num += num;
num++;
num += num;
num++;
num += num;
num++;
int num2 = seedMaterial.Length;
uint num3;
if (num < (int)num3)
{
num += num;
num++;
}
if (num < num2)
{
num += num;
num++;
}
int num4 = array2.Length;
num2 = num4;
int num5 = array.Length;
num5 -= num2;
if (num5 <= num4)
{
num4 = num5;
}
int num6 = 0;
Array.Copy(array2, num6, array, num2, num4);
if (seedLength != 0)
{
uint num7;
num7 -= (uint)seedLength;
int length = array.Length;
if (num != length)
{
num++;
byte b;
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
}
}
return array;
}
// Token: 0x0600B226 RID: 45606 RVA: 0x0026D0A4 File Offset: 0x0026B2A4
[Token(Token = "0x600B226")]
[Address(RVA = "0x1891A00", Offset = "0x1890800", VA = "0x181891A00")]
internal static bool IsTooLarge(byte[] bytes, int maxBytes)
{
if (bytes == 0)
{
}
return bytes.Length > maxBytes;
}
// Token: 0x0600B227 RID: 45607 RVA: 0x0026D0C0 File Offset: 0x0026B2C0
[Token(Token = "0x600B227")]
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
public DrbgUtilities()
{
}
// Token: 0x04007181 RID: 29057
[Token(Token = "0x4007181")]
private static readonly IDictionary maxSecurityStrengths;
}
}
@@ -0,0 +1,238 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001BD5 RID: 7125
[Token(Token = "0x2001BD5")]
public class HMacSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B228 RID: 45608 RVA: 0x0026D0D4 File Offset: 0x0026B2D4
[Token(Token = "0x600B228")]
[Address(RVA = "0x1899760", Offset = "0x1898560", VA = "0x181899760")]
public HMacSP800Drbg(IMac hMac, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
this.mHMac = hMac;
this.mSecurityStrength = securityStrength;
this.mEntropySource = entropySource;
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
byte[] array2 = Arrays.ConcatenateAll(array);
byte[] array3 = new byte[array2];
this.mK = array3;
byte[] array4 = new byte[array3.Length];
this.mV = array4;
int num = 0;
this.hmac_DRBG_Update_Func(array2, (byte)num);
if (array2 != 0)
{
}
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B229 RID: 45609 RVA: 0x0026D170 File Offset: 0x0026B370
[Token(Token = "0x600B229")]
[Address(RVA = "0x1899D30", Offset = "0x1898B30", VA = "0x181899D30")]
private void hmac_DRBG_Update(byte[] seedMaterial)
{
int num = 0;
this.hmac_DRBG_Update_Func(seedMaterial, (byte)num);
if (seedMaterial != 0)
{
}
}
// Token: 0x0600B22A RID: 45610 RVA: 0x0026D18C File Offset: 0x0026B38C
[Token(Token = "0x600B22A")]
[Address(RVA = "0x1899B40", Offset = "0x1898940", VA = "0x181899B40")]
private void hmac_DRBG_Update_Func(byte[] seedMaterial, byte vValue)
{
IMac mac = this.mHMac;
KeyParameter keyParameter = new KeyParameter(this.mK);
byte[] array = this.mV;
IMac mac2 = this.mHMac;
int length = array.Length;
IMac mac3 = this.mHMac;
if (seedMaterial != 0)
{
IMac mac4 = this.mHMac;
int length2 = seedMaterial.Length;
}
IMac mac5 = this.mHMac;
IMac mac6 = this.mHMac;
KeyParameter keyParameter2 = new KeyParameter(this.mK);
byte[] array2 = this.mV;
IMac mac7 = this.mHMac;
int length3 = array2.Length;
IMac mac8 = this.mHMac;
}
// Token: 0x17001BF6 RID: 7158
// (get) Token: 0x0600B22B RID: 45611 RVA: 0x0026D228 File Offset: 0x0026B428
[Token(Token = "0x17001BF6")]
public int BlockSize
{
[Token(Token = "0x600B22B")]
[Address(RVA = "0x1899B20", Offset = "0x1898920", VA = "0x181899B20", Slot = "4")]
get
{
return this.mV.Length;
}
}
// Token: 0x0600B22C RID: 45612 RVA: 0x0026D248 File Offset: 0x0026B448
[Token(Token = "0x600B22C")]
[Address(RVA = "0x1899070", Offset = "0x1897E70", VA = "0x181899070", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
int length = output.Length;
long num = this.mReseedCounter;
if (predictionResistant)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num2 = 0;
this.hmac_DRBG_Update_Func(array, (byte)num2);
if (array != 0)
{
ulong num3;
this.hmac_DRBG_Update_Func(array, (byte)num3);
}
this.mReseedCounter = (long)((ulong)1L);
}
if (additionalInput != 0)
{
int num4 = 0;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num4);
ulong num5;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num5);
}
byte[] array2 = new byte[output.Length];
byte[] array3 = this.mV;
int length2 = output.Length;
IMac mac = this.mHMac;
KeyParameter keyParameter = new KeyParameter(this.mK);
int num6 = 0;
int num10;
if (length2 > 0)
{
byte[] array4 = this.mV;
IMac mac2 = this.mHMac;
int num7 = 0;
if (num7 < mac)
{
num7 += num7;
num7++;
}
int num8 = 0;
IMac mac3 = this.mHMac;
int num9 = 0;
if (num9 < num8)
{
num9 += num9;
num9++;
}
byte[] array5 = this.mV;
num10 = array5.Length;
int num11 = num10 * num6;
int num12 = 0;
Array.Copy(array5, num12, array2, num11, num10);
num6++;
}
num10 = this.mV.Length;
if (num10 * length2 < array2.Length)
{
IMac mac4 = this.mHMac;
IMac mac5 = this.mHMac;
byte[] array6 = this.mV;
int length3 = array6.Length;
int num13 = array2.Length;
int num14 = 0;
int num15 = length3 * length2;
num13 -= num15;
Array.Copy(array6, num14, array2, num15, num13);
}
int num16 = 0;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num16);
if (additionalInput != 0)
{
ulong num17;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num17);
}
int num18 = 0;
int length4 = output.Length;
int num19 = 0;
Array.Copy(array2, num19, output, num18, length4);
return length;
}
// Token: 0x0600B22D RID: 45613 RVA: 0x0026D418 File Offset: 0x0026B618
[Token(Token = "0x600B22D")]
[Address(RVA = "0x1899650", Offset = "0x1898450", VA = "0x181899650", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num = 0;
this.hmac_DRBG_Update_Func(array, (byte)num);
if (array != 0)
{
}
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B22E RID: 45614 RVA: 0x0026D44C File Offset: 0x0026B64C
[Token(Token = "0x600B22E")]
[Address(RVA = "0x18995B0", Offset = "0x18983B0", VA = "0x1818995B0")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x04007182 RID: 29058
[Token(Token = "0x4007182")]
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x04007183 RID: 29059
[Token(Token = "0x4007183")]
private static readonly int MAX_BITS_REQUEST;
// Token: 0x04007184 RID: 29060
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007184")]
private readonly byte[] mK;
// Token: 0x04007185 RID: 29061
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007185")]
private readonly byte[] mV;
// Token: 0x04007186 RID: 29062
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007186")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007187 RID: 29063
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007187")]
private readonly IMac mHMac;
// Token: 0x04007188 RID: 29064
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007188")]
private readonly int mSecurityStrength;
// Token: 0x04007189 RID: 29065
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007189")]
private long mReseedCounter;
}
}
@@ -0,0 +1,356 @@
using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001BD6 RID: 7126
[Token(Token = "0x2001BD6")]
public class HashSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B230 RID: 45616 RVA: 0x0026D494 File Offset: 0x0026B694
[Token(Token = "0x600B230")]
[Address(RVA = "0x189A910", Offset = "0x1899710", VA = "0x18189A910")]
static HashSP800Drbg()
{
IDictionary dictionary = HashSP800Drbg.seedlens;
IDictionary dictionary2 = HashSP800Drbg.seedlens;
IDictionary dictionary3 = HashSP800Drbg.seedlens;
IDictionary dictionary4 = HashSP800Drbg.seedlens;
IDictionary dictionary5 = HashSP800Drbg.seedlens;
IDictionary dictionary6 = HashSP800Drbg.seedlens;
IDictionary dictionary7 = HashSP800Drbg.seedlens;
}
// Token: 0x0600B231 RID: 45617 RVA: 0x0026D50C File Offset: 0x0026B70C
[Token(Token = "0x600B231")]
[Address(RVA = "0x189AC40", Offset = "0x1899A40", VA = "0x18189AC40")]
public HashSP800Drbg(IDigest digest, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
int num;
do
{
base..ctor();
this.mDigest = digest;
this.mEntropySource = entropySource;
this.mSecurityStrength = securityStrength;
IDictionary dictionary = HashSP800Drbg.seedlens;
num = 0;
}
while ("{il2cpp array field local12->}" != num);
byte[] one = HashSP800Drbg.ONE;
this.mSeedLength = one;
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
byte[] array2 = Arrays.ConcatenateAll(array);
IDigest digest2 = this.mDigest;
int num2 = this.mSeedLength;
byte[] array3 = DrbgUtilities.HashDF(digest2, array2, num2);
this.mV = array3;
int num3 = array3.Length;
num3++;
byte[] array4 = new byte[num3];
byte[] array5 = this.mV;
int length = array5.Length;
int num4 = 0;
Array.Copy(array5, num4, array4, 1, length);
int num5 = this.mSeedLength;
byte[] array6 = DrbgUtilities.HashDF(this.mDigest, array4, num5);
this.mC = array6;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x17001BF7 RID: 7159
// (get) Token: 0x0600B232 RID: 45618 RVA: 0x0026D60C File Offset: 0x0026B80C
[Token(Token = "0x17001BF7")]
public int BlockSize
{
[Token(Token = "0x600B232")]
[Address(RVA = "0x189B0A0", Offset = "0x1899EA0", VA = "0x18189B0A0", Slot = "4")]
get
{
IDigest digest = this.mDigest;
throw new NullReferenceException();
}
}
// Token: 0x0600B233 RID: 45619 RVA: 0x0026D628 File Offset: 0x0026B828
[Token(Token = "0x600B233")]
[Address(RVA = "0x1899FA0", Offset = "0x1898DA0", VA = "0x181899FA0", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
int length = output.Length;
long num = this.mReseedCounter;
if (predictionResistant)
{
this.Reseed(additionalInput);
}
if (additionalInput != 0)
{
byte[] array = this.mV;
int num2 = additionalInput.Length;
num2++;
byte[] array2 = new byte[num2];
array2[0] = (byte)((ulong)2L);
byte[] array3 = this.mV;
int length2 = array3.Length;
int num3 = 0;
uint num4;
Array.Copy(array3, num3, array2, (int)num4, length2);
int num5 = this.mV.Length;
int length3 = additionalInput.Length;
num5++;
int num6 = 0;
Array.Copy(additionalInput, num6, array2, num5, length3);
byte[] array4 = this.Hash(array2);
byte[] array5 = this.mV;
this.AddTo(array5, array4);
}
byte[] array6 = this.mV;
IDigest digest = this.mDigest;
byte[] array7 = new byte[array6.Length];
int length4 = array6.Length;
int num7 = 0;
int num8 = 0;
Array.Copy(array6, num8, array7, num7, length4);
byte[] array8 = new byte[additionalInput];
IDigest digest2 = this.mDigest;
byte[] array9 = new byte[array8];
int i = 0;
this.DoHash(array7, array9);
int num9 = array9.Length;
int num10 = array8.Length;
int num11 = i * num9;
num10 -= num11;
if (num10 <= num9)
{
num9 = num10;
}
int num12 = 0;
Array.Copy(array9, num12, array8, num11, num9);
byte[] one = HashSP800Drbg.ONE;
this.AddTo(array7, one);
i++;
while (i <= additionalInput)
{
}
int num13 = this.mV.Length;
num13++;
byte[] array10 = new byte[num13];
byte[] array11 = this.mV;
int length5 = array11.Length;
int num14 = 0;
Array.Copy(array11, num14, array10, 1, length5);
array10[0] = (byte)((ulong)3L);
byte[] array12 = this.Hash(array10);
byte[] array13 = this.mV;
this.AddTo(array13, array12);
byte[] array14 = this.mC;
byte[] array15 = this.mV;
this.AddTo(array15, array14);
byte[] array16 = new byte[0];
long num15 = this.mReseedCounter;
array16[0] = (byte)num15;
long num16 = this.mReseedCounter;
array16[0] = (byte)num16;
long num17 = this.mReseedCounter;
array16[0] = (byte)num17;
long num18 = this.mReseedCounter;
array16[0] = (byte)num18;
byte[] array17 = this.mV;
this.AddTo(array17, array16);
int num19 = 0;
int length6 = output.Length;
int num20 = 0;
Array.Copy(array8, num20, output, num19, length6);
return length;
}
// Token: 0x0600B234 RID: 45620 RVA: 0x0026D8B0 File Offset: 0x0026BAB0
[Token(Token = "0x600B234")]
[Address(RVA = "0x189A500", Offset = "0x1899300", VA = "0x18189A500")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x0600B235 RID: 45621 RVA: 0x0026D8DC File Offset: 0x0026BADC
[Token(Token = "0x600B235")]
[Address(RVA = "0x1899E10", Offset = "0x1898C10", VA = "0x181899E10")]
private void AddTo(byte[] longer, byte[] shorter)
{
int length = shorter.Length;
int num = 0;
int num2 = longer.Length;
int num3 = length - 1;
num2 -= length;
byte b;
num += (int)b;
byte b2;
num += (int)b2;
num3 = num2 - 1;
byte b3;
num += (int)b3;
}
// Token: 0x0600B236 RID: 45622 RVA: 0x0026D91C File Offset: 0x0026BB1C
[Token(Token = "0x600B236")]
[Address(RVA = "0x189A630", Offset = "0x1899430", VA = "0x18189A630", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[4][];
byte[] one = HashSP800Drbg.ONE;
if (one != 0)
{
}
array[0] = one;
byte[] array2 = this.mV;
if (array2 != 0)
{
}
array[1] = array2;
if (entropy != 0)
{
}
array[2] = entropy;
if (additionalInput != 0)
{
}
array[3] = additionalInput;
byte[] array3 = Arrays.ConcatenateAll(array);
IDigest digest = this.mDigest;
int num = this.mSeedLength;
byte[] array4 = DrbgUtilities.HashDF(digest, array3, num);
this.mV = array4;
int num2 = array4.Length;
num2++;
byte[] array5 = new byte[num2];
array5[0] = (byte)((ulong)0L);
byte[] array6 = this.mV;
int length = array6.Length;
int num3 = 0;
Array.Copy(array6, num3, array5, 1, length);
int num4 = this.mSeedLength;
byte[] array7 = DrbgUtilities.HashDF(this.mDigest, array5, num4);
this.mC = array7;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B237 RID: 45623 RVA: 0x0026DA18 File Offset: 0x0026BC18
[Token(Token = "0x600B237")]
[Address(RVA = "0x189A5A0", Offset = "0x18993A0", VA = "0x18189A5A0")]
private byte[] Hash(byte[] input)
{
IDigest digest = this.mDigest;
byte[] array = new byte[0];
this.DoHash(input, array);
return array;
}
// Token: 0x0600B238 RID: 45624 RVA: 0x0026DA44 File Offset: 0x0026BC44
[Token(Token = "0x600B238")]
[Address(RVA = "0x1899F00", Offset = "0x1898D00", VA = "0x181899F00")]
private void DoHash(byte[] input, byte[] output)
{
IDigest digest = this.mDigest;
int length = input.Length;
IDigest digest2 = this.mDigest;
}
// Token: 0x0600B239 RID: 45625 RVA: 0x0026DA6C File Offset: 0x0026BC6C
[Token(Token = "0x600B239")]
[Address(RVA = "0x189B0F0", Offset = "0x1899EF0", VA = "0x18189B0F0")]
private byte[] hashgen(byte[] input, int lengthInBits)
{
IDigest digest = this.mDigest;
byte[] array = new byte[input.Length];
int length = input.Length;
int i = 0;
int num = 0;
int num2 = 0;
Array.Copy(input, num2, array, num, length);
byte[] array2 = new byte[lengthInBits];
IDigest digest2 = this.mDigest;
byte[] array3 = new byte[array2];
this.DoHash(array, array3);
int num3 = array3.Length;
int num4 = array2.Length;
int num5 = num3 * i;
num4 -= num5;
if (num4 <= num3)
{
num3 = num4;
}
int num6 = 0;
Array.Copy(array3, num6, array2, num5, num3);
byte[] one = HashSP800Drbg.ONE;
this.AddTo(array, one);
i++;
while (i <= lengthInBits)
{
}
return array2;
}
// Token: 0x0400718A RID: 29066
[Token(Token = "0x400718A")]
private static readonly byte[] ONE = new byte[] { (byte)((ulong)1L) };
// Token: 0x0400718B RID: 29067
[Token(Token = "0x400718B")]
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x0400718C RID: 29068
[Token(Token = "0x400718C")]
private static readonly int MAX_BITS_REQUEST;
// Token: 0x0400718D RID: 29069
[Token(Token = "0x400718D")]
private static readonly IDictionary seedlens = Platform.CreateHashtable();
// Token: 0x0400718E RID: 29070
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400718E")]
private readonly IDigest mDigest;
// Token: 0x0400718F RID: 29071
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400718F")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007190 RID: 29072
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007190")]
private readonly int mSecurityStrength;
// Token: 0x04007191 RID: 29073
[FieldOffset(Offset = "0x24")]
[Token(Token = "0x4007191")]
private readonly int mSeedLength;
// Token: 0x04007192 RID: 29074
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007192")]
private byte[] mV;
// Token: 0x04007193 RID: 29075
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007193")]
private byte[] mC;
// Token: 0x04007194 RID: 29076
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007194")]
private long mReseedCounter;
}
}
@@ -0,0 +1,30 @@
using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001BD7 RID: 7127
[Token(Token = "0x2001BD7")]
public interface ISP80090Drbg
{
// Token: 0x17001BF8 RID: 7160
// (get) Token: 0x0600B23A RID: 45626
[Token(Token = "0x17001BF8")]
int BlockSize
{
[Token(Token = "0x600B23A")]
[Address(Slot = "0")]
get;
}
// Token: 0x0600B23B RID: 45627
[Token(Token = "0x600B23B")]
[Address(Slot = "1")]
int Generate(byte[] output, byte[] additionalInput, bool predictionResistant);
// Token: 0x0600B23C RID: 45628
[Token(Token = "0x600B23C")]
[Address(Slot = "2")]
void Reseed(byte[] additionalInput);
}
}