a
This commit is contained in:
+225
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
||||
{
|
||||
// Token: 0x02001C9C RID: 7324
|
||||
[Token(Token = "0x2001C9C")]
|
||||
public class RC2WrapEngine : IWrapper
|
||||
{
|
||||
// Token: 0x0600B819 RID: 47129 RVA: 0x0028DF78 File Offset: 0x0028C178
|
||||
[Token(Token = "0x600B819")]
|
||||
[Address(RVA = "0x1DF0590", Offset = "0x1DEF390", VA = "0x181DF0590", Slot = "8")]
|
||||
public virtual void Init(bool forWrapping, ICipherParameters parameters)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
this.forWrapping = forWrapping;
|
||||
CbcBlockCipher cbcBlockCipher = new CbcBlockCipher(new RC2Engine());
|
||||
this.engine = cbcBlockCipher;
|
||||
if (parameters != 0 && parameters != 0)
|
||||
{
|
||||
int num = 0;
|
||||
if (parameters == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
this.sr = num;
|
||||
}
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
this.sr = secureRandom;
|
||||
if (parameters == 0 || parameters == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (forWrapping && parameters != 0)
|
||||
{
|
||||
this.paramPlusIV = parameters;
|
||||
ParametersWithIV parametersWithIV = this.paramPlusIV;
|
||||
byte[] array;
|
||||
this.iv = array;
|
||||
ICipherParameters cipherParameters = parametersWithIV.parameters;
|
||||
if (array.Length == 8)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.parameters = parameters;
|
||||
if (this.forWrapping != parameters)
|
||||
{
|
||||
byte[] array2 = new byte[8];
|
||||
SecureRandom secureRandom2 = this.sr;
|
||||
this.iv = array2;
|
||||
double num2 = secureRandom2.NextDouble();
|
||||
ICipherParameters cipherParameters2 = this.parameters;
|
||||
byte[] array3 = this.iv;
|
||||
ParametersWithIV parametersWithIV2 = new ParametersWithIV(cipherParameters2, array3);
|
||||
this.paramPlusIV = parametersWithIV2;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001CDD RID: 7389
|
||||
// (get) Token: 0x0600B81A RID: 47130 RVA: 0x0028E05C File Offset: 0x0028C25C
|
||||
[Token(Token = "0x17001CDD")]
|
||||
public virtual string AlgorithmName
|
||||
{
|
||||
[Token(Token = "0x600B81A")]
|
||||
[Address(RVA = "0x1DF1460", Offset = "0x1DF0260", VA = "0x181DF1460", Slot = "9")]
|
||||
get
|
||||
{
|
||||
return "RC2";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600B81B RID: 47131 RVA: 0x0028E070 File Offset: 0x0028C270
|
||||
[Token(Token = "0x600B81B")]
|
||||
[Address(RVA = "0x1DF0ED0", Offset = "0x1DEFCD0", VA = "0x181DF0ED0", Slot = "10")]
|
||||
public virtual byte[] Wrap(byte[] input, int inOff, int length)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600B81B)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC2WrapEngine::Wrap(System.Byte[],System.Int32,System.Int32)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_27B:
|
||||
stloc:InvalidOperationException(var_52_285, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Not multiple of block length")))
|
||||
}
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0600B81C RID: 47132 RVA: 0x0028E304 File Offset: 0x0028C504
|
||||
[Token(Token = "0x600B81C")]
|
||||
[Address(RVA = "0x1DF0880", Offset = "0x1DEF680", VA = "0x181DF0880", Slot = "11")]
|
||||
public virtual byte[] Unwrap(byte[] input, int inOff, int length)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600B81C)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.RC2WrapEngine::Unwrap(System.Byte[],System.Int32,System.Int32)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_29E:
|
||||
stloc:InvalidOperationException(var_58_2A8, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Not set for unwrapping")))
|
||||
}
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0600B81D RID: 47133 RVA: 0x0028E5BC File Offset: 0x0028C7BC
|
||||
[Token(Token = "0x600B81D")]
|
||||
[Address(RVA = "0x1DF0430", Offset = "0x1DEF230", VA = "0x181DF0430")]
|
||||
private byte[] CalculateCmsKeyChecksum(byte[] key)
|
||||
{
|
||||
IDigest digest = this.sha1;
|
||||
int length = key.Length;
|
||||
IDigest digest2 = this.sha1;
|
||||
byte[] array = new byte[8];
|
||||
byte[] array2 = this.digest;
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
ulong num3;
|
||||
Array.Copy(array2, num2, array, num, (int)num3);
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600B81E RID: 47134 RVA: 0x0028E60C File Offset: 0x0028C80C
|
||||
[Token(Token = "0x600B81E")]
|
||||
[Address(RVA = "0x1DF0510", Offset = "0x1DEF310", VA = "0x181DF0510")]
|
||||
private bool CheckCmsKeyChecksum(byte[] key, byte[] checksum)
|
||||
{
|
||||
return Arrays.ConstantTimeAreEqual(this.CalculateCmsKeyChecksum(key), checksum);
|
||||
}
|
||||
|
||||
// Token: 0x0600B81F RID: 47135 RVA: 0x0028E628 File Offset: 0x0028C828
|
||||
[Token(Token = "0x600B81F")]
|
||||
[Address(RVA = "0x1DF13F0", Offset = "0x1DF01F0", VA = "0x181DF13F0")]
|
||||
public RC2WrapEngine()
|
||||
{
|
||||
Sha1Digest sha1Digest = new Sha1Digest();
|
||||
this.sha1 = sha1Digest;
|
||||
byte[] array = new byte[20];
|
||||
this.digest = array;
|
||||
base..ctor();
|
||||
}
|
||||
|
||||
// Token: 0x0600B820 RID: 47136 RVA: 0x0028E658 File Offset: 0x0028C858
|
||||
// Note: this type is marked as 'beforefieldinit'.
|
||||
[Token(Token = "0x600B820")]
|
||||
[Address(RVA = "0x1DF1390", Offset = "0x1DF0190", VA = "0x181DF1390")]
|
||||
static RC2WrapEngine()
|
||||
{
|
||||
byte[] array = new byte[8];
|
||||
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.6DFD60679846B0E2064404E9EA3E1DDCE2C5709D).FieldHandle);
|
||||
RC2WrapEngine.IV2 = array;
|
||||
}
|
||||
|
||||
// Token: 0x040074BC RID: 29884
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x40074BC")]
|
||||
private CbcBlockCipher engine;
|
||||
|
||||
// Token: 0x040074BD RID: 29885
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x40074BD")]
|
||||
private ICipherParameters parameters;
|
||||
|
||||
// Token: 0x040074BE RID: 29886
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x40074BE")]
|
||||
private ParametersWithIV paramPlusIV;
|
||||
|
||||
// Token: 0x040074BF RID: 29887
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x40074BF")]
|
||||
private byte[] iv;
|
||||
|
||||
// Token: 0x040074C0 RID: 29888
|
||||
[FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x40074C0")]
|
||||
private bool forWrapping;
|
||||
|
||||
// Token: 0x040074C1 RID: 29889
|
||||
[FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x40074C1")]
|
||||
private SecureRandom sr;
|
||||
|
||||
// Token: 0x040074C2 RID: 29890
|
||||
[Token(Token = "0x40074C2")]
|
||||
private static readonly byte[] IV2;
|
||||
|
||||
// Token: 0x040074C3 RID: 29891
|
||||
[FieldOffset(Offset = "0x40")]
|
||||
[Token(Token = "0x40074C3")]
|
||||
private IDigest sha1;
|
||||
|
||||
// Token: 0x040074C4 RID: 29892
|
||||
[FieldOffset(Offset = "0x48")]
|
||||
[Token(Token = "0x40074C4")]
|
||||
private byte[] digest;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user