This commit is contained in:
niko
2026-04-12 16:51:38 +02:00
parent 1b6f6d81d0
commit c12fbe3fc6
17828 changed files with 2994770 additions and 0 deletions
@@ -0,0 +1,126 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001C9E RID: 7326
[Token(Token = "0x2001C9E")]
public class BasicEntropySourceProvider : IEntropySourceProvider
{
// Token: 0x0600B581 RID: 46465 RVA: 0x00274368 File Offset: 0x00272568
[Token(Token = "0x600B581")]
[Address(RVA = "0x741C60", Offset = "0x740C60", VA = "0x180741C60")]
public BasicEntropySourceProvider(SecureRandom secureRandom, bool isPredictionResistant)
{
this.mSecureRandom = secureRandom;
this.mPredictionResistant = isPredictionResistant;
}
// Token: 0x0600B582 RID: 46466 RVA: 0x0027438C File Offset: 0x0027258C
[Token(Token = "0x600B582")]
[Address(RVA = "0x2351430", Offset = "0x2350430", VA = "0x182351430", Slot = "4")]
public IEntropySource Get(int bitsRequired)
{
/*
An exception occurred when decompiling this method (0600B582)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IEntropySource BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.BasicEntropySourceProvider::Get(System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:SecureRandom(var_0_06, ldfld:SecureRandom(BasicEntropySourceProvider::mSecureRandom, ldloc:BasicEntropySourceProvider(this)))
stloc:bool(var_1_0D, ldfld:bool(BasicEntropySourceProvider::mPredictionResistant, ldloc:BasicEntropySourceProvider(this)))
stfld:bool(BasicEntropySource::mPredictionResistant, ldloc:BasicEntropySource(var_2), ldloc:bool(var_1_0D))
stfld:int32(BasicEntropySource::mEntropySize, ldloc:BasicEntropySource(var_2), ldloc:int32(bitsRequired))
stfld:SecureRandom(BasicEntropySource::mSecureRandom, ldloc:BasicEntropySource(var_2), ldloc:SecureRandom(var_0_06))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x040072EB RID: 29419
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072EB")]
private readonly SecureRandom mSecureRandom;
// Token: 0x040072EC RID: 29420
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072EC")]
private readonly bool mPredictionResistant;
// Token: 0x02001C9F RID: 7327
[Token(Token = "0x2001C9F")]
private class BasicEntropySource : IEntropySource
{
// Token: 0x0600B583 RID: 46467 RVA: 0x002743BC File Offset: 0x002725BC
[Token(Token = "0x600B583")]
[Address(RVA = "0x2351520", Offset = "0x2350520", VA = "0x182351520")]
internal BasicEntropySource(SecureRandom secureRandom, bool predictionResistant, int entropySize)
{
this.mSecureRandom = secureRandom;
this.mPredictionResistant = predictionResistant;
this.mEntropySize = entropySize;
}
// Token: 0x17001C8D RID: 7309
// (get) Token: 0x0600B584 RID: 46468 RVA: 0x002743E4 File Offset: 0x002725E4
[Token(Token = "0x17001C8D")]
bool IEntropySource.IsPredictionResistant
{
[Token(Token = "0x600B584")]
[Address(RVA = "0x497570", Offset = "0x496570", VA = "0x180497570", Slot = "4")]
get
{
return this.mPredictionResistant;
}
}
// Token: 0x0600B585 RID: 46469 RVA: 0x002743F8 File Offset: 0x002725F8
[Token(Token = "0x600B585")]
[Address(RVA = "0x23514B0", Offset = "0x23504B0", VA = "0x1823514B0", Slot = "5")]
byte[] IEntropySource.GetEntropy()
{
SecureRandom secureRandom = this.mSecureRandom;
byte[] array;
return array;
}
// Token: 0x17001C8E RID: 7310
// (get) Token: 0x0600B586 RID: 46470 RVA: 0x00274410 File Offset: 0x00272610
[Token(Token = "0x17001C8E")]
int IEntropySource.EntropySize
{
[Token(Token = "0x600B586")]
[Address(RVA = "0x497590", Offset = "0x496590", VA = "0x180497590", Slot = "6")]
get
{
return this.mEntropySize;
}
}
// Token: 0x040072ED RID: 29421
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072ED")]
private readonly SecureRandom mSecureRandom;
// Token: 0x040072EE RID: 29422
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072EE")]
private readonly bool mPredictionResistant;
// Token: 0x040072EF RID: 29423
[FieldOffset(Offset = "0x1C")]
[Token(Token = "0x40072EF")]
private readonly int mEntropySize;
}
}
}
@@ -0,0 +1,177 @@
using System;
using System.Security.Cryptography;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA0 RID: 7328
[Token(Token = "0x2001CA0")]
public class CryptoApiEntropySourceProvider : IEntropySourceProvider
{
// Token: 0x0600B587 RID: 46471 RVA: 0x00274424 File Offset: 0x00272624
[Token(Token = "0x600B587")]
[Address(RVA = "0x2352170", Offset = "0x2351170", VA = "0x182352170")]
public CryptoApiEntropySourceProvider()
{
/*
An exception occurred when decompiling this method (0600B587)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.CryptoApiEntropySourceProvider::.ctor()
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_21:
stloc:ArgumentNullException(var_2_2B, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("rng")))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0600B588 RID: 46472 RVA: 0x0027445C File Offset: 0x0027265C
[Token(Token = "0x600B588")]
[Address(RVA = "0x2352200", Offset = "0x2351200", VA = "0x182352200")]
public CryptoApiEntropySourceProvider(RandomNumberGenerator rng, bool isPredictionResistant)
{
/*
An exception occurred when decompiling this method (0600B588)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.CryptoApiEntropySourceProvider::.ctor(System.Security.Cryptography.RandomNumberGenerator,System.Boolean)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_19:
stloc:ArgumentNullException(var_0_23, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("rng")))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0600B589 RID: 46473 RVA: 0x0027448C File Offset: 0x0027268C
[Token(Token = "0x600B589")]
[Address(RVA = "0x23520F0", Offset = "0x23510F0", VA = "0x1823520F0", Slot = "4")]
public IEntropySource Get(int bitsRequired)
{
/*
An exception occurred when decompiling this method (0600B589)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IEntropySource BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.CryptoApiEntropySourceProvider::Get(System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:RandomNumberGenerator(var_0_06, ldfld:RandomNumberGenerator(CryptoApiEntropySourceProvider::mRng, ldloc:CryptoApiEntropySourceProvider(this)))
stloc:bool(var_1_0D, ldfld:bool(CryptoApiEntropySourceProvider::mPredictionResistant, ldloc:CryptoApiEntropySourceProvider(this)))
stfld:bool(CryptoApiEntropySource::mPredictionResistant, ldloc:CryptoApiEntropySource(var_2), ldloc:bool(var_1_0D))
stfld:int32(CryptoApiEntropySource::mEntropySize, ldloc:CryptoApiEntropySource(var_2), ldloc:int32(bitsRequired))
stfld:RandomNumberGenerator(CryptoApiEntropySource::mRng, ldloc:CryptoApiEntropySource(var_2), ldloc:RandomNumberGenerator(var_0_06))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x040072F0 RID: 29424
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072F0")]
private readonly RandomNumberGenerator mRng;
// Token: 0x040072F1 RID: 29425
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072F1")]
private readonly bool mPredictionResistant;
// Token: 0x02001CA1 RID: 7329
[Token(Token = "0x2001CA1")]
private class CryptoApiEntropySource : IEntropySource
{
// Token: 0x0600B58A RID: 46474 RVA: 0x002744BC File Offset: 0x002726BC
[Token(Token = "0x600B58A")]
[Address(RVA = "0x2351520", Offset = "0x2350520", VA = "0x182351520")]
internal CryptoApiEntropySource(RandomNumberGenerator rng, bool predictionResistant, int entropySize)
{
this.mRng = rng;
this.mPredictionResistant = predictionResistant;
this.mEntropySize = entropySize;
}
// Token: 0x17001C8F RID: 7311
// (get) Token: 0x0600B58B RID: 46475 RVA: 0x002744E4 File Offset: 0x002726E4
[Token(Token = "0x17001C8F")]
bool IEntropySource.IsPredictionResistant
{
[Token(Token = "0x600B58B")]
[Address(RVA = "0x497570", Offset = "0x496570", VA = "0x180497570", Slot = "4")]
get
{
return this.mPredictionResistant;
}
}
// Token: 0x0600B58C RID: 46476 RVA: 0x002744F8 File Offset: 0x002726F8
[Token(Token = "0x600B58C")]
[Address(RVA = "0x2352290", Offset = "0x2351290", VA = "0x182352290", Slot = "5")]
byte[] IEntropySource.GetEntropy()
{
int num = this.mEntropySize;
num += 7;
RandomNumberGenerator randomNumberGenerator = this.mRng;
byte[] array;
return array;
}
// Token: 0x17001C90 RID: 7312
// (get) Token: 0x0600B58D RID: 46477 RVA: 0x00274520 File Offset: 0x00272720
[Token(Token = "0x17001C90")]
int IEntropySource.EntropySize
{
[Token(Token = "0x600B58D")]
[Address(RVA = "0x497590", Offset = "0x496590", VA = "0x180497590", Slot = "6")]
get
{
return this.mEntropySize;
}
}
// Token: 0x040072F2 RID: 29426
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072F2")]
private readonly RandomNumberGenerator mRng;
// Token: 0x040072F3 RID: 29427
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072F3")]
private readonly bool mPredictionResistant;
// Token: 0x040072F4 RID: 29428
[FieldOffset(Offset = "0x1C")]
[Token(Token = "0x40072F4")]
private readonly int mEntropySize;
}
}
}
@@ -0,0 +1,93 @@
using System;
using System.Security.Cryptography;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA2 RID: 7330
[Token(Token = "0x2001CA2")]
public class CryptoApiRandomGenerator : IRandomGenerator
{
// Token: 0x0600B58E RID: 46478 RVA: 0x00274534 File Offset: 0x00272734
[Token(Token = "0x600B58E")]
[Address(RVA = "0x2352490", Offset = "0x2351490", VA = "0x182352490")]
public CryptoApiRandomGenerator()
{
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
int num = 0;
this.AddSeedMaterial((long)num);
this.rndProv = randomNumberGenerator;
}
// Token: 0x0600B58F RID: 46479 RVA: 0x0027455C File Offset: 0x0027275C
[Token(Token = "0x600B58F")]
[Address(RVA = "0x493D90", Offset = "0x492D90", VA = "0x180493D90")]
public CryptoApiRandomGenerator(RandomNumberGenerator rng)
{
int num = 0;
this.AddSeedMaterial((long)num);
this.rndProv = rng;
}
// Token: 0x0600B590 RID: 46480 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B590")]
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "8")]
public virtual void AddSeedMaterial(byte[] seed)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600B591 RID: 46481 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600B591")]
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "9")]
public virtual void AddSeedMaterial(long seed)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600B592 RID: 46482 RVA: 0x0027457C File Offset: 0x0027277C
[Token(Token = "0x600B592")]
[Address(RVA = "0x2352460", Offset = "0x2351460", VA = "0x182352460", Slot = "10")]
public virtual void NextBytes(byte[] bytes)
{
this.rndProv.GetBytes(bytes);
}
// Token: 0x0600B593 RID: 46483 RVA: 0x0027459C File Offset: 0x0027279C
[Token(Token = "0x600B593")]
[Address(RVA = "0x2352310", Offset = "0x2351310", VA = "0x182352310", Slot = "11")]
public virtual void NextBytes(byte[] bytes, int start, int len)
{
/*
An exception occurred when decompiling this method (0600B593)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.CryptoApiRandomGenerator::NextBytes(System.Byte[],System.Int32,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_0E:
stloc:uint8[](var_0_14, newarr:uint8[]([mscorlib]System.Byte, ldloc:int32(len)))
stloc:int32(var_2_16, ldc.i4:int32(0))
call:void(Array::Copy, ldloc:uint8[][exp:Array](var_0_14), ldloc:int32(var_2_16), ldloc:uint8[][exp:Array](bytes), ldloc:int32(start), ldloc:int32(len))
stloc:ArgumentException(var_3_30, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Start offset cannot be negative"), ldstr:string("start")))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x040072F5 RID: 29429
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072F5")]
private readonly RandomNumberGenerator rndProv;
}
}
@@ -0,0 +1,200 @@
using System;
using System.Threading;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA3 RID: 7331
[Token(Token = "0x2001CA3")]
public class DigestRandomGenerator : IRandomGenerator
{
// Token: 0x0600B594 RID: 46484 RVA: 0x002745DC File Offset: 0x002727DC
[Token(Token = "0x600B594")]
[Address(RVA = "0x2354C30", Offset = "0x2353C30", VA = "0x182354C30")]
public DigestRandomGenerator(IDigest digest)
{
this.digest = digest;
byte[] array = new byte[0];
this.seed = array;
this.seedCounter = (long)((ulong)1L);
byte[] array2 = new byte[array];
this.state = array2;
this.stateCounter = (long)((ulong)1L);
}
// Token: 0x0600B595 RID: 46485 RVA: 0x0027462C File Offset: 0x0027282C
[Token(Token = "0x600B595")]
[Address(RVA = "0x23544C0", Offset = "0x23534C0", VA = "0x1823544C0", Slot = "4")]
public void AddSeedMaterial(byte[] inSeed)
{
int num;
do
{
num = 0;
IDigest digest = this.digest;
int length = inSeed.Length;
byte[] array = this.seed;
IDigest digest2 = this.digest;
int length2 = array.Length;
IDigest digest3 = this.digest;
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B596 RID: 46486 RVA: 0x00274690 File Offset: 0x00272890
[Token(Token = "0x600B596")]
[Address(RVA = "0x2354380", Offset = "0x2353380", VA = "0x182354380", Slot = "5")]
public void AddSeedMaterial(long rSeed)
{
int num;
do
{
num = 0;
this.DigestAddCounter(rSeed);
byte[] array = this.seed;
IDigest digest = this.digest;
int length = array.Length;
IDigest digest2 = this.digest;
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B597 RID: 46487 RVA: 0x002746E0 File Offset: 0x002728E0
[Token(Token = "0x600B597")]
[Address(RVA = "0x2354C00", Offset = "0x2353C00", VA = "0x182354C00", Slot = "6")]
public void NextBytes(byte[] bytes)
{
int length = bytes.Length;
int num = 0;
this.NextBytes(bytes, num, length);
}
// Token: 0x0600B598 RID: 46488 RVA: 0x00274708 File Offset: 0x00272908
[Token(Token = "0x600B598")]
[Address(RVA = "0x2354AB0", Offset = "0x2353AB0", VA = "0x182354AB0", Slot = "7")]
public void NextBytes(byte[] bytes, int start, int len)
{
int num;
do
{
num = 0;
this.GenerateState();
if (start < len)
{
byte[] array = this.state;
if (num == array.Length)
{
this.GenerateState();
}
num++;
}
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B599 RID: 46489 RVA: 0x00274764 File Offset: 0x00272964
[Token(Token = "0x600B599")]
[Address(RVA = "0x2354650", Offset = "0x2353650", VA = "0x182354650")]
private void CycleSeed()
{
byte[] array = this.seed;
IDigest digest = this.digest;
int length = array.Length;
long num = this.seedCounter;
long num2 = num + 1L;
this.seedCounter = num2;
this.DigestAddCounter(num);
IDigest digest2 = this.digest;
}
// Token: 0x0600B59A RID: 46490 RVA: 0x002747B4 File Offset: 0x002729B4
[Token(Token = "0x600B59A")]
[Address(RVA = "0x23548B0", Offset = "0x23538B0", VA = "0x1823548B0")]
private void GenerateState()
{
long num = this.stateCounter;
long num2 = num + 1L;
this.stateCounter = num2;
this.DigestAddCounter(num);
byte[] array = this.state;
IDigest digest = this.digest;
int length = array.Length;
byte[] array2 = this.seed;
IDigest digest2 = this.digest;
int length2 = array2.Length;
IDigest digest3 = this.digest;
if (this.stateCounter == typeof(IDigest).TypeHandle)
{
byte[] array3 = this.seed;
IDigest digest4 = this.digest;
int length3 = array3.Length;
long num3 = this.seedCounter;
long num4 = num3 + 1L;
this.seedCounter = num4;
this.DigestAddCounter(num3);
IDigest digest5 = this.digest;
}
}
// Token: 0x0600B59B RID: 46491 RVA: 0x00274868 File Offset: 0x00272A68
[Token(Token = "0x600B59B")]
[Address(RVA = "0x2354730", Offset = "0x2353730", VA = "0x182354730")]
private void DigestAddCounter(long seedVal)
{
byte[] array = new byte[8];
Pack.UInt64_To_LE((ulong)seedVal, array);
IDigest digest = this.digest;
int length = array.Length;
}
// Token: 0x0600B59C RID: 46492 RVA: 0x00274898 File Offset: 0x00272A98
[Token(Token = "0x600B59C")]
[Address(RVA = "0x2354840", Offset = "0x2353840", VA = "0x182354840")]
private void DigestUpdate(byte[] inSeed)
{
IDigest digest = this.digest;
int length = inSeed.Length;
}
// Token: 0x0600B59D RID: 46493 RVA: 0x002748BC File Offset: 0x00272ABC
[Token(Token = "0x600B59D")]
[Address(RVA = "0x23547D0", Offset = "0x23537D0", VA = "0x1823547D0")]
private void DigestDoFinal(byte[] result)
{
IDigest digest = this.digest;
}
// Token: 0x040072F6 RID: 29430
[Token(Token = "0x40072F6")]
private const long CYCLE_COUNT = 10L;
// Token: 0x040072F7 RID: 29431
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072F7")]
private long stateCounter;
// Token: 0x040072F8 RID: 29432
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072F8")]
private long seedCounter;
// Token: 0x040072F9 RID: 29433
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40072F9")]
private IDigest digest;
// Token: 0x040072FA RID: 29434
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40072FA")]
private byte[] state;
// Token: 0x040072FB RID: 29435
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x40072FB")]
private byte[] seed;
}
}
@@ -0,0 +1,488 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001CB3 RID: 7347
[Token(Token = "0x2001CB3")]
public class CtrSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B5DE RID: 46558 RVA: 0x002758C4 File Offset: 0x00273AC4
[Token(Token = "0x600B5DE")]
[Address(RVA = "0x2354090", Offset = "0x2353090", VA = "0x182354090")]
public CtrSP800Drbg(IBlockCipher engine, int keySizeInBits, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
if (!this.IsTdea(engine) || keySizeInBits == 168)
{
}
this.mEntropySource = 0;
this.mEngine = engine;
this.mKeySizeInBits = keySizeInBits;
this.mSecurityStrength = securityStrength;
this.mSeedLength = (int)((uint)2);
bool flag = this.IsTdea(engine);
this.mIsTdea = flag;
byte[] entropy = this.GetEntropy();
}
// Token: 0x0600B5DF RID: 46559 RVA: 0x00275930 File Offset: 0x00273B30
[Token(Token = "0x600B5DF")]
[Address(RVA = "0x2352E00", Offset = "0x2351E00", VA = "0x182352E00")]
private void CTR_DRBG_Instantiate_algorithm(byte[] entropy, byte[] nonce, byte[] personalisationString)
{
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
if (nonce != 0)
{
}
array[1] = nonce;
if (personalisationString != 0)
{
}
array[2] = personalisationString;
byte[] array2 = Arrays.ConcatenateAll(array);
int num = this.mSeedLength;
byte[] array3 = this.Block_Cipher_df(array2, num);
IBlockCipher blockCipher = this.mEngine;
int num2 = this.mKeySizeInBits;
num2 += 7;
byte[] array4 = new byte[0];
this.mKey = array4;
byte[] array5 = new byte[array3];
byte[] array6 = this.mKey;
this.mV = array5;
this.CTR_DRBG_Update(array3, array6, array5);
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B5E0 RID: 46560 RVA: 0x002759DC File Offset: 0x00273BDC
[Token(Token = "0x600B5E0")]
[Address(RVA = "0x23530D0", Offset = "0x23520D0", VA = "0x1823530D0")]
private void CTR_DRBG_Update(byte[] seed, byte[] key, byte[] v)
{
byte[] array = new byte[seed.Length];
IBlockCipher blockCipher = this.mEngine;
byte[] array2 = new byte[array];
IBlockCipher blockCipher2 = this.mEngine;
IBlockCipher blockCipher3 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(key));
int num = 0;
int num6;
if (num < seed.Length)
{
int num2 = v.Length;
uint num3;
num2 -= (int)num3;
byte b;
num3 += (uint)b;
IBlockCipher blockCipher4 = this.mEngine;
if (num < num2)
{
num += num;
num++;
}
int num4 = array.Length;
num4 -= num;
int num5 = 0;
num += array2;
num6 = 0;
num5 += num5;
num += 4;
num += 19;
}
int length = array.Length;
if (num6 < length)
{
num6++;
}
int num7 = 0;
int length2 = v.Length;
int num8 = 0;
Array.Copy(array, num7, v, num8, length2);
}
// Token: 0x0600B5E1 RID: 46561 RVA: 0x00275AC4 File Offset: 0x00273CC4
[Token(Token = "0x600B5E1")]
[Address(RVA = "0x2353020", Offset = "0x2352020", VA = "0x182353020")]
private void CTR_DRBG_Reseed_algorithm(byte[] additionalInput)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num = this.mSeedLength;
byte[] array2 = this.Block_Cipher_df(array, num);
byte[] array3 = this.mV;
byte[] array4 = this.mKey;
this.CTR_DRBG_Update(array2, array4, array3);
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B5E2 RID: 46562 RVA: 0x00275B10 File Offset: 0x00273D10
[Token(Token = "0x600B5E2")]
[Address(RVA = "0x2353F30", Offset = "0x2352F30", VA = "0x182353F30")]
private void XOR(byte[] output, byte[] a, byte[] b, int bOff)
{
int num = 0;
int length = output.Length;
if (num < length)
{
num++;
}
}
// Token: 0x0600B5E3 RID: 46563 RVA: 0x00275B34 File Offset: 0x00273D34
[Token(Token = "0x600B5E3")]
[Address(RVA = "0x23525D0", Offset = "0x23515D0", VA = "0x1823525D0")]
private void AddOneTo(byte[] longer)
{
int num = longer.Length;
uint num2;
num -= (int)num2;
byte b;
num2 += (uint)b;
}
// Token: 0x0600B5E4 RID: 46564 RVA: 0x00275B58 File Offset: 0x00273D58
[Token(Token = "0x600B5E4")]
[Address(RVA = "0x2353950", Offset = "0x2352950", VA = "0x182353950")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x0600B5E5 RID: 46565 RVA: 0x00275B84 File Offset: 0x00273D84
[Token(Token = "0x600B5E5")]
[Address(RVA = "0x2352920", Offset = "0x2351920", VA = "0x182352920")]
private byte[] Block_Cipher_df(byte[] inputString, int bitLength)
{
IBlockCipher blockCipher = this.mEngine;
int length = inputString.Length;
byte[] array = new byte[0];
int num = 0;
int num2 = 0;
this.copyIntToByteArray(array, length, num2);
this.copyIntToByteArray(array, length, 4);
int num3 = 0;
Array.Copy(inputString, num3, array, 8, length);
int num4 = this.mKeySizeInBits;
num3 += num4;
byte[] array2 = new byte[num3];
byte[] array3 = new byte[num3];
byte[] array4 = new byte[num3];
int num5 = this.mKeySizeInBits;
num3 += num5;
byte[] array5 = new byte[num3];
int num6 = 0;
int length2 = array5.Length;
int num7 = 0;
byte[] k_BITS = CtrSP800Drbg.K_BITS;
Array.Copy(k_BITS, num7, array5, num6, length2);
int num9;
if (k_BITS > 0)
{
array4[0] = (byte)num;
array4[0] = (byte)num;
array4[0] = (byte)num;
array4[0] = (byte)num;
this.BCC(array3, array5, array4, array);
int num8 = array2.Length;
num8 -= num;
num9 = 0;
Array.Copy(array3, num9, array2, num, num8);
int num10 = this.mKeySizeInBits;
num += num9;
num10 += num9;
num++;
}
byte[] array6 = new byte[num9];
int length3 = array5.Length;
int num11 = 0;
int num12 = 0;
Array.Copy(array2, num12, array5, num11, length3);
int length4 = array6.Length;
int num13 = 0;
int length5 = array5.Length;
Array.Copy(array2, length5, array6, num13, length4);
byte[] array7 = new byte[0];
IBlockCipher blockCipher2 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(array5));
int num14 = 0;
if (num14 < array7.Length)
{
IBlockCipher blockCipher3 = this.mEngine;
if (num14 < blockCipher2)
{
num14 += num14;
num14++;
}
int num15 = array7.Length;
num15 -= num14;
int num16 = 0;
Array.Copy(array6, num16, array7, num14, num15);
num16 += num16;
num14 += 4;
num14 += 19;
}
return array7;
}
// Token: 0x0600B5E6 RID: 46566 RVA: 0x00275D78 File Offset: 0x00273F78
[Token(Token = "0x600B5E6")]
[Address(RVA = "0x2352630", Offset = "0x2351630", VA = "0x182352630")]
private void BCC(byte[] bccOut, byte[] k, byte[] iV, byte[] data)
{
IBlockCipher blockCipher = this.mEngine;
byte[] array = new byte[0];
byte[] array2 = new byte[0];
IBlockCipher blockCipher2 = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(k));
IBlockCipher blockCipher3 = this.mEngine;
int num = 0;
int length = array2.Length;
if (num < length)
{
num++;
}
IBlockCipher blockCipher4 = this.mEngine;
int num2 = 0;
if (num2 < num)
{
num2 += num2;
num2++;
}
num++;
}
// Token: 0x0600B5E7 RID: 46567 RVA: 0x00275E08 File Offset: 0x00274008
[Token(Token = "0x600B5E7")]
[Address(RVA = "0x23542C0", Offset = "0x23532C0", VA = "0x1823542C0")]
private void copyIntToByteArray(byte[] buf, int value, int offSet)
{
int num = offSet + 1;
}
// Token: 0x17001C92 RID: 7314
// (get) Token: 0x0600B5E8 RID: 46568 RVA: 0x00275E20 File Offset: 0x00274020
[Token(Token = "0x17001C92")]
public int BlockSize
{
[Token(Token = "0x600B5E8")]
[Address(RVA = "0x2354360", Offset = "0x2353360", VA = "0x182354360", Slot = "4")]
get
{
return this.mV.Length;
}
}
// Token: 0x0600B5E9 RID: 46569 RVA: 0x00275E40 File Offset: 0x00274040
[Token(Token = "0x600B5E9")]
[Address(RVA = "0x23534B0", Offset = "0x23524B0", VA = "0x1823534B0", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
long num = this.mReseedCounter;
if (!this.mIsTdea)
{
int num2 = CtrSP800Drbg.AES_MAX_BITS_REQUEST;
if (output == 0)
{
goto IL_34;
}
num2 += typeof(DrbgUtilities).TypeHandle;
}
int num3 = CtrSP800Drbg.TDEA_MAX_BITS_REQUEST;
if (output != 0)
{
num3 += typeof(DrbgUtilities).TypeHandle;
}
IL_34:
int num4 = 0;
if (predictionResistant)
{
this.CTR_DRBG_Reseed_algorithm(additionalInput);
}
int num5 = this.mSeedLength;
if (num4 == 0)
{
byte[] array = new byte[num5];
}
byte[] array2 = this.mV;
byte[] array3 = this.mKey;
byte[] array4;
this.CTR_DRBG_Update(array4, array3, array2);
byte[] array5 = new byte[this.mV.Length];
byte[] array6 = this.mKey;
IBlockCipher blockCipher = this.mEngine;
KeyParameter keyParameter = new KeyParameter(this.ExpandKey(array6));
int num6 = output.Length;
int num7 = array5.Length;
int num8 = num7 * num4;
num6 -= num8;
int length = this.mV.Length;
num7 = num6;
int num9 = length * num4;
num7 -= num9;
if (num7 != 0)
{
byte[] array7 = this.mV;
this.AddOneTo(array7);
IBlockCipher blockCipher2 = this.mEngine;
int num10 = array5.Length * num4;
int num11 = 0;
Array.Copy(array5, num11, output, num10, num7);
}
num4++;
byte[] array8 = this.mV;
byte[] array9 = this.mKey;
this.CTR_DRBG_Update(array4, array9, array8);
return output.Length;
}
// Token: 0x0600B5EA RID: 46570 RVA: 0x00275FA4 File Offset: 0x002741A4
[Token(Token = "0x600B5EA")]
[Address(RVA = "0x2353F20", Offset = "0x2352F20", VA = "0x182353F20", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
this.CTR_DRBG_Reseed_algorithm(additionalInput);
}
// Token: 0x0600B5EB RID: 46571 RVA: 0x00275FB8 File Offset: 0x002741B8
[Token(Token = "0x600B5EB")]
[Address(RVA = "0x2353AA0", Offset = "0x2352AA0", VA = "0x182353AA0")]
private bool IsTdea(IBlockCipher cipher)
{
bool flag;
bool flag2;
return flag || flag2;
}
// Token: 0x0600B5EC RID: 46572 RVA: 0x00275FD4 File Offset: 0x002741D4
[Token(Token = "0x600B5EC")]
[Address(RVA = "0x23539F0", Offset = "0x23529F0", VA = "0x1823539F0")]
private int GetMaxSecurityStrength(IBlockCipher cipher, int keySizeInBits)
{
if (!this.IsTdea(cipher) || keySizeInBits == 168)
{
}
return -1;
}
// Token: 0x0600B5ED RID: 46573 RVA: 0x00275FFC File Offset: 0x002741FC
[Token(Token = "0x600B5ED")]
[Address(RVA = "0x23533E0", Offset = "0x23523E0", VA = "0x1823533E0")]
private byte[] ExpandKey(byte[] key)
{
if (!this.mIsTdea)
{
return key;
}
byte[] array = new byte[24];
int num = 0;
int num2 = 0;
this.PadKey(key, num2, array, num);
ulong num3;
this.PadKey(key, 7, array, (int)num3);
ulong num4;
this.PadKey(key, 14, array, (int)num4);
return array;
}
// Token: 0x0600B5EE RID: 46574 RVA: 0x00276044 File Offset: 0x00274244
[Token(Token = "0x600B5EE")]
[Address(RVA = "0x2353B30", Offset = "0x2352B30", VA = "0x182353B30")]
private void PadKey(byte[] keyMaster, int keyOff, byte[] tmp, int tmpOff)
{
int length = keyMaster.Length;
int num = keyOff + 1;
byte b;
tmp[0] = b;
int length2 = keyMaster.Length;
byte b2;
tmp[0] = b2;
int length3 = keyMaster.Length;
byte b3;
tmp[0] = b3;
int length4 = keyMaster.Length;
byte b4;
tmp[0] = b4;
int length5 = keyMaster.Length;
byte b5;
tmp[0] = b5;
int length6 = keyMaster.Length;
byte b6;
b6 += b6;
}
// Token: 0x0400732C RID: 29484
[Token(Token = "0x400732C")]
private static readonly long TDEA_RESEED_MAX = (long)((uint)int.MinValue);
// Token: 0x0400732D RID: 29485
[Token(Token = "0x400732D")]
private static readonly long AES_RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x0400732E RID: 29486
[Token(Token = "0x400732E")]
private static readonly int TDEA_MAX_BITS_REQUEST;
// Token: 0x0400732F RID: 29487
[Token(Token = "0x400732F")]
private static readonly int AES_MAX_BITS_REQUEST;
// Token: 0x04007330 RID: 29488
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007330")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007331 RID: 29489
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007331")]
private readonly IBlockCipher mEngine;
// Token: 0x04007332 RID: 29490
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007332")]
private readonly int mKeySizeInBits;
// Token: 0x04007333 RID: 29491
[FieldOffset(Offset = "0x24")]
[Token(Token = "0x4007333")]
private readonly int mSeedLength;
// Token: 0x04007334 RID: 29492
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007334")]
private readonly int mSecurityStrength;
// Token: 0x04007335 RID: 29493
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007335")]
private byte[] mKey;
// Token: 0x04007336 RID: 29494
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007336")]
private byte[] mV;
// Token: 0x04007337 RID: 29495
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007337")]
private long mReseedCounter;
// Token: 0x04007338 RID: 29496
[FieldOffset(Offset = "0x48")]
[Token(Token = "0x4007338")]
private bool mIsTdea;
// Token: 0x04007339 RID: 29497
[Token(Token = "0x4007339")]
private static readonly byte[] K_BITS = Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F");
}
}
@@ -0,0 +1,129 @@
using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001CB4 RID: 7348
[Token(Token = "0x2001CB4")]
internal class DrbgUtilities
{
// Token: 0x0600B5F0 RID: 46576 RVA: 0x002760F4 File Offset: 0x002742F4
[Token(Token = "0x600B5F0")]
[Address(RVA = "0x2355430", Offset = "0x2354430", VA = "0x182355430")]
static DrbgUtilities()
{
IDictionary dictionary = Platform.CreateHashtable();
}
// Token: 0x0600B5F1 RID: 46577 RVA: 0x00276110 File Offset: 0x00274310
[Token(Token = "0x600B5F1")]
[Address(RVA = "0x2354CE0", Offset = "0x2353CE0", VA = "0x182354CE0")]
internal static int GetMaxSecurityStrength(IDigest d)
{
throw new NullReferenceException();
}
// Token: 0x0600B5F2 RID: 46578 RVA: 0x00276124 File Offset: 0x00274324
[Token(Token = "0x600B5F2")]
[Address(RVA = "0x2354DB0", Offset = "0x2353DB0", VA = "0x182354DB0")]
internal static int GetMaxSecurityStrength(IMac m)
{
throw new NullReferenceException();
}
// Token: 0x0600B5F3 RID: 46579 RVA: 0x00276140 File Offset: 0x00274340
[Token(Token = "0x600B5F3")]
[Address(RVA = "0x2354EB0", Offset = "0x2353EB0", VA = "0x182354EB0")]
internal static byte[] HashDF(IDigest digest, byte[] seedMaterial, int seedLength)
{
byte[] array = new byte[seedMaterial];
byte[] array2 = new byte[array.Length];
int num = 0;
if (num < digest)
{
num += num;
num++;
}
num += num;
num++;
num += num;
num++;
num += num;
num++;
num += num;
num++;
int num2 = seedMaterial.Length;
uint num3;
if (num < (int)num3)
{
num += num;
num++;
}
if (num < num2)
{
num += num;
num++;
}
int num4 = array2.Length;
num2 = num4;
int num5 = array.Length;
num5 -= num2;
if (num5 <= num4)
{
num4 = num5;
}
int num6 = 0;
Array.Copy(array2, num6, array, num2, num4);
if (seedLength != 0)
{
uint num7;
num7 -= (uint)seedLength;
int length = array.Length;
if (num != length)
{
num++;
byte b;
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
b += b;
b = (byte)((int)b + seedLength);
}
}
return array;
}
// Token: 0x0600B5F4 RID: 46580 RVA: 0x00276264 File Offset: 0x00274464
[Token(Token = "0x600B5F4")]
[Address(RVA = "0x2355420", Offset = "0x2354420", VA = "0x182355420")]
internal static bool IsTooLarge(byte[] bytes, int maxBytes)
{
if (bytes == 0)
{
}
return bytes.Length > maxBytes;
}
// Token: 0x0600B5F5 RID: 46581 RVA: 0x00276280 File Offset: 0x00274480
[Token(Token = "0x600B5F5")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public DrbgUtilities()
{
}
// Token: 0x0400733A RID: 29498
[Token(Token = "0x400733A")]
private static readonly IDictionary maxSecurityStrengths;
}
}
@@ -0,0 +1,238 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001CB5 RID: 7349
[Token(Token = "0x2001CB5")]
public class HMacSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B5F6 RID: 46582 RVA: 0x00276294 File Offset: 0x00274494
[Token(Token = "0x600B5F6")]
[Address(RVA = "0x235D0D0", Offset = "0x235C0D0", VA = "0x18235D0D0")]
public HMacSP800Drbg(IMac hMac, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
this.mHMac = hMac;
this.mSecurityStrength = securityStrength;
this.mEntropySource = entropySource;
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
byte[] array2 = Arrays.ConcatenateAll(array);
byte[] array3 = new byte[array2];
this.mK = array3;
byte[] array4 = new byte[array3.Length];
this.mV = array4;
int num = 0;
this.hmac_DRBG_Update_Func(array2, (byte)num);
if (array2 != 0)
{
}
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B5F7 RID: 46583 RVA: 0x00276330 File Offset: 0x00274530
[Token(Token = "0x600B5F7")]
[Address(RVA = "0x235D6A0", Offset = "0x235C6A0", VA = "0x18235D6A0")]
private void hmac_DRBG_Update(byte[] seedMaterial)
{
int num = 0;
this.hmac_DRBG_Update_Func(seedMaterial, (byte)num);
if (seedMaterial != 0)
{
}
}
// Token: 0x0600B5F8 RID: 46584 RVA: 0x0027634C File Offset: 0x0027454C
[Token(Token = "0x600B5F8")]
[Address(RVA = "0x235D4B0", Offset = "0x235C4B0", VA = "0x18235D4B0")]
private void hmac_DRBG_Update_Func(byte[] seedMaterial, byte vValue)
{
IMac mac = this.mHMac;
KeyParameter keyParameter = new KeyParameter(this.mK);
byte[] array = this.mV;
IMac mac2 = this.mHMac;
int length = array.Length;
IMac mac3 = this.mHMac;
if (seedMaterial != 0)
{
IMac mac4 = this.mHMac;
int length2 = seedMaterial.Length;
}
IMac mac5 = this.mHMac;
IMac mac6 = this.mHMac;
KeyParameter keyParameter2 = new KeyParameter(this.mK);
byte[] array2 = this.mV;
IMac mac7 = this.mHMac;
int length3 = array2.Length;
IMac mac8 = this.mHMac;
}
// Token: 0x17001C93 RID: 7315
// (get) Token: 0x0600B5F9 RID: 46585 RVA: 0x002763E8 File Offset: 0x002745E8
[Token(Token = "0x17001C93")]
public int BlockSize
{
[Token(Token = "0x600B5F9")]
[Address(RVA = "0x235D490", Offset = "0x235C490", VA = "0x18235D490", Slot = "4")]
get
{
return this.mV.Length;
}
}
// Token: 0x0600B5FA RID: 46586 RVA: 0x00276408 File Offset: 0x00274608
[Token(Token = "0x600B5FA")]
[Address(RVA = "0x235C9E0", Offset = "0x235B9E0", VA = "0x18235C9E0", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
int length = output.Length;
long num = this.mReseedCounter;
if (predictionResistant)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num2 = 0;
this.hmac_DRBG_Update_Func(array, (byte)num2);
if (array != 0)
{
ulong num3;
this.hmac_DRBG_Update_Func(array, (byte)num3);
}
this.mReseedCounter = (long)((ulong)1L);
}
if (additionalInput != 0)
{
int num4 = 0;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num4);
ulong num5;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num5);
}
byte[] array2 = new byte[output.Length];
byte[] array3 = this.mV;
int length2 = output.Length;
IMac mac = this.mHMac;
KeyParameter keyParameter = new KeyParameter(this.mK);
int num6 = 0;
int num10;
if (length2 > 0)
{
byte[] array4 = this.mV;
IMac mac2 = this.mHMac;
int num7 = 0;
if (num7 < mac)
{
num7 += num7;
num7++;
}
int num8 = 0;
IMac mac3 = this.mHMac;
int num9 = 0;
if (num9 < num8)
{
num9 += num9;
num9++;
}
byte[] array5 = this.mV;
num10 = array5.Length;
int num11 = num10 * num6;
int num12 = 0;
Array.Copy(array5, num12, array2, num11, num10);
num6++;
}
num10 = this.mV.Length;
if (num10 * length2 < array2.Length)
{
IMac mac4 = this.mHMac;
IMac mac5 = this.mHMac;
byte[] array6 = this.mV;
int length3 = array6.Length;
int num13 = array2.Length;
int num14 = 0;
int num15 = length3 * length2;
num13 -= num15;
Array.Copy(array6, num14, array2, num15, num13);
}
int num16 = 0;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num16);
if (additionalInput != 0)
{
ulong num17;
this.hmac_DRBG_Update_Func(additionalInput, (byte)num17);
}
int num18 = 0;
int length4 = output.Length;
int num19 = 0;
Array.Copy(array2, num19, output, num18, length4);
return length;
}
// Token: 0x0600B5FB RID: 46587 RVA: 0x002765D8 File Offset: 0x002747D8
[Token(Token = "0x600B5FB")]
[Address(RVA = "0x235CFC0", Offset = "0x235BFC0", VA = "0x18235CFC0", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
byte[] array = Arrays.Concatenate(this.GetEntropy(), additionalInput);
int num = 0;
this.hmac_DRBG_Update_Func(array, (byte)num);
if (array != 0)
{
}
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B5FC RID: 46588 RVA: 0x0027660C File Offset: 0x0027480C
[Token(Token = "0x600B5FC")]
[Address(RVA = "0x235CF20", Offset = "0x235BF20", VA = "0x18235CF20")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x0400733B RID: 29499
[Token(Token = "0x400733B")]
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x0400733C RID: 29500
[Token(Token = "0x400733C")]
private static readonly int MAX_BITS_REQUEST;
// Token: 0x0400733D RID: 29501
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400733D")]
private readonly byte[] mK;
// Token: 0x0400733E RID: 29502
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400733E")]
private readonly byte[] mV;
// Token: 0x0400733F RID: 29503
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400733F")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007340 RID: 29504
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007340")]
private readonly IMac mHMac;
// Token: 0x04007341 RID: 29505
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007341")]
private readonly int mSecurityStrength;
// Token: 0x04007342 RID: 29506
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007342")]
private long mReseedCounter;
}
}
@@ -0,0 +1,356 @@
using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001CB6 RID: 7350
[Token(Token = "0x2001CB6")]
public class HashSP800Drbg : ISP80090Drbg
{
// Token: 0x0600B5FE RID: 46590 RVA: 0x00276654 File Offset: 0x00274854
[Token(Token = "0x600B5FE")]
[Address(RVA = "0x235E280", Offset = "0x235D280", VA = "0x18235E280")]
static HashSP800Drbg()
{
IDictionary dictionary = HashSP800Drbg.seedlens;
IDictionary dictionary2 = HashSP800Drbg.seedlens;
IDictionary dictionary3 = HashSP800Drbg.seedlens;
IDictionary dictionary4 = HashSP800Drbg.seedlens;
IDictionary dictionary5 = HashSP800Drbg.seedlens;
IDictionary dictionary6 = HashSP800Drbg.seedlens;
IDictionary dictionary7 = HashSP800Drbg.seedlens;
}
// Token: 0x0600B5FF RID: 46591 RVA: 0x002766CC File Offset: 0x002748CC
[Token(Token = "0x600B5FF")]
[Address(RVA = "0x235E5B0", Offset = "0x235D5B0", VA = "0x18235E5B0")]
public HashSP800Drbg(IDigest digest, int securityStrength, IEntropySource entropySource, byte[] personalizationString, byte[] nonce)
{
int num;
do
{
base..ctor();
this.mDigest = digest;
this.mEntropySource = entropySource;
this.mSecurityStrength = securityStrength;
IDictionary dictionary = HashSP800Drbg.seedlens;
num = 0;
}
while ("{il2cpp array field local12->}" != num);
byte[] one = HashSP800Drbg.ONE;
this.mSeedLength = one;
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[3][];
if (entropy != 0)
{
}
array[0] = entropy;
byte[] array2 = Arrays.ConcatenateAll(array);
IDigest digest2 = this.mDigest;
int num2 = this.mSeedLength;
byte[] array3 = DrbgUtilities.HashDF(digest2, array2, num2);
this.mV = array3;
int num3 = array3.Length;
num3++;
byte[] array4 = new byte[num3];
byte[] array5 = this.mV;
int length = array5.Length;
int num4 = 0;
Array.Copy(array5, num4, array4, 1, length);
int num5 = this.mSeedLength;
byte[] array6 = DrbgUtilities.HashDF(this.mDigest, array4, num5);
this.mC = array6;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x17001C94 RID: 7316
// (get) Token: 0x0600B600 RID: 46592 RVA: 0x002767CC File Offset: 0x002749CC
[Token(Token = "0x17001C94")]
public int BlockSize
{
[Token(Token = "0x600B600")]
[Address(RVA = "0x235EA10", Offset = "0x235DA10", VA = "0x18235EA10", Slot = "4")]
get
{
IDigest digest = this.mDigest;
throw new NullReferenceException();
}
}
// Token: 0x0600B601 RID: 46593 RVA: 0x002767E8 File Offset: 0x002749E8
[Token(Token = "0x600B601")]
[Address(RVA = "0x235D910", Offset = "0x235C910", VA = "0x18235D910", Slot = "5")]
public int Generate(byte[] output, byte[] additionalInput, bool predictionResistant)
{
int length = output.Length;
long num = this.mReseedCounter;
if (predictionResistant)
{
this.Reseed(additionalInput);
}
if (additionalInput != 0)
{
byte[] array = this.mV;
int num2 = additionalInput.Length;
num2++;
byte[] array2 = new byte[num2];
array2[0] = (byte)((ulong)2L);
byte[] array3 = this.mV;
int length2 = array3.Length;
int num3 = 0;
uint num4;
Array.Copy(array3, num3, array2, (int)num4, length2);
int num5 = this.mV.Length;
int length3 = additionalInput.Length;
num5++;
int num6 = 0;
Array.Copy(additionalInput, num6, array2, num5, length3);
byte[] array4 = this.Hash(array2);
byte[] array5 = this.mV;
this.AddTo(array5, array4);
}
byte[] array6 = this.mV;
IDigest digest = this.mDigest;
byte[] array7 = new byte[array6.Length];
int length4 = array6.Length;
int num7 = 0;
int num8 = 0;
Array.Copy(array6, num8, array7, num7, length4);
byte[] array8 = new byte[additionalInput];
IDigest digest2 = this.mDigest;
byte[] array9 = new byte[array8];
int i = 0;
this.DoHash(array7, array9);
int num9 = array9.Length;
int num10 = array8.Length;
int num11 = i * num9;
num10 -= num11;
if (num10 <= num9)
{
num9 = num10;
}
int num12 = 0;
Array.Copy(array9, num12, array8, num11, num9);
byte[] one = HashSP800Drbg.ONE;
this.AddTo(array7, one);
i++;
while (i <= additionalInput)
{
}
int num13 = this.mV.Length;
num13++;
byte[] array10 = new byte[num13];
byte[] array11 = this.mV;
int length5 = array11.Length;
int num14 = 0;
Array.Copy(array11, num14, array10, 1, length5);
array10[0] = (byte)((ulong)3L);
byte[] array12 = this.Hash(array10);
byte[] array13 = this.mV;
this.AddTo(array13, array12);
byte[] array14 = this.mC;
byte[] array15 = this.mV;
this.AddTo(array15, array14);
byte[] array16 = new byte[0];
long num15 = this.mReseedCounter;
array16[0] = (byte)num15;
long num16 = this.mReseedCounter;
array16[0] = (byte)num16;
long num17 = this.mReseedCounter;
array16[0] = (byte)num17;
long num18 = this.mReseedCounter;
array16[0] = (byte)num18;
byte[] array17 = this.mV;
this.AddTo(array17, array16);
int num19 = 0;
int length6 = output.Length;
int num20 = 0;
Array.Copy(array8, num20, output, num19, length6);
return length;
}
// Token: 0x0600B602 RID: 46594 RVA: 0x00276A70 File Offset: 0x00274C70
[Token(Token = "0x600B602")]
[Address(RVA = "0x235DE70", Offset = "0x235CE70", VA = "0x18235DE70")]
private byte[] GetEntropy()
{
IEntropySource entropySource = this.mEntropySource;
int num = this.mSecurityStrength;
num += 7;
num += typeof(IEntropySource).TypeHandle;
throw new NullReferenceException();
}
// Token: 0x0600B603 RID: 46595 RVA: 0x00276A9C File Offset: 0x00274C9C
[Token(Token = "0x600B603")]
[Address(RVA = "0x235D780", Offset = "0x235C780", VA = "0x18235D780")]
private void AddTo(byte[] longer, byte[] shorter)
{
int length = shorter.Length;
int num = 0;
int num2 = longer.Length;
int num3 = length - 1;
num2 -= length;
byte b;
num += (int)b;
byte b2;
num += (int)b2;
num3 = num2 - 1;
byte b3;
num += (int)b3;
}
// Token: 0x0600B604 RID: 46596 RVA: 0x00276ADC File Offset: 0x00274CDC
[Token(Token = "0x600B604")]
[Address(RVA = "0x235DFA0", Offset = "0x235CFA0", VA = "0x18235DFA0", Slot = "6")]
public void Reseed(byte[] additionalInput)
{
byte[] entropy = this.GetEntropy();
byte[][] array = new byte[4][];
byte[] one = HashSP800Drbg.ONE;
if (one != 0)
{
}
array[0] = one;
byte[] array2 = this.mV;
if (array2 != 0)
{
}
array[1] = array2;
if (entropy != 0)
{
}
array[2] = entropy;
if (additionalInput != 0)
{
}
array[3] = additionalInput;
byte[] array3 = Arrays.ConcatenateAll(array);
IDigest digest = this.mDigest;
int num = this.mSeedLength;
byte[] array4 = DrbgUtilities.HashDF(digest, array3, num);
this.mV = array4;
int num2 = array4.Length;
num2++;
byte[] array5 = new byte[num2];
array5[0] = (byte)((ulong)0L);
byte[] array6 = this.mV;
int length = array6.Length;
int num3 = 0;
Array.Copy(array6, num3, array5, 1, length);
int num4 = this.mSeedLength;
byte[] array7 = DrbgUtilities.HashDF(this.mDigest, array5, num4);
this.mC = array7;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x0600B605 RID: 46597 RVA: 0x00276BD8 File Offset: 0x00274DD8
[Token(Token = "0x600B605")]
[Address(RVA = "0x235DF10", Offset = "0x235CF10", VA = "0x18235DF10")]
private byte[] Hash(byte[] input)
{
IDigest digest = this.mDigest;
byte[] array = new byte[0];
this.DoHash(input, array);
return array;
}
// Token: 0x0600B606 RID: 46598 RVA: 0x00276C04 File Offset: 0x00274E04
[Token(Token = "0x600B606")]
[Address(RVA = "0x235D870", Offset = "0x235C870", VA = "0x18235D870")]
private void DoHash(byte[] input, byte[] output)
{
IDigest digest = this.mDigest;
int length = input.Length;
IDigest digest2 = this.mDigest;
}
// Token: 0x0600B607 RID: 46599 RVA: 0x00276C2C File Offset: 0x00274E2C
[Token(Token = "0x600B607")]
[Address(RVA = "0x235EA60", Offset = "0x235DA60", VA = "0x18235EA60")]
private byte[] hashgen(byte[] input, int lengthInBits)
{
IDigest digest = this.mDigest;
byte[] array = new byte[input.Length];
int length = input.Length;
int i = 0;
int num = 0;
int num2 = 0;
Array.Copy(input, num2, array, num, length);
byte[] array2 = new byte[lengthInBits];
IDigest digest2 = this.mDigest;
byte[] array3 = new byte[array2];
this.DoHash(array, array3);
int num3 = array3.Length;
int num4 = array2.Length;
int num5 = num3 * i;
num4 -= num5;
if (num4 <= num3)
{
num3 = num4;
}
int num6 = 0;
Array.Copy(array3, num6, array2, num5, num3);
byte[] one = HashSP800Drbg.ONE;
this.AddTo(array, one);
i++;
while (i <= lengthInBits)
{
}
return array2;
}
// Token: 0x04007343 RID: 29507
[Token(Token = "0x4007343")]
private static readonly byte[] ONE = new byte[] { (byte)((ulong)1L) };
// Token: 0x04007344 RID: 29508
[Token(Token = "0x4007344")]
private static readonly long RESEED_MAX = (long)((ulong)140737488355328L);
// Token: 0x04007345 RID: 29509
[Token(Token = "0x4007345")]
private static readonly int MAX_BITS_REQUEST;
// Token: 0x04007346 RID: 29510
[Token(Token = "0x4007346")]
private static readonly IDictionary seedlens = Platform.CreateHashtable();
// Token: 0x04007347 RID: 29511
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007347")]
private readonly IDigest mDigest;
// Token: 0x04007348 RID: 29512
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007348")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007349 RID: 29513
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007349")]
private readonly int mSecurityStrength;
// Token: 0x0400734A RID: 29514
[FieldOffset(Offset = "0x24")]
[Token(Token = "0x400734A")]
private readonly int mSeedLength;
// Token: 0x0400734B RID: 29515
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x400734B")]
private byte[] mV;
// Token: 0x0400734C RID: 29516
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x400734C")]
private byte[] mC;
// Token: 0x0400734D RID: 29517
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x400734D")]
private long mReseedCounter;
}
}
@@ -0,0 +1,30 @@
using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg
{
// Token: 0x02001CB7 RID: 7351
[Token(Token = "0x2001CB7")]
public interface ISP80090Drbg
{
// Token: 0x17001C95 RID: 7317
// (get) Token: 0x0600B608 RID: 46600
[Token(Token = "0x17001C95")]
int BlockSize
{
[Token(Token = "0x600B608")]
[Address(Slot = "0")]
get;
}
// Token: 0x0600B609 RID: 46601
[Token(Token = "0x600B609")]
[Address(Slot = "1")]
int Generate(byte[] output, byte[] additionalInput, bool predictionResistant);
// Token: 0x0600B60A RID: 46602
[Token(Token = "0x600B60A")]
[Address(Slot = "2")]
void Reseed(byte[] additionalInput);
}
}
@@ -0,0 +1,34 @@
using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA4 RID: 7332
[Token(Token = "0x2001CA4")]
public abstract class EntropyUtilities
{
// Token: 0x0600B59E RID: 46494 RVA: 0x002748D8 File Offset: 0x00272AD8
[Token(Token = "0x600B59E")]
[Address(RVA = "0x235A430", Offset = "0x2359430", VA = "0x18235A430")]
public static byte[] GenerateSeed(IEntropySource entropySource, int numBytes)
{
byte[] array = new byte[numBytes];
int num = 0;
if (numBytes > 0)
{
int num2 = Math.Min(array.Length, numBytes);
int num3 = 0;
Array.Copy(array, num3, array, num, num2);
num += num2;
}
return array;
}
// Token: 0x0600B59F RID: 46495 RVA: 0x00274918 File Offset: 0x00272B18
[Token(Token = "0x600B59F")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
protected EntropyUtilities()
{
}
}
}
@@ -0,0 +1,16 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA5 RID: 7333
[Token(Token = "0x2001CA5")]
internal interface IDrbgProvider
{
// Token: 0x0600B5A0 RID: 46496
[Token(Token = "0x600B5A0")]
[Address(Slot = "0")]
ISP80090Drbg Get(IEntropySource entropySource);
}
}
@@ -0,0 +1,30 @@
using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA6 RID: 7334
[Token(Token = "0x2001CA6")]
public interface IRandomGenerator
{
// Token: 0x0600B5A1 RID: 46497
[Token(Token = "0x600B5A1")]
[Address(Slot = "0")]
void AddSeedMaterial(byte[] seed);
// Token: 0x0600B5A2 RID: 46498
[Token(Token = "0x600B5A2")]
[Address(Slot = "1")]
void AddSeedMaterial(long seed);
// Token: 0x0600B5A3 RID: 46499
[Token(Token = "0x600B5A3")]
[Address(Slot = "2")]
void NextBytes(byte[] bytes);
// Token: 0x0600B5A4 RID: 46500
[Token(Token = "0x600B5A4")]
[Address(Slot = "3")]
void NextBytes(byte[] bytes, int start, int len);
}
}
@@ -0,0 +1,139 @@
using System;
using System.Threading;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA7 RID: 7335
[Token(Token = "0x2001CA7")]
public class ReversedWindowGenerator : IRandomGenerator
{
// Token: 0x0600B5A5 RID: 46501 RVA: 0x0027492C File Offset: 0x00272B2C
[Token(Token = "0x600B5A5")]
[Address(RVA = "0x2364890", Offset = "0x2363890", VA = "0x182364890")]
public ReversedWindowGenerator(IRandomGenerator generator, int windowSize)
{
/*
An exception occurred when decompiling this method (0600B5A5)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.ReversedWindowGenerator::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.IRandomGenerator,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_20:
stloc:ArgumentNullException(var_1_2A, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("generator")))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0600B5A6 RID: 46502 RVA: 0x00274964 File Offset: 0x00272B64
[Token(Token = "0x600B5A6")]
[Address(RVA = "0x2364780", Offset = "0x2363780", VA = "0x182364780", Slot = "8")]
public virtual void AddSeedMaterial(byte[] seed)
{
int num;
do
{
num = 0;
this.windowCount = num;
IRandomGenerator randomGenerator = this.generator;
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B5A7 RID: 46503 RVA: 0x00274994 File Offset: 0x00272B94
[Token(Token = "0x600B5A7")]
[Address(RVA = "0x2364640", Offset = "0x2363640", VA = "0x182364640", Slot = "9")]
public virtual void AddSeedMaterial(long seed)
{
int num;
do
{
num = 0;
int num2 = 0;
this.windowCount = num;
IRandomGenerator randomGenerator = this.generator;
if (num < num2)
{
num += num;
num++;
}
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B5A8 RID: 46504 RVA: 0x002749D0 File Offset: 0x00272BD0
[Token(Token = "0x600B5A8")]
[Address(RVA = "0x2364860", Offset = "0x2363860", VA = "0x182364860", Slot = "10")]
public virtual void NextBytes(byte[] bytes)
{
int length = bytes.Length;
int num = 0;
this.doNextBytes(bytes, num, length);
}
// Token: 0x0600B5A9 RID: 46505 RVA: 0x002749F8 File Offset: 0x00272BF8
[Token(Token = "0x600B5A9")]
[Address(RVA = "0x2364850", Offset = "0x2363850", VA = "0x182364850", Slot = "11")]
public virtual void NextBytes(byte[] bytes, int start, int len)
{
this.doNextBytes(bytes, start, len);
}
// Token: 0x0600B5AA RID: 46506 RVA: 0x00274A10 File Offset: 0x00272C10
[Token(Token = "0x600B5AA")]
[Address(RVA = "0x2364970", Offset = "0x2363970", VA = "0x182364970")]
private void doNextBytes(byte[] bytes, int start, int len)
{
int num;
do
{
num = 0;
if (num < len)
{
int num2 = this.windowCount;
if (num2 < 1)
{
IRandomGenerator randomGenerator = this.generator;
int length = this.window.Length;
byte[] array = this.window;
}
byte[] array2 = this.window;
num++;
int num3 = num2 - 1;
this.windowCount = num3;
}
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x040072FC RID: 29436
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072FC")]
private readonly IRandomGenerator generator;
// Token: 0x040072FD RID: 29437
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072FD")]
private byte[] window;
// Token: 0x040072FE RID: 29438
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40072FE")]
private int windowCount;
}
}
@@ -0,0 +1,150 @@
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: 0x02001CA8 RID: 7336
[Token(Token = "0x2001CA8")]
public class SP800SecureRandom : SecureRandom
{
// Token: 0x0600B5AB RID: 46507 RVA: 0x00274A9C File Offset: 0x00272C9C
[Token(Token = "0x600B5AB")]
[Address(RVA = "0x2367C00", Offset = "0x2366C00", VA = "0x182367C00")]
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: 0x0600B5AC RID: 46508 RVA: 0x00274AD0 File Offset: 0x00272CD0
[Token(Token = "0x600B5AC")]
[Address(RVA = "0x2367B50", Offset = "0x2366B50", VA = "0x182367B50", Slot = "11")]
public override void SetSeed(byte[] seed)
{
int num;
do
{
num = 0;
if (this.mRandomSource != 0)
{
}
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B5AD RID: 46509 RVA: 0x00274AF4 File Offset: 0x00272CF4
[Token(Token = "0x600B5AD")]
[Address(RVA = "0x2367AA0", Offset = "0x2366AA0", VA = "0x182367AA0", 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: 0x0600B5AE RID: 46510 RVA: 0x00274B20 File Offset: 0x00272D20
[Token(Token = "0x600B5AE")]
[Address(RVA = "0x2367830", Offset = "0x2366830", VA = "0x182367830", 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: 0x0600B5AF RID: 46511 RVA: 0x00274B8C File Offset: 0x00272D8C
[Token(Token = "0x600B5AF")]
[Address(RVA = "0x2367780", Offset = "0x2366780", VA = "0x182367780", 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: 0x0600B5B0 RID: 46512 RVA: 0x00274BB4 File Offset: 0x00272DB4
[Token(Token = "0x600B5B0")]
[Address(RVA = "0x2367770", Offset = "0x2366770", VA = "0x182367770", Slot = "10")]
public override byte[] GenerateSeed(int numBytes)
{
return EntropyUtilities.GenerateSeed(this.mEntropySource, numBytes);
}
// Token: 0x0600B5B1 RID: 46513 RVA: 0x00274BD0 File Offset: 0x00272DD0
[Token(Token = "0x600B5B1")]
[Address(RVA = "0x23679A0", Offset = "0x23669A0", VA = "0x1823679A0", 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: 0x040072FF RID: 29439
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40072FF")]
private readonly IDrbgProvider mDrbgProvider;
// Token: 0x04007300 RID: 29440
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007300")]
private readonly bool mPredictionResistant;
// Token: 0x04007301 RID: 29441
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007301")]
private readonly SecureRandom mRandomSource;
// Token: 0x04007302 RID: 29442
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007302")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007303 RID: 29443
[FieldOffset(Offset = "0x48")]
[Token(Token = "0x4007303")]
private ISP80090Drbg mDrbg;
}
}
@@ -0,0 +1,364 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CA9 RID: 7337
[Token(Token = "0x2001CA9")]
public class SP800SecureRandomBuilder
{
// Token: 0x0600B5B2 RID: 46514 RVA: 0x00274C10 File Offset: 0x00272E10
[Token(Token = "0x600B5B2")]
[Address(RVA = "0x23675E0", Offset = "0x23665E0", VA = "0x1823675E0")]
public SP800SecureRandomBuilder()
{
SecureRandom secureRandom = new SecureRandom();
this.mSecurityStrength = (int)((ulong)256L);
this.mEntropyBitsRequired = (int)((ulong)256L);
base..ctor();
this.mRandom = secureRandom;
BasicEntropySourceProvider basicEntropySourceProvider;
basicEntropySourceProvider.mSecureRandom = secureRandom;
basicEntropySourceProvider.mPredictionResistant = false;
this.mEntropySourceProvider = basicEntropySourceProvider;
}
// Token: 0x0600B5B3 RID: 46515 RVA: 0x00274C60 File Offset: 0x00272E60
[Token(Token = "0x600B5B3")]
[Address(RVA = "0x23676E0", Offset = "0x23666E0", VA = "0x1823676E0")]
public SP800SecureRandomBuilder(SecureRandom entropySource, bool predictionResistant)
{
this.mSecurityStrength = (int)((ulong)256L);
this.mEntropyBitsRequired = (int)((ulong)256L);
base..ctor();
this.mRandom = entropySource;
BasicEntropySourceProvider basicEntropySourceProvider;
basicEntropySourceProvider.mSecureRandom = entropySource;
basicEntropySourceProvider.mPredictionResistant = predictionResistant;
this.mEntropySourceProvider = basicEntropySourceProvider;
}
// Token: 0x0600B5B4 RID: 46516 RVA: 0x00274CAC File Offset: 0x00272EAC
[Token(Token = "0x600B5B4")]
[Address(RVA = "0x23676A0", Offset = "0x23666A0", VA = "0x1823676A0")]
public SP800SecureRandomBuilder(IEntropySourceProvider entropySourceProvider)
{
this.mSecurityStrength = (int)((ulong)256L);
this.mEntropyBitsRequired = (int)((ulong)256L);
base..ctor();
this.mRandom = (ulong)0L;
this.mEntropySourceProvider = entropySourceProvider;
}
// Token: 0x0600B5B5 RID: 46517 RVA: 0x00274CEC File Offset: 0x00272EEC
[Token(Token = "0x600B5B5")]
[Address(RVA = "0x493850", Offset = "0x492850", VA = "0x180493850")]
public SP800SecureRandomBuilder SetPersonalizationString(byte[] personalizationString)
{
this.mPersonalizationString = personalizationString;
return this;
}
// Token: 0x0600B5B6 RID: 46518 RVA: 0x00274D04 File Offset: 0x00272F04
[Token(Token = "0x600B5B6")]
[Address(RVA = "0x23675D0", Offset = "0x23665D0", VA = "0x1823675D0")]
public SP800SecureRandomBuilder SetSecurityStrength(int securityStrength)
{
this.mSecurityStrength = securityStrength;
return this;
}
// Token: 0x0600B5B7 RID: 46519 RVA: 0x00274D1C File Offset: 0x00272F1C
[Token(Token = "0x600B5B7")]
[Address(RVA = "0x23675C0", Offset = "0x23665C0", VA = "0x1823675C0")]
public SP800SecureRandomBuilder SetEntropyBitsRequired(int entropyBitsRequired)
{
this.mEntropyBitsRequired = entropyBitsRequired;
return this;
}
// Token: 0x0600B5B8 RID: 46520 RVA: 0x00274D34 File Offset: 0x00272F34
[Token(Token = "0x600B5B8")]
[Address(RVA = "0x23674D0", Offset = "0x23664D0", VA = "0x1823674D0")]
public SP800SecureRandom BuildHash(IDigest digest, byte[] nonce, bool predictionResistant)
{
IEntropySourceProvider entropySourceProvider = this.mEntropySourceProvider;
byte[] array = this.mPersonalizationString;
int num = this.mSecurityStrength;
SP800SecureRandomBuilder.HashDrbgProvider hashDrbgProvider;
hashDrbgProvider.mDigest = digest;
hashDrbgProvider.mNonce = nonce;
hashDrbgProvider.mPersonalizationString = array;
hashDrbgProvider.mSecurityStrength = num;
SP800SecureRandom sp800SecureRandom;
return sp800SecureRandom;
}
// Token: 0x0600B5B9 RID: 46521 RVA: 0x00274D7C File Offset: 0x00272F7C
[Token(Token = "0x600B5B9")]
[Address(RVA = "0x23672E0", Offset = "0x23662E0", VA = "0x1823672E0")]
public SP800SecureRandom BuildCtr(IBlockCipher cipher, int keySizeInBits, byte[] nonce, bool predictionResistant)
{
IEntropySourceProvider entropySourceProvider = this.mEntropySourceProvider;
byte[] array = this.mPersonalizationString;
int num = this.mSecurityStrength;
SP800SecureRandomBuilder.CtrDrbgProvider ctrDrbgProvider;
ctrDrbgProvider.mBlockCipher = cipher;
ctrDrbgProvider.mKeySizeInBits = keySizeInBits;
ctrDrbgProvider.mNonce = nonce;
ctrDrbgProvider.mPersonalizationString = array;
ctrDrbgProvider.mSecurityStrength = num;
SP800SecureRandom sp800SecureRandom;
return sp800SecureRandom;
}
// Token: 0x0600B5BA RID: 46522 RVA: 0x00274DCC File Offset: 0x00272FCC
[Token(Token = "0x600B5BA")]
[Address(RVA = "0x23673E0", Offset = "0x23663E0", VA = "0x1823673E0")]
public SP800SecureRandom BuildHMac(IMac hMac, byte[] nonce, bool predictionResistant)
{
IEntropySourceProvider entropySourceProvider = this.mEntropySourceProvider;
byte[] array = this.mPersonalizationString;
int num = this.mSecurityStrength;
SP800SecureRandomBuilder.HMacDrbgProvider hmacDrbgProvider;
hmacDrbgProvider.mHMac = hMac;
hmacDrbgProvider.mNonce = nonce;
hmacDrbgProvider.mPersonalizationString = array;
hmacDrbgProvider.mSecurityStrength = num;
SP800SecureRandom sp800SecureRandom;
return sp800SecureRandom;
}
// Token: 0x04007304 RID: 29444
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007304")]
private readonly SecureRandom mRandom;
// Token: 0x04007305 RID: 29445
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007305")]
private readonly IEntropySourceProvider mEntropySourceProvider;
// Token: 0x04007306 RID: 29446
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007306")]
private byte[] mPersonalizationString;
// Token: 0x04007307 RID: 29447
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007307")]
private int mSecurityStrength;
// Token: 0x04007308 RID: 29448
[FieldOffset(Offset = "0x2C")]
[Token(Token = "0x4007308")]
private int mEntropyBitsRequired;
// Token: 0x02001CAA RID: 7338
[Token(Token = "0x2001CAA")]
private class HashDrbgProvider : IDrbgProvider
{
// Token: 0x0600B5BB RID: 46523 RVA: 0x00274E14 File Offset: 0x00273014
[Token(Token = "0x600B5BB")]
[Address(RVA = "0x8A0F90", Offset = "0x89FF90", VA = "0x1808A0F90")]
public HashDrbgProvider(IDigest digest, byte[] nonce, byte[] personalizationString, int securityStrength)
{
this.mDigest = digest;
this.mPersonalizationString = personalizationString;
this.mSecurityStrength = 0;
this.mNonce = nonce;
}
// Token: 0x0600B5BC RID: 46524 RVA: 0x00274E44 File Offset: 0x00273044
[Token(Token = "0x600B5BC")]
[Address(RVA = "0x235D6E0", Offset = "0x235C6E0", VA = "0x18235D6E0", Slot = "4")]
public ISP80090Drbg Get(IEntropySource entropySource)
{
/*
An exception occurred when decompiling this method (0600B5BC)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg.ISP80090Drbg BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.SP800SecureRandomBuilder/HashDrbgProvider::Get(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IEntropySource)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:IDigest(var_0_06, ldfld:IDigest(HashDrbgProvider::mDigest, ldloc:HashDrbgProvider(this)))
stloc:int32(var_1_0D, ldfld:int32(HashDrbgProvider::mSecurityStrength, ldloc:HashDrbgProvider(this)))
stloc:uint8[](var_2_14, ldfld:uint8[](HashDrbgProvider::mPersonalizationString, ldloc:HashDrbgProvider(this)))
stloc:uint8[](var_3_1B, ldfld:uint8[](HashDrbgProvider::mNonce, ldloc:HashDrbgProvider(this)))
stloc:HashSP800Drbg(var_4_26, newobj:HashSP800Drbg(HashSP800Drbg::.ctor, ldloc:IDigest(var_0_06), ldloc:int32(var_1_0D), ldloc:IEntropySource(entropySource), ldloc:uint8[](var_2_14), ldloc:uint8[](var_3_1B)))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x04007309 RID: 29449
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007309")]
private readonly IDigest mDigest;
// Token: 0x0400730A RID: 29450
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400730A")]
private readonly byte[] mNonce;
// Token: 0x0400730B RID: 29451
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400730B")]
private readonly byte[] mPersonalizationString;
// Token: 0x0400730C RID: 29452
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x400730C")]
private readonly int mSecurityStrength;
}
// Token: 0x02001CAB RID: 7339
[Token(Token = "0x2001CAB")]
private class HMacDrbgProvider : IDrbgProvider
{
// Token: 0x0600B5BD RID: 46525 RVA: 0x00274E78 File Offset: 0x00273078
[Token(Token = "0x600B5BD")]
[Address(RVA = "0x8A0F90", Offset = "0x89FF90", VA = "0x1808A0F90")]
public HMacDrbgProvider(IMac hMac, byte[] nonce, byte[] personalizationString, int securityStrength)
{
this.mHMac = hMac;
this.mPersonalizationString = personalizationString;
this.mSecurityStrength = 0;
this.mNonce = nonce;
}
// Token: 0x0600B5BE RID: 46526 RVA: 0x00274EA8 File Offset: 0x002730A8
[Token(Token = "0x600B5BE")]
[Address(RVA = "0x235C010", Offset = "0x235B010", VA = "0x18235C010", Slot = "4")]
public ISP80090Drbg Get(IEntropySource entropySource)
{
/*
An exception occurred when decompiling this method (0600B5BE)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg.ISP80090Drbg BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.SP800SecureRandomBuilder/HMacDrbgProvider::Get(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IEntropySource)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:IMac(var_0_06, ldfld:IMac(HMacDrbgProvider::mHMac, ldloc:HMacDrbgProvider(this)))
stloc:int32(var_1_0D, ldfld:int32(HMacDrbgProvider::mSecurityStrength, ldloc:HMacDrbgProvider(this)))
stloc:uint8[](var_2_14, ldfld:uint8[](HMacDrbgProvider::mPersonalizationString, ldloc:HMacDrbgProvider(this)))
stloc:uint8[](var_3_1B, ldfld:uint8[](HMacDrbgProvider::mNonce, ldloc:HMacDrbgProvider(this)))
stloc:HMacSP800Drbg(var_4_26, newobj:HMacSP800Drbg(HMacSP800Drbg::.ctor, ldloc:IMac(var_0_06), ldloc:int32(var_1_0D), ldloc:IEntropySource(entropySource), ldloc:uint8[](var_2_14), ldloc:uint8[](var_3_1B)))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x0400730D RID: 29453
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400730D")]
private readonly IMac mHMac;
// Token: 0x0400730E RID: 29454
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400730E")]
private readonly byte[] mNonce;
// Token: 0x0400730F RID: 29455
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400730F")]
private readonly byte[] mPersonalizationString;
// Token: 0x04007310 RID: 29456
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007310")]
private readonly int mSecurityStrength;
}
// Token: 0x02001CAC RID: 7340
[Token(Token = "0x2001CAC")]
private class CtrDrbgProvider : IDrbgProvider
{
// Token: 0x0600B5BF RID: 46527 RVA: 0x00274EDC File Offset: 0x002730DC
[Token(Token = "0x600B5BF")]
[Address(RVA = "0x2352570", Offset = "0x2351570", VA = "0x182352570")]
public CtrDrbgProvider(IBlockCipher blockCipher, int keySizeInBits, byte[] nonce, byte[] personalizationString, int securityStrength)
{
this.mPersonalizationString = 0;
this.mBlockCipher = blockCipher;
this.mNonce = nonce;
this.mSecurityStrength = 0;
this.mKeySizeInBits = keySizeInBits;
}
// Token: 0x0600B5C0 RID: 46528 RVA: 0x00274F14 File Offset: 0x00273114
[Token(Token = "0x600B5C0")]
[Address(RVA = "0x23524C0", Offset = "0x23514C0", VA = "0x1823524C0", Slot = "4")]
public ISP80090Drbg Get(IEntropySource entropySource)
{
/*
An exception occurred when decompiling this method (0600B5C0)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.Drbg.ISP80090Drbg BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng.SP800SecureRandomBuilder/CtrDrbgProvider::Get(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IEntropySource)
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:IBlockCipher(var_0_06, ldfld:IBlockCipher(CtrDrbgProvider::mBlockCipher, ldloc:CtrDrbgProvider(this)))
stloc:int32(var_1_0D, ldfld:int32(CtrDrbgProvider::mKeySizeInBits, ldloc:CtrDrbgProvider(this)))
stloc:int32(var_2_14, ldfld:int32(CtrDrbgProvider::mSecurityStrength, ldloc:CtrDrbgProvider(this)))
stloc:uint8[](var_3_1B, ldfld:uint8[](CtrDrbgProvider::mPersonalizationString, ldloc:CtrDrbgProvider(this)))
stloc:uint8[](var_4_22, ldfld:uint8[](CtrDrbgProvider::mNonce, ldloc:CtrDrbgProvider(this)))
stloc:CtrSP800Drbg(var_5_30, newobj:CtrSP800Drbg(CtrSP800Drbg::.ctor, ldloc:IBlockCipher(var_0_06), ldloc:int32(var_1_0D), ldloc:int32(var_2_14), ldloc:IEntropySource(entropySource), ldloc:uint8[](var_3_1B), ldloc:uint8[](var_4_22)))
}
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
--- End of inner exception stack trace ---
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
*/;
}
// Token: 0x04007311 RID: 29457
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007311")]
private readonly IBlockCipher mBlockCipher;
// Token: 0x04007312 RID: 29458
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007312")]
private readonly int mKeySizeInBits;
// Token: 0x04007313 RID: 29459
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007313")]
private readonly byte[] mNonce;
// Token: 0x04007314 RID: 29460
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007314")]
private readonly byte[] mPersonalizationString;
// Token: 0x04007315 RID: 29461
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007315")]
private readonly int mSecurityStrength;
}
}
}
@@ -0,0 +1,110 @@
using System;
using System.Threading;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CAD RID: 7341
[Token(Token = "0x2001CAD")]
public class ThreadedSeedGenerator
{
// Token: 0x0600B5C1 RID: 46529 RVA: 0x00274F54 File Offset: 0x00273154
[Token(Token = "0x600B5C1")]
[Address(RVA = "0x2367FA0", Offset = "0x2366FA0", VA = "0x182367FA0")]
public byte[] GenerateSeed(int numBytes, bool fast)
{
return new ThreadedSeedGenerator.SeedGenerator().GenerateSeed(numBytes, fast);
}
// Token: 0x0600B5C2 RID: 46530 RVA: 0x00274F74 File Offset: 0x00273174
[Token(Token = "0x600B5C2")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public ThreadedSeedGenerator()
{
}
// Token: 0x02001CAE RID: 7342
[Token(Token = "0x2001CAE")]
private class SeedGenerator
{
// Token: 0x0600B5C3 RID: 46531 RVA: 0x00274F88 File Offset: 0x00273188
[Token(Token = "0x600B5C3")]
[Address(RVA = "0x2367F50", Offset = "0x2366F50", VA = "0x182367F50")]
private void Run(object ignored)
{
while (!this.stop)
{
int num = this.counter + 1;
this.counter = num;
if (this.stop)
{
break;
}
}
}
// Token: 0x0600B5C4 RID: 46532 RVA: 0x00274FB8 File Offset: 0x002731B8
[Token(Token = "0x600B5C4")]
[Address(RVA = "0x2367E40", Offset = "0x2366E40", VA = "0x182367E40")]
public byte[] GenerateSeed(int numBytes, bool fast)
{
int num;
byte[] array;
do
{
num = 0;
ThreadPriority priority = Thread.CurrentThread.Priority;
Thread.CurrentThread.Priority = ThreadPriority.Normal;
array = this.DoGenerateSeed(numBytes, fast);
Thread.CurrentThread.SetPriorityNative(numBytes);
}
while (num != 0);
return array;
}
// Token: 0x0600B5C5 RID: 46533 RVA: 0x0027500C File Offset: 0x0027320C
[Token(Token = "0x600B5C5")]
[Address(RVA = "0x2367C90", Offset = "0x2366C90", VA = "0x182367C90")]
private byte[] DoGenerateSeed(int numBytes, bool fast)
{
int num = 0;
this.counter = num;
this.stop = num != 0;
byte[] array = new byte[numBytes];
WaitCallback waitCallback = new WaitCallback(this.Run);
int num2 = 0;
bool flag = ThreadPool.QueueUserWorkItem(waitCallback);
if (this.counter == num)
{
Thread.Sleep(1);
}
int num3 = this.counter;
num += num2;
byte b;
b += b;
num++;
int length = array.Length;
num++;
this.stop = true;
return array;
}
// Token: 0x0600B5C6 RID: 46534 RVA: 0x00275088 File Offset: 0x00273288
[Token(Token = "0x600B5C6")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
public SeedGenerator()
{
}
// Token: 0x04007316 RID: 29462
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007316")]
private int counter;
// Token: 0x04007317 RID: 29463
[FieldOffset(Offset = "0x14")]
[Token(Token = "0x4007317")]
private bool stop;
}
}
}
@@ -0,0 +1,113 @@
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CAF RID: 7343
[Token(Token = "0x2001CAF")]
public class VmpcRandomGenerator : IRandomGenerator
{
// Token: 0x0600B5C7 RID: 46535 RVA: 0x0027509C File Offset: 0x0027329C
[Token(Token = "0x600B5C7")]
[Address(RVA = "0x2368540", Offset = "0x2367540", VA = "0x182368540")]
public VmpcRandomGenerator()
{
byte[] array = new byte[256];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.B31A9EA1A2718942996E7F94106F0FC798C174C8).FieldHandle);
this.P = array;
this.s = (byte)((ulong)190L);
base..ctor();
}
// Token: 0x0600B5C8 RID: 46536 RVA: 0x002750DC File Offset: 0x002732DC
[Token(Token = "0x600B5C8")]
[Address(RVA = "0x23680A0", Offset = "0x23670A0", VA = "0x1823680A0", Slot = "8")]
public virtual void AddSeedMaterial(byte[] seed)
{
int num = 0;
int length = seed.Length;
if (num < length)
{
byte[] p = this.P;
byte b = this.n;
int length2 = p.Length;
byte b2;
byte b3;
b2 += b3;
byte b4 = this.s;
b2 += b4;
byte b5;
this.s = b5;
int length3 = p.Length;
byte[] p2 = this.P;
byte b6 = this.s;
num++;
}
}
// Token: 0x0600B5C9 RID: 46537 RVA: 0x00275150 File Offset: 0x00273350
[Token(Token = "0x600B5C9")]
[Address(RVA = "0x2368200", Offset = "0x2367200", VA = "0x182368200", Slot = "9")]
public virtual void AddSeedMaterial(long seed)
{
byte[] array = Pack.UInt64_To_BE((ulong)seed);
((IRandomGenerator)this).AddSeedMaterial(array);
}
// Token: 0x0600B5CA RID: 46538 RVA: 0x0027516C File Offset: 0x0027336C
[Token(Token = "0x600B5CA")]
[Address(RVA = "0x2368500", Offset = "0x2367500", VA = "0x182368500", Slot = "10")]
public virtual void NextBytes(byte[] bytes)
{
this.NextBytes(bytes);
}
// Token: 0x0600B5CB RID: 46539 RVA: 0x00275188 File Offset: 0x00273388
[Token(Token = "0x600B5CB")]
[Address(RVA = "0x2368240", Offset = "0x2367240", VA = "0x182368240", Slot = "11")]
public virtual void NextBytes(byte[] bytes, int start, int len)
{
int num;
do
{
num = 0;
byte[] p = this.P;
byte[] p2 = this.P;
byte b = this.n;
int length = p2.Length;
byte b2 = this.s;
byte b3;
b3 += b2;
byte b4;
this.s = b4;
int length2 = p2.Length;
byte[] p3 = this.P;
byte b5 = this.n;
int length3 = p3.Length;
byte b6 = this.s;
byte[] p4 = this.P;
byte b7 = this.s;
Monitor.Exit(p);
}
while (num != 0);
}
// Token: 0x04007318 RID: 29464
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007318")]
private byte n;
// Token: 0x04007319 RID: 29465
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007319")]
private byte[] P;
// Token: 0x0400731A RID: 29466
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400731A")]
private byte s;
}
}
@@ -0,0 +1,222 @@
using System;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CB0 RID: 7344
[Token(Token = "0x2001CB0")]
internal class X931Rng
{
// Token: 0x0600B5CC RID: 46540 RVA: 0x0027528C File Offset: 0x0027348C
[Token(Token = "0x600B5CC")]
[Address(RVA = "0x2369E70", Offset = "0x2368E70", VA = "0x182369E70")]
internal X931Rng(IBlockCipher engine, byte[] dateTimeVector, IEntropySource entropySource)
{
this.mEngine = engine;
this.mEntropySource = entropySource;
byte[] array = new byte[0];
this.mDT = array;
int length = array.Length;
int num = 0;
int num2 = 0;
Array.Copy(dateTimeVector, num2, array, num, length);
byte[] array2 = new byte[array];
this.mI = array2;
byte[] array3 = new byte[array2];
this.mR = array3;
}
// Token: 0x0600B5CD RID: 46541 RVA: 0x00275304 File Offset: 0x00273504
[Token(Token = "0x600B5CD")]
[Address(RVA = "0x23697A0", Offset = "0x23687A0", VA = "0x1823697A0")]
internal int Generate(byte[] output, bool predictionResistant)
{
IBlockCipher blockCipher;
int length;
int num2;
do
{
byte[] array = this.mR;
long num = this.mReseedCounter;
if ((array.Length != 8 && output == 0) || output != 0)
{
}
if (predictionResistant || this.mV == (ulong)0L)
{
IEntropySource entropySource = this.mEntropySource;
this.mV = array;
blockCipher = this.mEngine;
if (array.Length != array)
{
continue;
}
}
byte[] array2 = this.mR;
length = output.Length;
num2 = 0;
}
while (length <= 0);
IBlockCipher blockCipher2 = this.mEngine;
int num3 = 0;
if (num3 < blockCipher)
{
num3 += num3;
num3++;
}
byte[] array3 = this.mV;
byte[] array4 = this.mI;
byte[] array5 = this.mR;
this.Process(array5, array4, array3);
byte[] array6 = this.mI;
byte[] array7 = this.mR;
byte[] array8 = this.mV;
this.Process(array8, array7, array6);
byte[] array9 = this.mR;
int length2 = array9.Length;
int num4 = length2 * num2;
int num5 = 0;
Array.Copy(array9, num5, output, num4, length2);
byte[] array10 = this.mDT;
if (array10.Length == array10.Length)
{
}
num2++;
int length3 = this.mR.Length;
int num6 = output.Length;
int num7 = length3 * length;
num6 -= num7;
if (num6 > 0)
{
IBlockCipher blockCipher3 = this.mEngine;
byte[] array11 = this.mI;
byte[] array12 = this.mV;
byte[] array13 = this.mI;
byte[] array14 = this.mR;
this.Process(array14, array13, array12);
byte[] array15 = this.mI;
byte[] array16 = this.mR;
byte[] array17 = this.mV;
this.Process(array17, array16, array15);
byte[] array18 = this.mR;
int num8 = array18.Length * length;
int num9 = 0;
Array.Copy(array18, num9, output, num8, num6);
byte[] array19 = this.mDT;
int length4 = array19.Length;
if (length4 == array19.Length)
{
}
}
return output.Length;
}
// Token: 0x0600B5CE RID: 46542 RVA: 0x0027550C File Offset: 0x0027370C
[Token(Token = "0x600B5CE")]
[Address(RVA = "0x2369DB0", Offset = "0x2368DB0", VA = "0x182369DB0")]
internal void Reseed()
{
IEntropySource entropySource = this.mEntropySource;
IBlockCipher blockCipher = this.mEngine;
this.mReseedCounter = (long)((ulong)1L);
}
// Token: 0x17001C91 RID: 7313
// (get) Token: 0x0600B5CF RID: 46543 RVA: 0x00275544 File Offset: 0x00273744
[Token(Token = "0x17001C91")]
internal IEntropySource EntropySource
{
[Token(Token = "0x600B5CF")]
[Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0")]
get
{
return this.mEntropySource;
}
}
// Token: 0x0600B5D0 RID: 46544 RVA: 0x00275558 File Offset: 0x00273758
[Token(Token = "0x600B5D0")]
[Address(RVA = "0x2369CB0", Offset = "0x2368CB0", VA = "0x182369CB0")]
private void Process(byte[] res, byte[] a, byte[] b)
{
int num = 0;
int length = res.Length;
if (num != length)
{
num++;
}
IBlockCipher blockCipher = this.mEngine;
}
// Token: 0x0600B5D1 RID: 46545 RVA: 0x00275584 File Offset: 0x00273784
[Token(Token = "0x600B5D1")]
[Address(RVA = "0x2369C60", Offset = "0x2368C60", VA = "0x182369C60")]
private void Increment(byte[] val)
{
if (val.Length == val.Length)
{
}
}
// Token: 0x0600B5D2 RID: 46546 RVA: 0x002755A8 File Offset: 0x002737A8
[Token(Token = "0x600B5D2")]
[Address(RVA = "0x2355420", Offset = "0x2354420", VA = "0x182355420")]
private static bool IsTooLarge(byte[] bytes, int maxBytes)
{
if (bytes == 0)
{
}
return bytes.Length > maxBytes;
}
// Token: 0x0400731B RID: 29467
[Token(Token = "0x400731B")]
private const long BLOCK64_RESEED_MAX = 32768L;
// Token: 0x0400731C RID: 29468
[Token(Token = "0x400731C")]
private const long BLOCK128_RESEED_MAX = 8388608L;
// Token: 0x0400731D RID: 29469
[Token(Token = "0x400731D")]
private const int BLOCK64_MAX_BITS_REQUEST = 4096;
// Token: 0x0400731E RID: 29470
[Token(Token = "0x400731E")]
private const int BLOCK128_MAX_BITS_REQUEST = 262144;
// Token: 0x0400731F RID: 29471
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400731F")]
private readonly IBlockCipher mEngine;
// Token: 0x04007320 RID: 29472
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007320")]
private readonly IEntropySource mEntropySource;
// Token: 0x04007321 RID: 29473
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007321")]
private readonly byte[] mDT;
// Token: 0x04007322 RID: 29474
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007322")]
private readonly byte[] mI;
// Token: 0x04007323 RID: 29475
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007323")]
private readonly byte[] mR;
// Token: 0x04007324 RID: 29476
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007324")]
private byte[] mV;
// Token: 0x04007325 RID: 29477
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007325")]
private long mReseedCounter = (long)((ulong)1L);
}
}
@@ -0,0 +1,119 @@
using System;
using System.Threading;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Prng
{
// Token: 0x02001CB1 RID: 7345
[Token(Token = "0x2001CB1")]
public class X931SecureRandom : SecureRandom
{
// Token: 0x0600B5D3 RID: 46547 RVA: 0x002755C4 File Offset: 0x002737C4
[Token(Token = "0x600B5D3")]
[Address(RVA = "0x236A770", Offset = "0x2369770", VA = "0x18236A770")]
internal X931SecureRandom(SecureRandom randomSource, X931Rng drbg, bool predictionResistant)
{
int num = 0;
base..ctor(num);
this.mRandomSource = randomSource;
this.mDrbg = drbg;
this.mPredictionResistant = predictionResistant;
}
// Token: 0x0600B5D4 RID: 46548 RVA: 0x002755F0 File Offset: 0x002737F0
[Token(Token = "0x600B5D4")]
[Address(RVA = "0x236A610", Offset = "0x2369610", VA = "0x18236A610", Slot = "11")]
public override void SetSeed(byte[] seed)
{
int num;
do
{
num = 0;
if (this.mRandomSource != 0)
{
}
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B5D5 RID: 46549 RVA: 0x00275614 File Offset: 0x00273814
[Token(Token = "0x600B5D5")]
[Address(RVA = "0x236A6C0", Offset = "0x23696C0", VA = "0x18236A6C0", 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: 0x0600B5D6 RID: 46550 RVA: 0x00275640 File Offset: 0x00273840
[Token(Token = "0x600B5D6")]
[Address(RVA = "0x236A460", Offset = "0x2369460", VA = "0x18236A460", Slot = "9")]
public override void NextBytes(byte[] bytes)
{
int num;
do
{
num = 0;
X931Rng x931Rng = this.mDrbg;
bool flag = this.mPredictionResistant;
int num2 = x931Rng.Generate(bytes, flag);
X931Rng x931Rng2 = this.mDrbg;
IEntropySource mEntropySource = x931Rng2.mEntropySource;
x931Rng2.mV = num2;
IBlockCipher mEngine = x931Rng2.mEngine;
x931Rng2.mReseedCounter = (long)((ulong)1L);
X931Rng x931Rng3 = this.mDrbg;
bool flag2 = this.mPredictionResistant;
int num3 = x931Rng3.Generate(bytes, flag2);
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B5D7 RID: 46551 RVA: 0x002756E8 File Offset: 0x002738E8
[Token(Token = "0x600B5D7")]
[Address(RVA = "0x236A3B0", Offset = "0x23693B0", VA = "0x18236A3B0", 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: 0x0600B5D8 RID: 46552 RVA: 0x00275710 File Offset: 0x00273910
[Token(Token = "0x600B5D8")]
[Address(RVA = "0x236A380", Offset = "0x2369380", VA = "0x18236A380", Slot = "10")]
public override byte[] GenerateSeed(int numBytes)
{
return EntropyUtilities.GenerateSeed(this.mDrbg.mEntropySource, numBytes);
}
// Token: 0x04007326 RID: 29478
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007326")]
private readonly bool mPredictionResistant;
// Token: 0x04007327 RID: 29479
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007327")]
private readonly SecureRandom mRandomSource;
// Token: 0x04007328 RID: 29480
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007328")]
private readonly X931Rng mDrbg;
}
}
@@ -0,0 +1,111 @@
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;
}
}