131 lines
3.6 KiB
C#
131 lines
3.6 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
|
|
{
|
|
// Token: 0x020015F4 RID: 5620
|
|
[Token(Token = "0x20015F4")]
|
|
[StructLayout(3)]
|
|
public class X931SecureRandom : SecureRandom
|
|
{
|
|
// Token: 0x0600962B RID: 38443 RVA: 0x00214DBC File Offset: 0x00212FBC
|
|
[Token(Token = "0x600962B")]
|
|
[Address(RVA = "0x1E4EA50", Offset = "0x1E4D450", VA = "0x181E4EA50")]
|
|
internal X931SecureRandom(SecureRandom randomSource, X931Rng drbg, bool predictionResistant)
|
|
{
|
|
int num = 0;
|
|
base..ctor(num);
|
|
this.mRandomSource = randomSource;
|
|
this.mDrbg = drbg;
|
|
this.mPredictionResistant = predictionResistant;
|
|
}
|
|
|
|
// Token: 0x0600962C RID: 38444 RVA: 0x00214DE8 File Offset: 0x00212FE8
|
|
[Token(Token = "0x600962C")]
|
|
[Address(RVA = "0x1E4E8B0", Offset = "0x1E4D2B0", VA = "0x181E4E8B0", Slot = "11")]
|
|
public override void SetSeed(byte[] seed)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (this.mRandomSource != 0)
|
|
{
|
|
}
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600962D RID: 38445 RVA: 0x00214E10 File Offset: 0x00213010
|
|
[Token(Token = "0x600962D")]
|
|
[Address(RVA = "0x1E4E980", Offset = "0x1E4D380", VA = "0x181E4E980", 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);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600962E RID: 38446 RVA: 0x00214E40 File Offset: 0x00213040
|
|
[Token(Token = "0x600962E")]
|
|
[Address(RVA = "0x1E4E6E0", Offset = "0x1E4D0E0", VA = "0x181E4E6E0", 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);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600962F RID: 38447 RVA: 0x00214EEC File Offset: 0x002130EC
|
|
[Token(Token = "0x600962F")]
|
|
[Address(RVA = "0x1E4E630", Offset = "0x1E4D030", VA = "0x181E4E630", 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: 0x06009630 RID: 38448 RVA: 0x00214F14 File Offset: 0x00213114
|
|
[Token(Token = "0x6009630")]
|
|
[Address(RVA = "0x1E4E600", Offset = "0x1E4D000", VA = "0x181E4E600", Slot = "10")]
|
|
public override byte[] GenerateSeed(int numBytes)
|
|
{
|
|
return EntropyUtilities.GenerateSeed(this.mDrbg.mEntropySource, numBytes);
|
|
}
|
|
|
|
// Token: 0x0400632A RID: 25386
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400632A")]
|
|
private readonly bool mPredictionResistant;
|
|
|
|
// Token: 0x0400632B RID: 25387
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400632B")]
|
|
private readonly SecureRandom mRandomSource;
|
|
|
|
// Token: 0x0400632C RID: 25388
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400632C")]
|
|
private readonly X931Rng mDrbg;
|
|
}
|
|
}
|