151 lines
4.2 KiB
C#
151 lines
4.2 KiB
C#
using System;
|
|
using System.Threading;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
|
|
{
|
|
// Token: 0x02001BC8 RID: 7112
|
|
[Token(Token = "0x2001BC8")]
|
|
public class SP800SecureRandom : SecureRandom
|
|
{
|
|
// Token: 0x0600B1DD RID: 45533 RVA: 0x0026B8CC File Offset: 0x00269ACC
|
|
[Token(Token = "0x600B1DD")]
|
|
[Address(RVA = "0x18A3DA0", Offset = "0x18A2BA0", VA = "0x1818A3DA0")]
|
|
internal SP800SecureRandom(SecureRandom randomSource, IEntropySource entropySource, IDrbgProvider drbgProvider, bool predictionResistant)
|
|
{
|
|
int num = 0;
|
|
base..ctor(num);
|
|
this.mRandomSource = randomSource;
|
|
this.mEntropySource = entropySource;
|
|
this.mPredictionResistant = false;
|
|
this.mDrbgProvider = drbgProvider;
|
|
}
|
|
|
|
// Token: 0x0600B1DE RID: 45534 RVA: 0x0026B900 File Offset: 0x00269B00
|
|
[Token(Token = "0x600B1DE")]
|
|
[Address(RVA = "0x18A3CF0", Offset = "0x18A2AF0", VA = "0x1818A3CF0", Slot = "11")]
|
|
public override void SetSeed(byte[] seed)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (this.mRandomSource != 0)
|
|
{
|
|
}
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B1DF RID: 45535 RVA: 0x0026B924 File Offset: 0x00269B24
|
|
[Token(Token = "0x600B1DF")]
|
|
[Address(RVA = "0x18A3C40", Offset = "0x18A2A40", VA = "0x1818A3C40", 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: 0x0600B1E0 RID: 45536 RVA: 0x0026B950 File Offset: 0x00269B50
|
|
[Token(Token = "0x600B1E0")]
|
|
[Address(RVA = "0x18A39D0", Offset = "0x18A27D0", VA = "0x1818A39D0", Slot = "9")]
|
|
public override void NextBytes(byte[] bytes)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
ISP80090Drbg isp80090Drbg = this.mDrbg;
|
|
if (isp80090Drbg == 0)
|
|
{
|
|
IDrbgProvider drbgProvider = this.mDrbgProvider;
|
|
this.mDrbg = isp80090Drbg;
|
|
}
|
|
bool flag = this.mPredictionResistant;
|
|
ISP80090Drbg isp80090Drbg2 = this.mDrbg;
|
|
ISP80090Drbg isp80090Drbg3 = this.mDrbg;
|
|
bool flag2 = this.mPredictionResistant;
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B1E1 RID: 45537 RVA: 0x0026B9BC File Offset: 0x00269BBC
|
|
[Token(Token = "0x600B1E1")]
|
|
[Address(RVA = "0x18A3920", Offset = "0x18A2720", VA = "0x1818A3920", 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: 0x0600B1E2 RID: 45538 RVA: 0x0026B9E4 File Offset: 0x00269BE4
|
|
[Token(Token = "0x600B1E2")]
|
|
[Address(RVA = "0x18A3910", Offset = "0x18A2710", VA = "0x1818A3910", Slot = "10")]
|
|
public override byte[] GenerateSeed(int numBytes)
|
|
{
|
|
return EntropyUtilities.GenerateSeed(this.mEntropySource, numBytes);
|
|
}
|
|
|
|
// Token: 0x0600B1E3 RID: 45539 RVA: 0x0026BA00 File Offset: 0x00269C00
|
|
[Token(Token = "0x600B1E3")]
|
|
[Address(RVA = "0x18A3B40", Offset = "0x18A2940", VA = "0x1818A3B40", Slot = "16")]
|
|
public virtual void Reseed(byte[] additionalInput)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
ISP80090Drbg isp80090Drbg = this.mDrbg;
|
|
if (isp80090Drbg == 0)
|
|
{
|
|
IDrbgProvider drbgProvider = this.mDrbgProvider;
|
|
this.mDrbg = isp80090Drbg;
|
|
}
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x04007146 RID: 28998
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007146")]
|
|
private readonly IDrbgProvider mDrbgProvider;
|
|
|
|
// Token: 0x04007147 RID: 28999
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007147")]
|
|
private readonly bool mPredictionResistant;
|
|
|
|
// Token: 0x04007148 RID: 29000
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007148")]
|
|
private readonly SecureRandom mRandomSource;
|
|
|
|
// Token: 0x04007149 RID: 29001
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007149")]
|
|
private readonly IEntropySource mEntropySource;
|
|
|
|
// Token: 0x0400714A RID: 29002
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x400714A")]
|
|
private ISP80090Drbg mDrbg;
|
|
}
|
|
}
|