112 lines
4.0 KiB
C#
112 lines
4.0 KiB
C#
using System;
|
|
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: 0x02001CB2 RID: 7346
|
|
[Token(Token = "0x2001CB2")]
|
|
public class X931SecureRandomBuilder
|
|
{
|
|
// Token: 0x0600B5D9 RID: 46553 RVA: 0x00275734 File Offset: 0x00273934
|
|
[Token(Token = "0x600B5D9")]
|
|
[Address(RVA = "0x236A240", Offset = "0x2369240", VA = "0x18236A240")]
|
|
public X931SecureRandomBuilder()
|
|
{
|
|
SecureRandom secureRandom = new SecureRandom();
|
|
base..ctor();
|
|
this.mRandom = secureRandom;
|
|
BasicEntropySourceProvider basicEntropySourceProvider;
|
|
basicEntropySourceProvider.mSecureRandom = secureRandom;
|
|
basicEntropySourceProvider.mPredictionResistant = false;
|
|
this.mEntropySourceProvider = basicEntropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x0600B5DA RID: 46554 RVA: 0x0027576C File Offset: 0x0027396C
|
|
[Token(Token = "0x600B5DA")]
|
|
[Address(RVA = "0x236A2F0", Offset = "0x23692F0", VA = "0x18236A2F0")]
|
|
public X931SecureRandomBuilder(SecureRandom entropySource, bool predictionResistant)
|
|
{
|
|
this.mRandom = entropySource;
|
|
BasicEntropySourceProvider basicEntropySourceProvider;
|
|
basicEntropySourceProvider.mSecureRandom = entropySource;
|
|
basicEntropySourceProvider.mPredictionResistant = predictionResistant;
|
|
this.mEntropySourceProvider = basicEntropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x0600B5DB RID: 46555 RVA: 0x0027579C File Offset: 0x0027399C
|
|
[Token(Token = "0x600B5DB")]
|
|
[Address(RVA = "0x236A210", Offset = "0x2369210", VA = "0x18236A210")]
|
|
public X931SecureRandomBuilder(IEntropySourceProvider entropySourceProvider)
|
|
{
|
|
this.mRandom = (ulong)0L;
|
|
this.mEntropySourceProvider = entropySourceProvider;
|
|
}
|
|
|
|
// Token: 0x0600B5DC RID: 46556 RVA: 0x002757C0 File Offset: 0x002739C0
|
|
[Token(Token = "0x600B5DC")]
|
|
[Address(RVA = "0x493850", Offset = "0x492850", VA = "0x180493850")]
|
|
public X931SecureRandomBuilder SetDateTimeVector(byte[] dateTimeVector)
|
|
{
|
|
this.mDateTimeVector = dateTimeVector;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B5DD RID: 46557 RVA: 0x002757D8 File Offset: 0x002739D8
|
|
[Token(Token = "0x600B5DD")]
|
|
[Address(RVA = "0x2369F90", Offset = "0x2368F90", VA = "0x182369F90")]
|
|
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: 0x04007329 RID: 29481
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007329")]
|
|
private readonly SecureRandom mRandom;
|
|
|
|
// Token: 0x0400732A RID: 29482
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400732A")]
|
|
private IEntropySourceProvider mEntropySourceProvider;
|
|
|
|
// Token: 0x0400732B RID: 29483
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400732B")]
|
|
private byte[] mDateTimeVector;
|
|
}
|
|
}
|