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

271 lines
9.6 KiB
C#

using System;
using System.Runtime.CompilerServices;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings
{
// Token: 0x02001D9C RID: 7580
[Token(Token = "0x2001D9C")]
public class ISO9796d1Encoding : IAsymmetricBlockCipher
{
// Token: 0x0600BD35 RID: 48437 RVA: 0x002A2DEC File Offset: 0x002A0FEC
[Token(Token = "0x600BD35")]
[Address(RVA = "0x493D90", Offset = "0x492D90", VA = "0x180493D90")]
public ISO9796d1Encoding(IAsymmetricBlockCipher cipher)
{
this.engine = cipher;
}
// Token: 0x17001DA0 RID: 7584
// (get) Token: 0x0600BD36 RID: 48438 RVA: 0x002A2E08 File Offset: 0x002A1008
[Token(Token = "0x17001DA0")]
public string AlgorithmName
{
[Token(Token = "0x600BD36")]
[Address(RVA = "0x249F640", Offset = "0x249E640", VA = "0x18249F640", Slot = "4")]
get
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
return 0 + "/ISO9796-1Padding";
}
}
// Token: 0x0600BD37 RID: 48439 RVA: 0x002A2E30 File Offset: 0x002A1030
[Token(Token = "0x600BD37")]
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530")]
public IAsymmetricBlockCipher GetUnderlyingCipher()
{
return this.engine;
}
// Token: 0x0600BD38 RID: 48440 RVA: 0x002A2E44 File Offset: 0x002A1044
[Token(Token = "0x600BD38")]
[Address(RVA = "0x249F2C0", Offset = "0x249E2C0", VA = "0x18249F2C0", Slot = "5")]
public void Init(bool forEncryption, ICipherParameters parameters)
{
while (parameters != 0)
{
if ((parameters != 0 || parameters != 0) && parameters != 0 && parameters != 0)
{
if (parameters == 0)
{
IL_2A:
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
this.modulus = (uint)1;
this.forEncryption = forEncryption;
int num;
this.bitSize = num;
return;
}
if (parameters != 0)
{
break;
}
}
}
goto IL_2A;
}
// Token: 0x0600BD39 RID: 48441 RVA: 0x002A2EA0 File Offset: 0x002A10A0
[Token(Token = "0x600BD39")]
[Address(RVA = "0x249F200", Offset = "0x249E200", VA = "0x18249F200", Slot = "6")]
public int GetInputBlockSize()
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
if (this.inverse != (ulong)0L)
{
}
throw new NullReferenceException();
}
// Token: 0x0600BD3A RID: 48442 RVA: 0x002A2EC4 File Offset: 0x002A10C4
[Token(Token = "0x600BD3A")]
[Address(RVA = "0x249F260", Offset = "0x249E260", VA = "0x18249F260", Slot = "7")]
public int GetOutputBlockSize()
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
if (this.inverse == (ulong)0L)
{
}
throw new NullReferenceException();
}
// Token: 0x0600BD3B RID: 48443 RVA: 0x002A2EE8 File Offset: 0x002A10E8
[Token(Token = "0x600BD3B")]
[Address(RVA = "0x249F4E0", Offset = "0x249E4E0", VA = "0x18249F4E0")]
public void SetPadBits(int padBits)
{
this.padBits = padBits;
}
// Token: 0x0600BD3C RID: 48444 RVA: 0x002A2F08 File Offset: 0x002A1108
[Token(Token = "0x600BD3C")]
[Address(RVA = "0x470B70", Offset = "0x46FB70", VA = "0x180470B70")]
public int GetPadBits()
{
return this.padBits;
}
// Token: 0x0600BD3D RID: 48445 RVA: 0x002A2F1C File Offset: 0x002A111C
[Token(Token = "0x600BD3D")]
[Address(RVA = "0x249F4B0", Offset = "0x249E4B0", VA = "0x18249F4B0", Slot = "8")]
public byte[] ProcessBlock(byte[] input, int inOff, int length)
{
if (this.inverse == (ulong)0L)
{
return this.DecodeBlock(input, inOff, length);
}
return this.EncodeBlock(input, inOff, length);
}
// Token: 0x0600BD3E RID: 48446 RVA: 0x002A2F48 File Offset: 0x002A1148
[Token(Token = "0x600BD3E")]
[Address(RVA = "0x249EE70", Offset = "0x249DE70", VA = "0x18249EE70")]
private byte[] EncodeBlock(byte[] input, int inOff, int inLen)
{
int num = this.bitSize;
num += 7;
byte[] array = new byte[input];
int num2 = this.padBits;
int num3 = this.bitSize;
num2++;
num3 += 13;
int num4 = 0;
num3 += input;
if (num3 > 0)
{
num3 -= inLen;
int num5 = array.Length;
num5 -= num4;
num5 -= inLen;
int num6 = array.Length;
num6 -= inLen;
num4 += inLen;
num3 = inLen - inLen;
}
int num7 = array.Length;
num7 -= num3;
int length = array.Length;
int num8;
if (num7 != length)
{
num3 = num7;
num3 -= 0;
num3 -= num3;
num8 = ISO9796d1Encoding.shadows.Length;
num8 = num7;
num8++;
num7 += 2;
}
byte b;
num8 -= (int)b;
int length2 = array.Length;
if (length2 - 1 < length2)
{
}
uint num9;
byte b2;
num9 -= (uint)b2;
int length3 = array.Length;
if (num9 == (uint)8)
{
array[0] = (byte)((ulong)0L);
}
uint num10;
array[0] = (byte)num10;
uint num11;
array[0] = (byte)num11;
int num12 = 0;
int num13 = array.Length;
num13 -= num12;
throw new NullReferenceException();
}
// Token: 0x0600BD3F RID: 48447 RVA: 0x002A3060 File Offset: 0x002A1260
[Token(Token = "0x600BD3F")]
[Address(RVA = "0x249E870", Offset = "0x249D870", VA = "0x18249E870")]
private byte[] DecodeBlock(byte[] input, int inOff, int inLen)
{
/*
An exception occurred when decompiling this method (0600BD3F)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings.ISO9796d1Encoding::DecodeBlock(System.Byte[],System.Int32,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_140:
stloc:InvalidCipherTextException(var_33_14A, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, ldstr:string("resulting integer iS or (modulus - iS) is not congruent to 6 mod 16")))
}
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: 0x0600BD40 RID: 48448 RVA: 0x002A31B8 File Offset: 0x002A13B8
// Note: this type is marked as 'beforefieldinit'.
[Token(Token = "0x600BD40")]
[Address(RVA = "0x249F550", Offset = "0x249E550", VA = "0x18249F550")]
static ISO9796d1Encoding()
{
BigInteger bigInteger;
ISO9796d1Encoding.Sixteen = bigInteger;
BigInteger bigInteger2;
ISO9796d1Encoding.Six = bigInteger2;
byte[] array = new byte[16];
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.27C3AB82CCA6CE2F199F4F670BF19513A3825B87).FieldHandle);
ISO9796d1Encoding.shadows = array;
byte[] array2 = new byte[16];
RuntimeHelpers.InitializeArray(array2, fieldof(<PrivateImplementationDetails>.30F65A149AF7DE938A9287048498B966AEBE54D4).FieldHandle);
ISO9796d1Encoding.inverse = array2;
}
// Token: 0x040077BB RID: 30651
[Token(Token = "0x40077BB")]
private static readonly BigInteger Sixteen;
// Token: 0x040077BC RID: 30652
[Token(Token = "0x40077BC")]
private static readonly BigInteger Six;
// Token: 0x040077BD RID: 30653
[Token(Token = "0x40077BD")]
private static readonly byte[] shadows;
// Token: 0x040077BE RID: 30654
[Token(Token = "0x40077BE")]
private static readonly byte[] inverse;
// Token: 0x040077BF RID: 30655
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40077BF")]
private readonly IAsymmetricBlockCipher engine;
// Token: 0x040077C0 RID: 30656
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40077C0")]
private bool forEncryption;
// Token: 0x040077C1 RID: 30657
[FieldOffset(Offset = "0x1C")]
[Token(Token = "0x40077C1")]
private int bitSize;
// Token: 0x040077C2 RID: 30658
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40077C2")]
private int padBits;
// Token: 0x040077C3 RID: 30659
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40077C3")]
private BigInteger modulus;
}
}