223 lines
8.2 KiB
C#
223 lines
8.2 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x02001C32 RID: 7218
|
|
[Token(Token = "0x2001C32")]
|
|
public sealed class CbcBlockCipher : IBlockCipher
|
|
{
|
|
// Token: 0x0600B41D RID: 46109 RVA: 0x00273124 File Offset: 0x00271324
|
|
[Token(Token = "0x600B41D")]
|
|
[Address(RVA = "0x1C1BBA0", Offset = "0x1C1A9A0", VA = "0x181C1BBA0")]
|
|
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: 0x0600B41E RID: 46110 RVA: 0x00273180 File Offset: 0x00271380
|
|
[Token(Token = "0x600B41E")]
|
|
[Address(RVA = "0x3FA180", Offset = "0x3F8F80", VA = "0x1803FA180")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x0600B41F RID: 46111 RVA: 0x00273194 File Offset: 0x00271394
|
|
[Token(Token = "0x600B41F")]
|
|
[Address(RVA = "0x1C1B630", Offset = "0x1C1A430", VA = "0x181C1B630", Slot = "5")]
|
|
public void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B41F)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x17001C75 RID: 7285
|
|
// (get) Token: 0x0600B420 RID: 46112 RVA: 0x0027326C File Offset: 0x0027146C
|
|
[Token(Token = "0x17001C75")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B420")]
|
|
[Address(RVA = "0x1C1BC40", Offset = "0x1C1AA40", VA = "0x181C1BC40", Slot = "4")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/CBC";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C76 RID: 7286
|
|
// (get) Token: 0x0600B421 RID: 46113 RVA: 0x00273294 File Offset: 0x00271494
|
|
[Token(Token = "0x17001C76")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B421")]
|
|
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "7")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B422 RID: 46114 RVA: 0x002732A4 File Offset: 0x002714A4
|
|
[Token(Token = "0x600B422")]
|
|
[Address(RVA = "0x1C1B5E0", Offset = "0x1C1A3E0", VA = "0x181C1B5E0", Slot = "6")]
|
|
public int GetBlockSize()
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B423 RID: 46115 RVA: 0x002732C0 File Offset: 0x002714C0
|
|
[Token(Token = "0x600B423")]
|
|
[Address(RVA = "0x1C1B860", Offset = "0x1C1A660", VA = "0x181C1B860", 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: 0x0600B424 RID: 46116 RVA: 0x00273370 File Offset: 0x00271570
|
|
[Token(Token = "0x600B424")]
|
|
[Address(RVA = "0x1C1BB10", Offset = "0x1C1A910", VA = "0x181C1BB10", 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: 0x0600B425 RID: 46117 RVA: 0x002733D0 File Offset: 0x002715D0
|
|
[Token(Token = "0x600B425")]
|
|
[Address(RVA = "0x1C1B470", Offset = "0x1C1A270", VA = "0x181C1B470")]
|
|
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: 0x0600B426 RID: 46118 RVA: 0x00273414 File Offset: 0x00271614
|
|
[Token(Token = "0x600B426")]
|
|
[Address(RVA = "0x1C1B300", Offset = "0x1C1A100", VA = "0x181C1B300")]
|
|
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: 0x0400724E RID: 29262
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400724E")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x0400724F RID: 29263
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400724F")]
|
|
private byte[] cbcV;
|
|
|
|
// Token: 0x04007250 RID: 29264
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007250")]
|
|
private byte[] cbcNextV;
|
|
|
|
// Token: 0x04007251 RID: 29265
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007251")]
|
|
private int blockSize;
|
|
|
|
// Token: 0x04007252 RID: 29266
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007252")]
|
|
private IBlockCipher cipher;
|
|
|
|
// Token: 0x04007253 RID: 29267
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007253")]
|
|
private bool encrypting;
|
|
}
|
|
}
|