225 lines
8.4 KiB
C#
225 lines
8.4 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x02001655 RID: 5717
|
|
[Token(Token = "0x2001655")]
|
|
[StructLayout(3)]
|
|
public sealed class CbcBlockCipher : IBlockCipher
|
|
{
|
|
// Token: 0x06009843 RID: 38979 RVA: 0x0021BB08 File Offset: 0x00219D08
|
|
[Token(Token = "0x6009843")]
|
|
[Address(RVA = "0x20E5A90", Offset = "0x20E4490", VA = "0x1820E5A90")]
|
|
public CbcBlockCipher(IBlockCipher cipher)
|
|
{
|
|
this.cipher = cipher;
|
|
byte[] array = new byte[0];
|
|
int num = this.blockSize;
|
|
this.IV = array;
|
|
byte[] array2 = new byte[num];
|
|
int num2 = this.blockSize;
|
|
this.cbcV = array2;
|
|
byte[] array3 = new byte[num2];
|
|
this.cbcNextV = array3;
|
|
}
|
|
|
|
// Token: 0x06009844 RID: 38980 RVA: 0x0021BB64 File Offset: 0x00219D64
|
|
[Token(Token = "0x6009844")]
|
|
[Address(RVA = "0x3C1250", Offset = "0x3BFC50", VA = "0x1803C1250")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x06009845 RID: 38981 RVA: 0x0021BB78 File Offset: 0x00219D78
|
|
[Token(Token = "0x6009845")]
|
|
[Address(RVA = "0x20E5520", Offset = "0x20E3F20", VA = "0x1820E5520", Slot = "5")]
|
|
public void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009845)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes.CbcBlockCipher::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_C0:
|
|
stloc:ArgumentException(var_20_CA, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("initialisation vector must be the same length as block size")))
|
|
}
|
|
|
|
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: 0x17001874 RID: 6260
|
|
// (get) Token: 0x06009846 RID: 38982 RVA: 0x0021BC50 File Offset: 0x00219E50
|
|
[Token(Token = "0x17001874")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009846")]
|
|
[Address(RVA = "0x20E5B30", Offset = "0x20E4530", VA = "0x1820E5B30", Slot = "4")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/CBC";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001875 RID: 6261
|
|
// (get) Token: 0x06009847 RID: 38983 RVA: 0x0021BC78 File Offset: 0x00219E78
|
|
[Token(Token = "0x17001875")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x6009847")]
|
|
[Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "7")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009848 RID: 38984 RVA: 0x0021BC88 File Offset: 0x00219E88
|
|
[Token(Token = "0x6009848")]
|
|
[Address(RVA = "0x20E54D0", Offset = "0x20E3ED0", VA = "0x1820E54D0", Slot = "6")]
|
|
public int GetBlockSize()
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009849 RID: 38985 RVA: 0x0021BCA4 File Offset: 0x00219EA4
|
|
[Token(Token = "0x6009849")]
|
|
[Address(RVA = "0x20E5750", Offset = "0x20E4150", VA = "0x1820E5750", Slot = "8")]
|
|
public int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
if (this.encrypting)
|
|
{
|
|
int num = this.blockSize;
|
|
int num2 = 0;
|
|
if (num > 0)
|
|
{
|
|
byte[] array = this.cbcV;
|
|
num2 += array;
|
|
num2++;
|
|
}
|
|
IBlockCipher blockCipher = this.cipher;
|
|
int length = this.cbcV.Length;
|
|
return inOff;
|
|
}
|
|
int num3 = this.blockSize;
|
|
byte[] array2 = this.cbcNextV;
|
|
int num4 = 0;
|
|
int num5 = 0;
|
|
Array.Copy(input, inOff, array2, num5, num3);
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
if (this.blockSize > num4)
|
|
{
|
|
byte[] array3 = this.cbcV;
|
|
num4++;
|
|
}
|
|
byte[] array4 = this.cbcNextV;
|
|
byte[] array5 = this.cbcV;
|
|
this.cbcV = array4;
|
|
this.cbcNextV = array5;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600984A RID: 38986 RVA: 0x0021BD54 File Offset: 0x00219F54
|
|
[Token(Token = "0x600984A")]
|
|
[Address(RVA = "0x20E5A00", Offset = "0x20E4400", VA = "0x1820E5A00", Slot = "9")]
|
|
public void Reset()
|
|
{
|
|
byte[] iv = this.IV;
|
|
int length = iv.Length;
|
|
int num = 0;
|
|
byte[] array = this.cbcV;
|
|
int num2 = 0;
|
|
Array.Copy(iv, num2, array, num, length);
|
|
byte[] array2 = this.cbcNextV;
|
|
int length2 = array2.Length;
|
|
int num3 = 0;
|
|
Array.Clear(array2, num3, length2);
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600984B RID: 38987 RVA: 0x0021BDB4 File Offset: 0x00219FB4
|
|
[Token(Token = "0x600984B")]
|
|
[Address(RVA = "0x20E5360", Offset = "0x20E3D60", VA = "0x1820E5360")]
|
|
private int EncryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int num = this.blockSize;
|
|
int num2 = 0;
|
|
if (num > 0)
|
|
{
|
|
byte[] array = this.cbcV;
|
|
num2 += array;
|
|
num2++;
|
|
}
|
|
IBlockCipher blockCipher = this.cipher;
|
|
int length = this.cbcV.Length;
|
|
return inOff;
|
|
}
|
|
|
|
// Token: 0x0600984C RID: 38988 RVA: 0x0021BDF8 File Offset: 0x00219FF8
|
|
[Token(Token = "0x600984C")]
|
|
[Address(RVA = "0x20E51F0", Offset = "0x20E3BF0", VA = "0x1820E51F0")]
|
|
private int DecryptBlock(byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
int num = this.blockSize;
|
|
byte[] array = this.cbcNextV;
|
|
int num2 = 0;
|
|
int num3 = 0;
|
|
Array.Copy(input, inOff, array, num3, num);
|
|
IBlockCipher blockCipher = this.cipher;
|
|
if (this.blockSize > num2)
|
|
{
|
|
byte[] array2 = this.cbcV;
|
|
num2++;
|
|
}
|
|
byte[] array3 = this.cbcNextV;
|
|
byte[] array4 = this.cbcV;
|
|
this.cbcV = array3;
|
|
this.cbcNextV = array4;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0400640B RID: 25611
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400640B")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x0400640C RID: 25612
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400640C")]
|
|
private byte[] cbcV;
|
|
|
|
// Token: 0x0400640D RID: 25613
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400640D")]
|
|
private byte[] cbcNextV;
|
|
|
|
// Token: 0x0400640E RID: 25614
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400640E")]
|
|
private int blockSize;
|
|
|
|
// Token: 0x0400640F RID: 25615
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400640F")]
|
|
private IBlockCipher cipher;
|
|
|
|
// Token: 0x04006410 RID: 25616
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006410")]
|
|
private bool encrypting;
|
|
}
|
|
}
|