243 lines
9.0 KiB
C#
243 lines
9.0 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes
|
|
{
|
|
// Token: 0x0200165F RID: 5727
|
|
[Token(Token = "0x200165F")]
|
|
[StructLayout(3)]
|
|
public class KCtrBlockCipher : IStreamCipher, IBlockCipher
|
|
{
|
|
// Token: 0x060098CB RID: 39115 RVA: 0x0021ECE0 File Offset: 0x0021CEE0
|
|
[Token(Token = "0x60098CB")]
|
|
[Address(RVA = "0x20F5120", Offset = "0x20F3B20", VA = "0x1820F5120")]
|
|
public KCtrBlockCipher(IBlockCipher cipher)
|
|
{
|
|
this.checkCounter();
|
|
this.cipher = cipher;
|
|
byte[] array = new byte[0];
|
|
this.IV = array;
|
|
this.blockSize = array;
|
|
byte[] array2 = new byte[array];
|
|
this.ofbV = array2;
|
|
byte[] array3 = new byte[array2];
|
|
this.ofbOutV = array3;
|
|
}
|
|
|
|
// Token: 0x060098CC RID: 39116 RVA: 0x0021ED34 File Offset: 0x0021CF34
|
|
[Token(Token = "0x60098CC")]
|
|
[Address(RVA = "0x3EE8E0", Offset = "0x3ED2E0", VA = "0x1803EE8E0")]
|
|
public IBlockCipher GetUnderlyingCipher()
|
|
{
|
|
return this.cipher;
|
|
}
|
|
|
|
// Token: 0x060098CD RID: 39117 RVA: 0x0021ED48 File Offset: 0x0021CF48
|
|
[Token(Token = "0x60098CD")]
|
|
[Address(RVA = "0x20F4A30", Offset = "0x20F3430", VA = "0x1820F4A30", Slot = "10")]
|
|
public void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060098CD)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Modes.KCtrBlockCipher::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_95:
|
|
stloc:ArgumentException(var_14_9F, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Invalid parameter passed")))
|
|
}
|
|
|
|
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: 0x1700187F RID: 6271
|
|
// (get) Token: 0x060098CE RID: 39118 RVA: 0x0021EDF8 File Offset: 0x0021CFF8
|
|
[Token(Token = "0x1700187F")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x60098CE")]
|
|
[Address(RVA = "0x20F5200", Offset = "0x20F3C00", VA = "0x1820F5200", Slot = "9")]
|
|
get
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
return 0 + "/KCTR";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001880 RID: 6272
|
|
// (get) Token: 0x060098CF RID: 39119 RVA: 0x0021EE20 File Offset: 0x0021D020
|
|
[Token(Token = "0x17001880")]
|
|
public bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x60098CF")]
|
|
[Address(RVA = "0x4405A0", Offset = "0x43EFA0", VA = "0x1804405A0", Slot = "12")]
|
|
get
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060098D0 RID: 39120 RVA: 0x0021EE30 File Offset: 0x0021D030
|
|
[Token(Token = "0x60098D0")]
|
|
[Address(RVA = "0x20F49E0", Offset = "0x20F33E0", VA = "0x1820F49E0", Slot = "11")]
|
|
public int GetBlockSize()
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060098D1 RID: 39121 RVA: 0x0021EE4C File Offset: 0x0021D04C
|
|
[Token(Token = "0x60098D1")]
|
|
[Address(RVA = "0x20F5110", Offset = "0x20F3B10", VA = "0x1820F5110", Slot = "6")]
|
|
public byte ReturnByte(byte input)
|
|
{
|
|
return this.CalculateByte(input);
|
|
}
|
|
|
|
// Token: 0x060098D2 RID: 39122 RVA: 0x0021EE60 File Offset: 0x0021D060
|
|
[Token(Token = "0x60098D2")]
|
|
[Address(RVA = "0x20F4F20", Offset = "0x20F3920", VA = "0x1820F4F20", Slot = "7")]
|
|
public void ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff)
|
|
{
|
|
byte b2;
|
|
byte b = this.CalculateByte(b2);
|
|
}
|
|
|
|
// Token: 0x060098D3 RID: 39123 RVA: 0x0021EE7C File Offset: 0x0021D07C
|
|
[Token(Token = "0x60098D3")]
|
|
[Address(RVA = "0x20F4870", Offset = "0x20F3270", VA = "0x1820F4870")]
|
|
protected byte CalculateByte(byte b)
|
|
{
|
|
int num = this.byteCount;
|
|
if (num != 0)
|
|
{
|
|
byte[] array = this.ofbOutV;
|
|
int num2 = num + 1;
|
|
this.byteCount = num2;
|
|
byte[] array2 = this.ofbV;
|
|
if (num2 == array2.Length)
|
|
{
|
|
int num3 = 0;
|
|
this.byteCount = num3;
|
|
}
|
|
byte b2;
|
|
return b2;
|
|
}
|
|
byte[] array3 = this.ofbV;
|
|
int num4 = 0;
|
|
if (num4 < array3.Length)
|
|
{
|
|
num4++;
|
|
if (num4 == array3.Length)
|
|
{
|
|
byte[] array4 = this.ofbV;
|
|
}
|
|
}
|
|
IBlockCipher blockCipher = this.cipher;
|
|
byte[] array5 = this.ofbOutV;
|
|
int num5 = this.byteCount;
|
|
byte[] array6 = this.ofbOutV;
|
|
int num6 = num5 + 1;
|
|
this.byteCount = num6;
|
|
byte b3;
|
|
return b3;
|
|
}
|
|
|
|
// Token: 0x060098D4 RID: 39124 RVA: 0x0021EF30 File Offset: 0x0021D130
|
|
[Token(Token = "0x60098D4")]
|
|
[Address(RVA = "0x20F4C50", Offset = "0x20F3650", VA = "0x1820F4C50", Slot = "13")]
|
|
public int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
int num = input.Length;
|
|
num -= inOff;
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
int length = output.Length;
|
|
IBlockCipher blockCipher3 = this.cipher;
|
|
byte b2;
|
|
byte b = this.CalculateByte(b2);
|
|
this.ofbOutV = b;
|
|
IBlockCipher blockCipher4 = this.cipher;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060098D5 RID: 39125 RVA: 0x0021EF84 File Offset: 0x0021D184
|
|
[Token(Token = "0x60098D5")]
|
|
[Address(RVA = "0x20F5080", Offset = "0x20F3A80", VA = "0x1820F5080", Slot = "14")]
|
|
public void Reset()
|
|
{
|
|
if (this.initialised)
|
|
{
|
|
IBlockCipher blockCipher = this.cipher;
|
|
byte[] array = this.ofbV;
|
|
}
|
|
IBlockCipher blockCipher2 = this.cipher;
|
|
this.byteCount = (int)((ulong)0L);
|
|
}
|
|
|
|
// Token: 0x060098D6 RID: 39126 RVA: 0x0021EFC0 File Offset: 0x0021D1C0
|
|
[Token(Token = "0x60098D6")]
|
|
[Address(RVA = "0x20F5260", Offset = "0x20F3C60", VA = "0x1820F5260")]
|
|
private void incrementCounterAt(int pos)
|
|
{
|
|
byte[] array = this.ofbV;
|
|
if (pos < array.Length && pos == array.Length)
|
|
{
|
|
byte[] array2 = this.ofbV;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060098D7 RID: 39127 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x60098D7")]
|
|
[Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60")]
|
|
private void checkCounter()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x04006468 RID: 25704
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006468")]
|
|
private byte[] IV;
|
|
|
|
// Token: 0x04006469 RID: 25705
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006469")]
|
|
private byte[] ofbV;
|
|
|
|
// Token: 0x0400646A RID: 25706
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400646A")]
|
|
private byte[] ofbOutV;
|
|
|
|
// Token: 0x0400646B RID: 25707
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400646B")]
|
|
private bool initialised;
|
|
|
|
// Token: 0x0400646C RID: 25708
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x400646C")]
|
|
private int byteCount;
|
|
|
|
// Token: 0x0400646D RID: 25709
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400646D")]
|
|
private readonly int blockSize;
|
|
|
|
// Token: 0x0400646E RID: 25710
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400646E")]
|
|
private readonly IBlockCipher cipher;
|
|
}
|
|
}
|