Files
Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Prng/X931SecureRandomBuilder.cs
T
2026-04-10 22:50:51 +02:00

110 lines
3.9 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: 0x02001BD2 RID: 7122
[Token(Token = "0x2001BD2")]
public class X931SecureRandomBuilder
{
// Token: 0x0600B20B RID: 45579 RVA: 0x0026C558 File Offset: 0x0026A758
[Token(Token = "0x600B20B")]
[Address(RVA = "0x18A5C20", Offset = "0x18A4A20", VA = "0x1818A5C20")]
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: 0x0600B20C RID: 45580 RVA: 0x0026C58C File Offset: 0x0026A78C
[Token(Token = "0x600B20C")]
[Address(RVA = "0x18A5CD0", Offset = "0x18A4AD0", VA = "0x1818A5CD0")]
public X931SecureRandomBuilder(SecureRandom entropySource, bool predictionResistant)
{
this.mRandom = entropySource;
BasicEntropySourceProvider basicEntropySourceProvider = new BasicEntropySourceProvider(entropySource, predictionResistant);
this.mEntropySourceProvider = basicEntropySourceProvider;
}
// Token: 0x0600B20D RID: 45581 RVA: 0x0026C5B8 File Offset: 0x0026A7B8
[Token(Token = "0x600B20D")]
[Address(RVA = "0x18A5BF0", Offset = "0x18A49F0", VA = "0x1818A5BF0")]
public X931SecureRandomBuilder(IEntropySourceProvider entropySourceProvider)
{
this.mRandom = (ulong)0L;
this.mEntropySourceProvider = entropySourceProvider;
}
// Token: 0x0600B20E RID: 45582 RVA: 0x0026C5DC File Offset: 0x0026A7DC
[Token(Token = "0x600B20E")]
[Address(RVA = "0x1872000", Offset = "0x1870E00", VA = "0x181872000")]
public X931SecureRandomBuilder SetDateTimeVector(byte[] dateTimeVector)
{
this.mDateTimeVector = dateTimeVector;
return this;
}
// Token: 0x0600B20F RID: 45583 RVA: 0x0026C5F4 File Offset: 0x0026A7F4
[Token(Token = "0x600B20F")]
[Address(RVA = "0x18A5970", Offset = "0x18A4770", VA = "0x1818A5970")]
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: 0x04007170 RID: 29040
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007170")]
private readonly SecureRandom mRandom;
// Token: 0x04007171 RID: 29041
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007171")]
private IEntropySourceProvider mEntropySourceProvider;
// Token: 0x04007172 RID: 29042
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007172")]
private byte[] mDateTimeVector;
}
}