165 lines
4.5 KiB
C#
165 lines
4.5 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x020015EB RID: 5611
|
|
[Token(Token = "0x20015EB")]
|
|
[StructLayout(3)]
|
|
public class SP800SecureRandom : SecureRandom
|
|
{
|
|
// Token: 0x06009603 RID: 38403 RVA: 0x00214284 File Offset: 0x00212484
|
|
[Token(Token = "0x6009603")]
|
|
[Address(RVA = "0x1E4C5F0", Offset = "0x1E4AFF0", VA = "0x181E4C5F0")]
|
|
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: 0x06009604 RID: 38404 RVA: 0x002142B8 File Offset: 0x002124B8
|
|
[Token(Token = "0x6009604")]
|
|
[Address(RVA = "0x1E4C520", Offset = "0x1E4AF20", VA = "0x181E4C520", 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: 0x06009605 RID: 38405 RVA: 0x002142E0 File Offset: 0x002124E0
|
|
[Token(Token = "0x6009605")]
|
|
[Address(RVA = "0x1E4C450", Offset = "0x1E4AE50", VA = "0x181E4C450", 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: 0x06009606 RID: 38406 RVA: 0x00214310 File Offset: 0x00212510
|
|
[Token(Token = "0x6009606")]
|
|
[Address(RVA = "0x1E4C190", Offset = "0x1E4AB90", VA = "0x181E4C190", 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);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x06009607 RID: 38407 RVA: 0x00214380 File Offset: 0x00212580
|
|
[Token(Token = "0x6009607")]
|
|
[Address(RVA = "0x1E4C0E0", Offset = "0x1E4AAE0", VA = "0x181E4C0E0", 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: 0x06009608 RID: 38408 RVA: 0x002143A8 File Offset: 0x002125A8
|
|
[Token(Token = "0x6009608")]
|
|
[Address(RVA = "0x1E4C0D0", Offset = "0x1E4AAD0", VA = "0x181E4C0D0", Slot = "10")]
|
|
public override byte[] GenerateSeed(int numBytes)
|
|
{
|
|
return EntropyUtilities.GenerateSeed(this.mEntropySource, numBytes);
|
|
}
|
|
|
|
// Token: 0x06009609 RID: 38409 RVA: 0x002143C4 File Offset: 0x002125C4
|
|
[Token(Token = "0x6009609")]
|
|
[Address(RVA = "0x1E4C320", Offset = "0x1E4AD20", VA = "0x181E4C320", 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);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x04006303 RID: 25347
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006303")]
|
|
private readonly IDrbgProvider mDrbgProvider;
|
|
|
|
// Token: 0x04006304 RID: 25348
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006304")]
|
|
private readonly bool mPredictionResistant;
|
|
|
|
// Token: 0x04006305 RID: 25349
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006305")]
|
|
private readonly SecureRandom mRandomSource;
|
|
|
|
// Token: 0x04006306 RID: 25350
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4006306")]
|
|
private readonly IEntropySource mEntropySource;
|
|
|
|
// Token: 0x04006307 RID: 25351
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4006307")]
|
|
private ISP80090Drbg mDrbg;
|
|
}
|
|
}
|