Files
27Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Engines/DesEdeWrapEngine.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

216 lines
14 KiB
C#

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.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
{
// Token: 0x02001D6D RID: 7533
[Token(Token = "0x2001D6D")]
public class DesEdeWrapEngine : IWrapper
{
// Token: 0x0600BB2C RID: 47916 RVA: 0x00291B8C File Offset: 0x0028FD8C
[Token(Token = "0x600BB2C")]
[Address(RVA = "0x27E77A0", Offset = "0x27E67A0", VA = "0x1827E77A0", Slot = "8")]
public virtual void Init(bool forWrapping, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600BB2C)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.DesEdeWrapEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_E5:
stloc:ArgumentException(var_16_F4, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("IV is not 8 octets"), ldstr:string("parameters")))
}
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: 0x17001D64 RID: 7524
// (get) Token: 0x0600BB2D RID: 47917 RVA: 0x00291C90 File Offset: 0x0028FE90
[Token(Token = "0x17001D64")]
public virtual string AlgorithmName
{
[Token(Token = "0x600BB2D")]
[Address(RVA = "0x27E83D0", Offset = "0x27E73D0", VA = "0x1827E83D0", Slot = "9")]
get
{
return "DESede";
}
}
// Token: 0x0600BB2E RID: 47918 RVA: 0x00291CA4 File Offset: 0x0028FEA4
[Token(Token = "0x600BB2E")]
[Address(RVA = "0x27E7FC0", Offset = "0x27E6FC0", VA = "0x1827E7FC0", Slot = "10")]
public virtual byte[] Wrap(byte[] input, int inOff, int length)
{
/*
An exception occurred when decompiling this method (0600BB2E)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.DesEdeWrapEngine::Wrap(System.Byte[],System.Int32,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_19D:
stloc:InvalidOperationException(var_34_1A7, 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 1663
*/;
}
// Token: 0x0600BB2F RID: 47919 RVA: 0x00291E5C File Offset: 0x0029005C
[Token(Token = "0x600BB2F")]
[Address(RVA = "0x27E7B60", Offset = "0x27E6B60", VA = "0x1827E7B60", Slot = "11")]
public virtual byte[] Unwrap(byte[] input, int inOff, int length)
{
/*
An exception occurred when decompiling this method (0600BB2F)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.DesEdeWrapEngine::Unwrap(System.Byte[],System.Int32,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_1C0:
stloc:InvalidCipherTextException(var_39_1D0, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, call:string(string::Concat, ldstr:string[exp:object]("Ciphertext not multiple of "), ldloc:int32[exp:object](var_2))))
}
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.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: 0x0600BB30 RID: 47920 RVA: 0x0029203C File Offset: 0x0029023C
[Token(Token = "0x600BB30")]
[Address(RVA = "0x27E7640", Offset = "0x27E6640", VA = "0x1827E7640")]
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: 0x0600BB31 RID: 47921 RVA: 0x0029208C File Offset: 0x0029028C
[Token(Token = "0x600BB31")]
[Address(RVA = "0x27E7720", Offset = "0x27E6720", VA = "0x1827E7720")]
private bool CheckCmsKeyChecksum(byte[] key, byte[] checksum)
{
return Arrays.ConstantTimeAreEqual(this.CalculateCmsKeyChecksum(key), checksum);
}
// Token: 0x0600BB32 RID: 47922 RVA: 0x002920A8 File Offset: 0x002902A8
[Token(Token = "0x600BB32")]
[Address(RVA = "0x27E8400", Offset = "0x27E7400", VA = "0x1827E8400")]
private static byte[] reverse(byte[] bs)
{
byte[] array = new byte[bs.Length];
int num = 0;
int num2 = bs.Length;
if (num < num2)
{
num2 -= num;
num++;
}
return array;
}
// Token: 0x0600BB33 RID: 47923 RVA: 0x002920E0 File Offset: 0x002902E0
[Token(Token = "0x600BB33")]
[Address(RVA = "0x27E8360", Offset = "0x27E7360", VA = "0x1827E8360")]
public DesEdeWrapEngine()
{
Sha1Digest sha1Digest = new Sha1Digest();
this.sha1 = sha1Digest;
byte[] array = new byte[20];
this.digest = array;
base..ctor();
}
// Token: 0x0600BB34 RID: 47924 RVA: 0x00292110 File Offset: 0x00290310
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600BB34")]
[Address(RVA = "0x27E8300", Offset = "0x27E7300", VA = "0x1827E8300")]
static DesEdeWrapEngine()
{
byte[] array = new byte[8];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.6DFD60679846B0E2064404E9EA3E1DDCE2C5709D).FieldHandle);
DesEdeWrapEngine.IV2 = array;
}
// Token: 0x040075FC RID: 30204
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40075FC")]
private CbcBlockCipher engine;
// Token: 0x040075FD RID: 30205
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40075FD")]
private KeyParameter param;
// Token: 0x040075FE RID: 30206
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40075FE")]
private ParametersWithIV paramPlusIV;
// Token: 0x040075FF RID: 30207
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40075FF")]
private byte[] iv;
// Token: 0x04007600 RID: 30208
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007600")]
private bool forWrapping;
// Token: 0x04007601 RID: 30209
[Token(Token = "0x4007601")]
private static readonly byte[] IV2;
// Token: 0x04007602 RID: 30210
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007602")]
private readonly IDigest sha1;
// Token: 0x04007603 RID: 30211
[FieldOffset(Offset = "0x40")]
[Token(Token = "0x4007603")]
private readonly byte[] digest;
}
}