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: 0x02001BD1 RID: 7121
|
|
[Token(Token = "0x2001BD1")]
|
|
public class X931SecureRandom : SecureRandom
|
|
{
|
|
// Token: 0x0600B205 RID: 45573 RVA: 0x0026C3E8 File Offset: 0x0026A5E8
|
|
[Token(Token = "0x600B205")]
|
|
[Address(RVA = "0x18A6150", Offset = "0x18A4F50", VA = "0x1818A6150")]
|
|
internal X931SecureRandom(SecureRandom randomSource, X931Rng drbg, bool predictionResistant)
|
|
{
|
|
int num = 0;
|
|
base..ctor(num);
|
|
this.mRandomSource = randomSource;
|
|
this.mDrbg = drbg;
|
|
this.mPredictionResistant = predictionResistant;
|
|
}
|
|
|
|
// Token: 0x0600B206 RID: 45574 RVA: 0x0026C414 File Offset: 0x0026A614
|
|
[Token(Token = "0x600B206")]
|
|
[Address(RVA = "0x18A5FF0", Offset = "0x18A4DF0", VA = "0x1818A5FF0", Slot = "11")]
|
|
public override void SetSeed(byte[] seed)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (this.mRandomSource != 0)
|
|
{
|
|
}
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B207 RID: 45575 RVA: 0x0026C438 File Offset: 0x0026A638
|
|
[Token(Token = "0x600B207")]
|
|
[Address(RVA = "0x18A60A0", Offset = "0x18A4EA0", VA = "0x1818A60A0", 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: 0x0600B208 RID: 45576 RVA: 0x0026C464 File Offset: 0x0026A664
|
|
[Token(Token = "0x600B208")]
|
|
[Address(RVA = "0x18A5E40", Offset = "0x18A4C40", VA = "0x1818A5E40", 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: 0x0600B209 RID: 45577 RVA: 0x0026C50C File Offset: 0x0026A70C
|
|
[Token(Token = "0x600B209")]
|
|
[Address(RVA = "0x18A5D90", Offset = "0x18A4B90", VA = "0x1818A5D90", 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: 0x0600B20A RID: 45578 RVA: 0x0026C534 File Offset: 0x0026A734
|
|
[Token(Token = "0x600B20A")]
|
|
[Address(RVA = "0x18A5D60", Offset = "0x18A4B60", VA = "0x1818A5D60", Slot = "10")]
|
|
public override byte[] GenerateSeed(int numBytes)
|
|
{
|
|
return EntropyUtilities.GenerateSeed(this.mDrbg.mEntropySource, numBytes);
|
|
}
|
|
|
|
// Token: 0x0400716D RID: 29037
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400716D")]
|
|
private readonly bool mPredictionResistant;
|
|
|
|
// Token: 0x0400716E RID: 29038
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400716E")]
|
|
private readonly SecureRandom mRandomSource;
|
|
|
|
// Token: 0x0400716F RID: 29039
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400716F")]
|
|
private readonly X931Rng mDrbg;
|
|
}
|
|
}
|