112 lines
4.0 KiB
C#
112 lines
4.0 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Date;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
|
|
{
|
|
// Token: 0x020015F5 RID: 5621
|
|
[Token(Token = "0x20015F5")]
|
|
[StructLayout(3)]
|
|
public class X931SecureRandomBuilder
|
|
{
|
|
// Token: 0x06009631 RID: 38449 RVA: 0x00214F38 File Offset: 0x00213138
|
|
[Token(Token = "0x6009631")]
|
|
[Address(RVA = "0x1E4E4C0", Offset = "0x1E4CEC0", VA = "0x181E4E4C0")]
|
|
public X931SecureRandomBuilder()
|
|
{
|
|
SecureRandom secureRandom = new SecureRandom();
|
|
base..ctor();
|
|
this.mRandom = secureRandom;
|
|
int num;
|
|
BasicEntropySourceProvider basicEntropySourceProvider = new BasicEntropySourceProvider(secureRandom, num != 0);
|
|
num = 0;
|
|
this.mEntropySourceProvider = basicEntropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x06009632 RID: 38450 RVA: 0x00214F6C File Offset: 0x0021316C
|
|
[Token(Token = "0x6009632")]
|
|
[Address(RVA = "0x1E4E570", Offset = "0x1E4CF70", VA = "0x181E4E570")]
|
|
public X931SecureRandomBuilder(SecureRandom entropySource, bool predictionResistant)
|
|
{
|
|
this.mRandom = entropySource;
|
|
BasicEntropySourceProvider basicEntropySourceProvider = new BasicEntropySourceProvider(entropySource, predictionResistant);
|
|
this.mEntropySourceProvider = basicEntropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x06009633 RID: 38451 RVA: 0x00214F98 File Offset: 0x00213198
|
|
[Token(Token = "0x6009633")]
|
|
[Address(RVA = "0x1E4E490", Offset = "0x1E4CE90", VA = "0x181E4E490")]
|
|
public X931SecureRandomBuilder(IEntropySourceProvider entropySourceProvider)
|
|
{
|
|
this.mRandom = (ulong)0L;
|
|
this.mEntropySourceProvider = entropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x06009634 RID: 38452 RVA: 0x00214FBC File Offset: 0x002131BC
|
|
[Token(Token = "0x6009634")]
|
|
[Address(RVA = "0x665670", Offset = "0x664070", VA = "0x180665670")]
|
|
public X931SecureRandomBuilder SetDateTimeVector(byte[] dateTimeVector)
|
|
{
|
|
this.mDateTimeVector = dateTimeVector;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x06009635 RID: 38453 RVA: 0x00214FD4 File Offset: 0x002131D4
|
|
[Token(Token = "0x6009635")]
|
|
[Address(RVA = "0x1E4E210", Offset = "0x1E4CC10", VA = "0x181E4E210")]
|
|
public X931SecureRandom Build(IBlockCipher engine, KeyParameter key, bool predictionResistant)
|
|
{
|
|
if (this.mDateTimeVector == (ulong)0L)
|
|
{
|
|
byte[] array = new byte[0];
|
|
this.mDateTimeVector = array;
|
|
long num = DateTimeUtilities.CurrentUnixMs();
|
|
byte[] array2 = this.mDateTimeVector;
|
|
int num2 = 0;
|
|
Pack.UInt64_To_BE((ulong)num, array2, num2);
|
|
}
|
|
SecureRandom secureRandom = this.mRandom;
|
|
byte[] array3 = this.mDateTimeVector;
|
|
IEntropySourceProvider entropySourceProvider = this.mEntropySourceProvider;
|
|
X931Rng x931Rng;
|
|
x931Rng.mReseedCounter = (long)((ulong)1L);
|
|
x931Rng.mEngine = engine;
|
|
x931Rng.mEntropySource = key;
|
|
byte[] array4 = new byte[x931Rng];
|
|
x931Rng.mDT = array4;
|
|
int length = array4.Length;
|
|
int num3 = 0;
|
|
int num4 = 0;
|
|
Array.Copy(array3, num4, array4, num3, length);
|
|
byte[] array5 = new byte[array4];
|
|
x931Rng.mI = array5;
|
|
byte[] array6 = new byte[array5];
|
|
x931Rng.mR = array6;
|
|
X931SecureRandom x931SecureRandom;
|
|
x931SecureRandom.mRandomSource = secureRandom;
|
|
x931SecureRandom.mDrbg = x931Rng;
|
|
x931SecureRandom.mPredictionResistant = predictionResistant;
|
|
return x931SecureRandom;
|
|
}
|
|
|
|
// Token: 0x0400632D RID: 25389
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400632D")]
|
|
private readonly SecureRandom mRandom;
|
|
|
|
// Token: 0x0400632E RID: 25390
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400632E")]
|
|
private IEntropySourceProvider mEntropySourceProvider;
|
|
|
|
// Token: 0x0400632F RID: 25391
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400632F")]
|
|
private byte[] mDateTimeVector;
|
|
}
|
|
}
|