223 lines
8.2 KiB
C#
223 lines
8.2 KiB
C#
using System;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x02001D12 RID: 7442
|
|
[Token(Token = "0x2001D12")]
|
|
public sealed class CbcBlockCipher : IBlockCipher
|
|
{
|
|
// Token: 0x0600B7EB RID: 47083 RVA: 0x0027C31C File Offset: 0x0027A51C
|
|
[Token(Token = "0x600B7EB")]
|
|
[Address(RVA = "0x25B2B40", Offset = "0x25B1B40", VA = "0x1825B2B40")]
|
|
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: 0x0600B7EC RID: 47084 RVA: 0x0027C378 File Offset: 0x0027A578
|
|
[Token(Token = "0x600B7EC")]
|
|
[Address(RVA = "0x4157E0", Offset = "0x4147E0", VA = "0x1804157E0")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x0600B7ED RID: 47085 RVA: 0x0027C38C File Offset: 0x0027A58C
|
|
[Token(Token = "0x600B7ED")]
|
|
[Address(RVA = "0x25B25D0", Offset = "0x25B15D0", VA = "0x1825B25D0", Slot = "5")]
|
|
public void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B7ED)
|
|
|
|
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: 0x17001D12 RID: 7442
|
|
// (get) Token: 0x0600B7EE RID: 47086 RVA: 0x0027C464 File Offset: 0x0027A664
|
|
[Token(Token = "0x17001D12")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B7EE")]
|
|
[Address(RVA = "0x25B2BE0", Offset = "0x25B1BE0", VA = "0x1825B2BE0", Slot = "4")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/CBC";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D13 RID: 7443
|
|
// (get) Token: 0x0600B7EF RID: 47087 RVA: 0x0027C48C File Offset: 0x0027A68C
|
|
[Token(Token = "0x17001D13")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B7EF")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "7")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B7F0 RID: 47088 RVA: 0x0027C49C File Offset: 0x0027A69C
|
|
[Token(Token = "0x600B7F0")]
|
|
[Address(RVA = "0x25B2580", Offset = "0x25B1580", VA = "0x1825B2580", Slot = "6")]
|
|
public int GetBlockSize()
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B7F1 RID: 47089 RVA: 0x0027C4B8 File Offset: 0x0027A6B8
|
|
[Token(Token = "0x600B7F1")]
|
|
[Address(RVA = "0x25B2800", Offset = "0x25B1800", VA = "0x1825B2800", 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: 0x0600B7F2 RID: 47090 RVA: 0x0027C568 File Offset: 0x0027A768
|
|
[Token(Token = "0x600B7F2")]
|
|
[Address(RVA = "0x25B2AB0", Offset = "0x25B1AB0", VA = "0x1825B2AB0", 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: 0x0600B7F3 RID: 47091 RVA: 0x0027C5C8 File Offset: 0x0027A7C8
|
|
[Token(Token = "0x600B7F3")]
|
|
[Address(RVA = "0x25B2410", Offset = "0x25B1410", VA = "0x1825B2410")]
|
|
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: 0x0600B7F4 RID: 47092 RVA: 0x0027C60C File Offset: 0x0027A80C
|
|
[Token(Token = "0x600B7F4")]
|
|
[Address(RVA = "0x25B22A0", Offset = "0x25B12A0", VA = "0x1825B22A0")]
|
|
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: 0x04007407 RID: 29703
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007407")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x04007408 RID: 29704
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007408")]
|
|
private byte[] cbcV;
|
|
|
|
// Token: 0x04007409 RID: 29705
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007409")]
|
|
private byte[] cbcNextV;
|
|
|
|
// Token: 0x0400740A RID: 29706
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400740A")]
|
|
private int blockSize;
|
|
|
|
// Token: 0x0400740B RID: 29707
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400740B")]
|
|
private IBlockCipher cipher;
|
|
|
|
// Token: 0x0400740C RID: 29708
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400740C")]
|
|
private bool encrypting;
|
|
}
|
|
}
|