scripts
This commit is contained in:
+457
@@ -0,0 +1,457 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
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: 0x020015F6 RID: 5622
|
||||
[Token(Token = "0x20015F6")]
|
||||
[StructLayout(3)]
|
||||
public class CtrSP800Drbg : ISP80090Drbg
|
||||
{
|
||||
// Token: 0x06009636 RID: 38454 RVA: 0x002150C0 File Offset: 0x002132C0
|
||||
[Token(Token = "0x6009636")]
|
||||
[Address(RVA = "0x1DD1150", Offset = "0x1DCFB50", VA = "0x181DD1150")]
|
||||
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: 0x06009637 RID: 38455 RVA: 0x0021512C File Offset: 0x0021332C
|
||||
[Token(Token = "0x6009637")]
|
||||
[Address(RVA = "0x1DCFE00", Offset = "0x1DCE800", VA = "0x181DCFE00")]
|
||||
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: 0x06009638 RID: 38456 RVA: 0x002151D8 File Offset: 0x002133D8
|
||||
[Token(Token = "0x6009638")]
|
||||
[Address(RVA = "0x1DD00D0", Offset = "0x1DCEAD0", VA = "0x181DD00D0")]
|
||||
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: 0x06009639 RID: 38457 RVA: 0x002152C0 File Offset: 0x002134C0
|
||||
[Token(Token = "0x6009639")]
|
||||
[Address(RVA = "0x1DD0020", Offset = "0x1DCEA20", VA = "0x181DD0020")]
|
||||
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: 0x0600963A RID: 38458 RVA: 0x0021530C File Offset: 0x0021350C
|
||||
[Token(Token = "0x600963A")]
|
||||
[Address(RVA = "0x1DD0FF0", Offset = "0x1DCF9F0", VA = "0x181DD0FF0")]
|
||||
private void XOR(byte[] output, byte[] a, byte[] b, int bOff)
|
||||
{
|
||||
int num = 0;
|
||||
int length = output.Length;
|
||||
if (num < length)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600963B RID: 38459 RVA: 0x00215330 File Offset: 0x00213530
|
||||
[Token(Token = "0x600963B")]
|
||||
[Address(RVA = "0x1DCF5D0", Offset = "0x1DCDFD0", VA = "0x181DCF5D0")]
|
||||
private void AddOneTo(byte[] longer)
|
||||
{
|
||||
int num = longer.Length;
|
||||
uint num2;
|
||||
num -= (int)num2;
|
||||
byte b;
|
||||
num2 += (uint)b;
|
||||
}
|
||||
|
||||
// Token: 0x0600963C RID: 38460 RVA: 0x00215354 File Offset: 0x00213554
|
||||
[Token(Token = "0x600963C")]
|
||||
[Address(RVA = "0x1DD0950", Offset = "0x1DCF350", VA = "0x181DD0950")]
|
||||
private byte[] GetEntropy()
|
||||
{
|
||||
IEntropySource entropySource = this.mEntropySource;
|
||||
int num = this.mSecurityStrength;
|
||||
num += 7;
|
||||
num += typeof(IEntropySource).TypeHandle;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600963D RID: 38461 RVA: 0x00215380 File Offset: 0x00213580
|
||||
[Token(Token = "0x600963D")]
|
||||
[Address(RVA = "0x1DCF920", Offset = "0x1DCE320", VA = "0x181DCF920")]
|
||||
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: 0x0600963E RID: 38462 RVA: 0x00215574 File Offset: 0x00213774
|
||||
[Token(Token = "0x600963E")]
|
||||
[Address(RVA = "0x1DCF630", Offset = "0x1DCE030", VA = "0x181DCF630")]
|
||||
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: 0x0600963F RID: 38463 RVA: 0x00215604 File Offset: 0x00213804
|
||||
[Token(Token = "0x600963F")]
|
||||
[Address(RVA = "0x1DD1380", Offset = "0x1DCFD80", VA = "0x181DD1380")]
|
||||
private void copyIntToByteArray(byte[] buf, int value, int offSet)
|
||||
{
|
||||
int num = offSet + 1;
|
||||
}
|
||||
|
||||
// Token: 0x170017F4 RID: 6132
|
||||
// (get) Token: 0x06009640 RID: 38464 RVA: 0x0021561C File Offset: 0x0021381C
|
||||
[Token(Token = "0x170017F4")]
|
||||
public int BlockSize
|
||||
{
|
||||
[Token(Token = "0x6009640")]
|
||||
[Address(RVA = "0x1DD1420", Offset = "0x1DCFE20", VA = "0x181DD1420", Slot = "4")]
|
||||
get
|
||||
{
|
||||
return this.mV.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06009641 RID: 38465 RVA: 0x0021563C File Offset: 0x0021383C
|
||||
[Token(Token = "0x6009641")]
|
||||
[Address(RVA = "0x1DD04B0", Offset = "0x1DCEEB0", VA = "0x181DD04B0", Slot = "5")]
|
||||
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009641)
|
||||
|
||||
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_26_15C, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string[exp:object]("Number of bits per request limited to "), ldloc:Camera[exp:object](var_25)), 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 1663
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x06009642 RID: 38466 RVA: 0x002157A8 File Offset: 0x002139A8
|
||||
[Token(Token = "0x6009642")]
|
||||
[Address(RVA = "0x1DD0FE0", Offset = "0x1DCF9E0", VA = "0x181DD0FE0", Slot = "6")]
|
||||
public void Reseed(byte[] additionalInput)
|
||||
{
|
||||
this.CTR_DRBG_Reseed_algorithm(additionalInput);
|
||||
}
|
||||
|
||||
// Token: 0x06009643 RID: 38467 RVA: 0x002157BC File Offset: 0x002139BC
|
||||
[Token(Token = "0x6009643")]
|
||||
[Address(RVA = "0x1DD0AA0", Offset = "0x1DCF4A0", VA = "0x181DD0AA0")]
|
||||
private bool IsTdea(IBlockCipher cipher)
|
||||
{
|
||||
bool flag;
|
||||
bool flag2;
|
||||
return flag || flag2;
|
||||
}
|
||||
|
||||
// Token: 0x06009644 RID: 38468 RVA: 0x002157D8 File Offset: 0x002139D8
|
||||
[Token(Token = "0x6009644")]
|
||||
[Address(RVA = "0x1DD09F0", Offset = "0x1DCF3F0", VA = "0x181DD09F0")]
|
||||
private int GetMaxSecurityStrength(IBlockCipher cipher, int keySizeInBits)
|
||||
{
|
||||
if (!this.IsTdea(cipher) || keySizeInBits == 168)
|
||||
{
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06009645 RID: 38469 RVA: 0x00215800 File Offset: 0x00213A00
|
||||
[Token(Token = "0x6009645")]
|
||||
[Address(RVA = "0x1DD03E0", Offset = "0x1DCEDE0", VA = "0x181DD03E0")]
|
||||
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: 0x06009646 RID: 38470 RVA: 0x00215848 File Offset: 0x00213A48
|
||||
[Token(Token = "0x6009646")]
|
||||
[Address(RVA = "0x1DD0B30", Offset = "0x1DCF530", VA = "0x181DD0B30")]
|
||||
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: 0x04006330 RID: 25392
|
||||
[Token(Token = "0x4006330")]
|
||||
private static readonly long TDEA_RESEED_MAX = (long)((uint)int.MinValue);
|
||||
|
||||
// Token: 0x04006331 RID: 25393
|
||||
[Token(Token = "0x4006331")]
|
||||
private static readonly long AES_RESEED_MAX = (long)((ulong)140737488355328L);
|
||||
|
||||
// Token: 0x04006332 RID: 25394
|
||||
[Token(Token = "0x4006332")]
|
||||
private static readonly int TDEA_MAX_BITS_REQUEST;
|
||||
|
||||
// Token: 0x04006333 RID: 25395
|
||||
[Token(Token = "0x4006333")]
|
||||
private static readonly int AES_MAX_BITS_REQUEST;
|
||||
|
||||
// Token: 0x04006334 RID: 25396
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006334")]
|
||||
private readonly IEntropySource mEntropySource;
|
||||
|
||||
// Token: 0x04006335 RID: 25397
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006335")]
|
||||
private readonly IBlockCipher mEngine;
|
||||
|
||||
// Token: 0x04006336 RID: 25398
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006336")]
|
||||
private readonly int mKeySizeInBits;
|
||||
|
||||
// Token: 0x04006337 RID: 25399
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x24")]
|
||||
[Token(Token = "0x4006337")]
|
||||
private readonly int mSeedLength;
|
||||
|
||||
// Token: 0x04006338 RID: 25400
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006338")]
|
||||
private readonly int mSecurityStrength;
|
||||
|
||||
// Token: 0x04006339 RID: 25401
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006339")]
|
||||
private byte[] mKey;
|
||||
|
||||
// Token: 0x0400633A RID: 25402
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x400633A")]
|
||||
private byte[] mV;
|
||||
|
||||
// Token: 0x0400633B RID: 25403
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
||||
[Token(Token = "0x400633B")]
|
||||
private long mReseedCounter;
|
||||
|
||||
// Token: 0x0400633C RID: 25404
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
||||
[Token(Token = "0x400633C")]
|
||||
private bool mIsTdea;
|
||||
|
||||
// Token: 0x0400633D RID: 25405
|
||||
[Token(Token = "0x400633D")]
|
||||
private static readonly byte[] K_BITS = Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F");
|
||||
}
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
|
||||
{
|
||||
// Token: 0x020015F7 RID: 5623
|
||||
[Token(Token = "0x20015F7")]
|
||||
[StructLayout(3)]
|
||||
internal class DrbgUtilities
|
||||
{
|
||||
// Token: 0x06009648 RID: 38472 RVA: 0x00215914 File Offset: 0x00213B14
|
||||
[Token(Token = "0x6009648")]
|
||||
[Address(RVA = "0x1E3A1F0", Offset = "0x1E38BF0", VA = "0x181E3A1F0")]
|
||||
static DrbgUtilities()
|
||||
{
|
||||
IDictionary dictionary = Platform.CreateHashtable();
|
||||
}
|
||||
|
||||
// Token: 0x06009649 RID: 38473 RVA: 0x00215930 File Offset: 0x00213B30
|
||||
[Token(Token = "0x6009649")]
|
||||
[Address(RVA = "0x1E39AA0", Offset = "0x1E384A0", VA = "0x181E39AA0")]
|
||||
internal static int GetMaxSecurityStrength(IDigest d)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600964A RID: 38474 RVA: 0x00215944 File Offset: 0x00213B44
|
||||
[Token(Token = "0x600964A")]
|
||||
[Address(RVA = "0x1E39B70", Offset = "0x1E38570", VA = "0x181E39B70")]
|
||||
internal static int GetMaxSecurityStrength(IMac m)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600964B RID: 38475 RVA: 0x00215960 File Offset: 0x00213B60
|
||||
[Token(Token = "0x600964B")]
|
||||
[Address(RVA = "0x1E39C70", Offset = "0x1E38670", VA = "0x181E39C70")]
|
||||
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: 0x0600964C RID: 38476 RVA: 0x00215A84 File Offset: 0x00213C84
|
||||
[Token(Token = "0x600964C")]
|
||||
[Address(RVA = "0x1E3A1E0", Offset = "0x1E38BE0", VA = "0x181E3A1E0")]
|
||||
internal static bool IsTooLarge(byte[] bytes, int maxBytes)
|
||||
{
|
||||
if (bytes == 0)
|
||||
{
|
||||
}
|
||||
return bytes.Length > maxBytes;
|
||||
}
|
||||
|
||||
// Token: 0x0600964D RID: 38477 RVA: 0x00215AA0 File Offset: 0x00213CA0
|
||||
[Token(Token = "0x600964D")]
|
||||
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
||||
public DrbgUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0400633E RID: 25406
|
||||
[Token(Token = "0x400633E")]
|
||||
private static readonly IDictionary maxSecurityStrengths;
|
||||
}
|
||||
}
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
|
||||
{
|
||||
// Token: 0x020015F8 RID: 5624
|
||||
[Token(Token = "0x20015F8")]
|
||||
[StructLayout(3)]
|
||||
public class HMacSP800Drbg : ISP80090Drbg
|
||||
{
|
||||
// Token: 0x0600964E RID: 38478 RVA: 0x00215AB4 File Offset: 0x00213CB4
|
||||
[Token(Token = "0x600964E")]
|
||||
[Address(RVA = "0x1E41E60", Offset = "0x1E40860", VA = "0x181E41E60")]
|
||||
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: 0x0600964F RID: 38479 RVA: 0x00215B50 File Offset: 0x00213D50
|
||||
[Token(Token = "0x600964F")]
|
||||
[Address(RVA = "0x1E42430", Offset = "0x1E40E30", VA = "0x181E42430")]
|
||||
private void hmac_DRBG_Update(byte[] seedMaterial)
|
||||
{
|
||||
int num = 0;
|
||||
this.hmac_DRBG_Update_Func(seedMaterial, (byte)num);
|
||||
if (seedMaterial != 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06009650 RID: 38480 RVA: 0x00215B6C File Offset: 0x00213D6C
|
||||
[Token(Token = "0x6009650")]
|
||||
[Address(RVA = "0x1E42240", Offset = "0x1E40C40", VA = "0x181E42240")]
|
||||
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: 0x170017F5 RID: 6133
|
||||
// (get) Token: 0x06009651 RID: 38481 RVA: 0x00215C08 File Offset: 0x00213E08
|
||||
[Token(Token = "0x170017F5")]
|
||||
public int BlockSize
|
||||
{
|
||||
[Token(Token = "0x6009651")]
|
||||
[Address(RVA = "0x1E42220", Offset = "0x1E40C20", VA = "0x181E42220", Slot = "4")]
|
||||
get
|
||||
{
|
||||
return this.mV.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06009652 RID: 38482 RVA: 0x00215C28 File Offset: 0x00213E28
|
||||
[Token(Token = "0x6009652")]
|
||||
[Address(RVA = "0x1E41770", Offset = "0x1E40170", VA = "0x181E41770", 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: 0x06009653 RID: 38483 RVA: 0x00215DF8 File Offset: 0x00213FF8
|
||||
[Token(Token = "0x6009653")]
|
||||
[Address(RVA = "0x1E41D50", Offset = "0x1E40750", VA = "0x181E41D50", 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: 0x06009654 RID: 38484 RVA: 0x00215E2C File Offset: 0x0021402C
|
||||
[Token(Token = "0x6009654")]
|
||||
[Address(RVA = "0x1E41CB0", Offset = "0x1E406B0", VA = "0x181E41CB0")]
|
||||
private byte[] GetEntropy()
|
||||
{
|
||||
IEntropySource entropySource = this.mEntropySource;
|
||||
int num = this.mSecurityStrength;
|
||||
num += 7;
|
||||
num += typeof(IEntropySource).TypeHandle;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0400633F RID: 25407
|
||||
[Token(Token = "0x400633F")]
|
||||
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
|
||||
|
||||
// Token: 0x04006340 RID: 25408
|
||||
[Token(Token = "0x4006340")]
|
||||
private static readonly int MAX_BITS_REQUEST;
|
||||
|
||||
// Token: 0x04006341 RID: 25409
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006341")]
|
||||
private readonly byte[] mK;
|
||||
|
||||
// Token: 0x04006342 RID: 25410
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006342")]
|
||||
private readonly byte[] mV;
|
||||
|
||||
// Token: 0x04006343 RID: 25411
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006343")]
|
||||
private readonly IEntropySource mEntropySource;
|
||||
|
||||
// Token: 0x04006344 RID: 25412
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006344")]
|
||||
private readonly IMac mHMac;
|
||||
|
||||
// Token: 0x04006345 RID: 25413
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006345")]
|
||||
private readonly int mSecurityStrength;
|
||||
|
||||
// Token: 0x04006346 RID: 25414
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x4006346")]
|
||||
private long mReseedCounter;
|
||||
}
|
||||
}
|
||||
+358
@@ -0,0 +1,358 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
|
||||
{
|
||||
// Token: 0x020015F9 RID: 5625
|
||||
[Token(Token = "0x20015F9")]
|
||||
[StructLayout(3)]
|
||||
public class HashSP800Drbg : ISP80090Drbg
|
||||
{
|
||||
// Token: 0x06009656 RID: 38486 RVA: 0x00215E74 File Offset: 0x00214074
|
||||
[Token(Token = "0x6009656")]
|
||||
[Address(RVA = "0x1E43010", Offset = "0x1E41A10", VA = "0x181E43010")]
|
||||
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: 0x06009657 RID: 38487 RVA: 0x00215EEC File Offset: 0x002140EC
|
||||
[Token(Token = "0x6009657")]
|
||||
[Address(RVA = "0x1E43340", Offset = "0x1E41D40", VA = "0x181E43340")]
|
||||
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: 0x170017F6 RID: 6134
|
||||
// (get) Token: 0x06009658 RID: 38488 RVA: 0x00215FEC File Offset: 0x002141EC
|
||||
[Token(Token = "0x170017F6")]
|
||||
public int BlockSize
|
||||
{
|
||||
[Token(Token = "0x6009658")]
|
||||
[Address(RVA = "0x1E437A0", Offset = "0x1E421A0", VA = "0x181E437A0", Slot = "4")]
|
||||
get
|
||||
{
|
||||
IDigest digest = this.mDigest;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06009659 RID: 38489 RVA: 0x00216008 File Offset: 0x00214208
|
||||
[Token(Token = "0x6009659")]
|
||||
[Address(RVA = "0x1E426A0", Offset = "0x1E410A0", VA = "0x181E426A0", 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: 0x0600965A RID: 38490 RVA: 0x00216290 File Offset: 0x00214490
|
||||
[Token(Token = "0x600965A")]
|
||||
[Address(RVA = "0x1E42C00", Offset = "0x1E41600", VA = "0x181E42C00")]
|
||||
private byte[] GetEntropy()
|
||||
{
|
||||
IEntropySource entropySource = this.mEntropySource;
|
||||
int num = this.mSecurityStrength;
|
||||
num += 7;
|
||||
num += typeof(IEntropySource).TypeHandle;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600965B RID: 38491 RVA: 0x002162BC File Offset: 0x002144BC
|
||||
[Token(Token = "0x600965B")]
|
||||
[Address(RVA = "0x1E42510", Offset = "0x1E40F10", VA = "0x181E42510")]
|
||||
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: 0x0600965C RID: 38492 RVA: 0x002162FC File Offset: 0x002144FC
|
||||
[Token(Token = "0x600965C")]
|
||||
[Address(RVA = "0x1E42D30", Offset = "0x1E41730", VA = "0x181E42D30", 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: 0x0600965D RID: 38493 RVA: 0x002163F8 File Offset: 0x002145F8
|
||||
[Token(Token = "0x600965D")]
|
||||
[Address(RVA = "0x1E42CA0", Offset = "0x1E416A0", VA = "0x181E42CA0")]
|
||||
private byte[] Hash(byte[] input)
|
||||
{
|
||||
IDigest digest = this.mDigest;
|
||||
byte[] array = new byte[0];
|
||||
this.DoHash(input, array);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600965E RID: 38494 RVA: 0x00216424 File Offset: 0x00214624
|
||||
[Token(Token = "0x600965E")]
|
||||
[Address(RVA = "0x1E42600", Offset = "0x1E41000", VA = "0x181E42600")]
|
||||
private void DoHash(byte[] input, byte[] output)
|
||||
{
|
||||
IDigest digest = this.mDigest;
|
||||
int length = input.Length;
|
||||
IDigest digest2 = this.mDigest;
|
||||
}
|
||||
|
||||
// Token: 0x0600965F RID: 38495 RVA: 0x0021644C File Offset: 0x0021464C
|
||||
[Token(Token = "0x600965F")]
|
||||
[Address(RVA = "0x1E437F0", Offset = "0x1E421F0", VA = "0x181E437F0")]
|
||||
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: 0x04006347 RID: 25415
|
||||
[Token(Token = "0x4006347")]
|
||||
private static readonly byte[] ONE = new byte[] { (byte)((ulong)1L) };
|
||||
|
||||
// Token: 0x04006348 RID: 25416
|
||||
[Token(Token = "0x4006348")]
|
||||
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
|
||||
|
||||
// Token: 0x04006349 RID: 25417
|
||||
[Token(Token = "0x4006349")]
|
||||
private static readonly int MAX_BITS_REQUEST;
|
||||
|
||||
// Token: 0x0400634A RID: 25418
|
||||
[Token(Token = "0x400634A")]
|
||||
private static readonly IDictionary seedlens = Platform.CreateHashtable();
|
||||
|
||||
// Token: 0x0400634B RID: 25419
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x400634B")]
|
||||
private readonly IDigest mDigest;
|
||||
|
||||
// Token: 0x0400634C RID: 25420
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x400634C")]
|
||||
private readonly IEntropySource mEntropySource;
|
||||
|
||||
// Token: 0x0400634D RID: 25421
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x400634D")]
|
||||
private readonly int mSecurityStrength;
|
||||
|
||||
// Token: 0x0400634E RID: 25422
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x24")]
|
||||
[Token(Token = "0x400634E")]
|
||||
private readonly int mSeedLength;
|
||||
|
||||
// Token: 0x0400634F RID: 25423
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x400634F")]
|
||||
private byte[] mV;
|
||||
|
||||
// Token: 0x04006350 RID: 25424
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006350")]
|
||||
private byte[] mC;
|
||||
|
||||
// Token: 0x04006351 RID: 25425
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x4006351")]
|
||||
private long mReseedCounter;
|
||||
}
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
|
||||
{
|
||||
// Token: 0x020015FA RID: 5626
|
||||
[Token(Token = "0x20015FA")]
|
||||
[StructLayout(3)]
|
||||
public interface ISP80090Drbg
|
||||
{
|
||||
// Token: 0x170017F7 RID: 6135
|
||||
// (get) Token: 0x06009660 RID: 38496
|
||||
[Token(Token = "0x170017F7")]
|
||||
int BlockSize
|
||||
{
|
||||
[Token(Token = "0x6009660")]
|
||||
[Address(Slot = "0")]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x06009661 RID: 38497
|
||||
[Token(Token = "0x6009661")]
|
||||
[Address(Slot = "1")]
|
||||
int Generate(byte[] output, byte[] additionalInput, bool predictionResistant);
|
||||
|
||||
// Token: 0x06009662 RID: 38498
|
||||
[Token(Token = "0x6009662")]
|
||||
[Address(Slot = "2")]
|
||||
void Reseed(byte[] additionalInput);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user