scripts
This commit is contained in:
+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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user