120 lines
3.4 KiB
C#
120 lines
3.4 KiB
C#
using System;
|
|
using System.Threading;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
|
|
{
|
|
// Token: 0x02001CB1 RID: 7345
|
|
[Token(Token = "0x2001CB1")]
|
|
public class X931SecureRandom : SecureRandom
|
|
{
|
|
// Token: 0x0600B5D3 RID: 46547 RVA: 0x002755C4 File Offset: 0x002737C4
|
|
[Token(Token = "0x600B5D3")]
|
|
[Address(RVA = "0x236A770", Offset = "0x2369770", VA = "0x18236A770")]
|
|
internal X931SecureRandom(SecureRandom randomSource, X931Rng drbg, bool predictionResistant)
|
|
{
|
|
int num = 0;
|
|
base..ctor(num);
|
|
this.mRandomSource = randomSource;
|
|
this.mDrbg = drbg;
|
|
this.mPredictionResistant = predictionResistant;
|
|
}
|
|
|
|
// Token: 0x0600B5D4 RID: 46548 RVA: 0x002755F0 File Offset: 0x002737F0
|
|
[Token(Token = "0x600B5D4")]
|
|
[Address(RVA = "0x236A610", Offset = "0x2369610", VA = "0x18236A610", Slot = "11")]
|
|
public override void SetSeed(byte[] seed)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (this.mRandomSource != 0)
|
|
{
|
|
}
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B5D5 RID: 46549 RVA: 0x00275614 File Offset: 0x00273814
|
|
[Token(Token = "0x600B5D5")]
|
|
[Address(RVA = "0x236A6C0", Offset = "0x23696C0", VA = "0x18236A6C0", Slot = "12")]
|
|
public override void SetSeed(long seed)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
SecureRandom secureRandom = this.mRandomSource;
|
|
if (secureRandom != 0)
|
|
{
|
|
secureRandom.SetSeed(seed);
|
|
}
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B5D6 RID: 46550 RVA: 0x00275640 File Offset: 0x00273840
|
|
[Token(Token = "0x600B5D6")]
|
|
[Address(RVA = "0x236A460", Offset = "0x2369460", VA = "0x18236A460", Slot = "9")]
|
|
public override void NextBytes(byte[] bytes)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
X931Rng x931Rng = this.mDrbg;
|
|
bool flag = this.mPredictionResistant;
|
|
int num2 = x931Rng.Generate(bytes, flag);
|
|
X931Rng x931Rng2 = this.mDrbg;
|
|
IEntropySource mEntropySource = x931Rng2.mEntropySource;
|
|
x931Rng2.mV = num2;
|
|
IBlockCipher mEngine = x931Rng2.mEngine;
|
|
x931Rng2.mReseedCounter = (long)((ulong)1L);
|
|
X931Rng x931Rng3 = this.mDrbg;
|
|
bool flag2 = this.mPredictionResistant;
|
|
int num3 = x931Rng3.Generate(bytes, flag2);
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B5D7 RID: 46551 RVA: 0x002756E8 File Offset: 0x002738E8
|
|
[Token(Token = "0x600B5D7")]
|
|
[Address(RVA = "0x236A3B0", Offset = "0x23693B0", VA = "0x18236A3B0", Slot = "13")]
|
|
public override void NextBytes(byte[] buf, int off, int len)
|
|
{
|
|
byte[] array = new byte[len];
|
|
double num = this.NextDouble();
|
|
int num2 = 0;
|
|
Array.Copy(array, num2, buf, off, len);
|
|
}
|
|
|
|
// Token: 0x0600B5D8 RID: 46552 RVA: 0x00275710 File Offset: 0x00273910
|
|
[Token(Token = "0x600B5D8")]
|
|
[Address(RVA = "0x236A380", Offset = "0x2369380", VA = "0x18236A380", Slot = "10")]
|
|
public override byte[] GenerateSeed(int numBytes)
|
|
{
|
|
return EntropyUtilities.GenerateSeed(this.mDrbg.mEntropySource, numBytes);
|
|
}
|
|
|
|
// Token: 0x04007326 RID: 29478
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007326")]
|
|
private readonly bool mPredictionResistant;
|
|
|
|
// Token: 0x04007327 RID: 29479
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007327")]
|
|
private readonly SecureRandom mRandomSource;
|
|
|
|
// Token: 0x04007328 RID: 29480
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007328")]
|
|
private readonly X931Rng mDrbg;
|
|
}
|
|
}
|