Files
2026-04-10 22:50:51 +02:00

361 lines
10 KiB
C#

using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings
{
// Token: 0x02001CBD RID: 7357
[Token(Token = "0x2001CBD")]
public class OaepEncoding : IAsymmetricBlockCipher
{
// Token: 0x0600B973 RID: 47475 RVA: 0x0029A85C File Offset: 0x00298A5C
[Token(Token = "0x600B973")]
[Address(RVA = "0x1A74C00", Offset = "0x1A73A00", VA = "0x181A74C00")]
public OaepEncoding(IAsymmetricBlockCipher cipher)
{
Sha1Digest sha1Digest = new Sha1Digest();
}
// Token: 0x0600B974 RID: 47476 RVA: 0x0029A870 File Offset: 0x00298A70
[Token(Token = "0x600B974")]
[Address(RVA = "0x1A74BE0", Offset = "0x1A739E0", VA = "0x181A74BE0")]
public OaepEncoding(IAsymmetricBlockCipher cipher, IDigest hash)
{
}
// Token: 0x0600B975 RID: 47477 RVA: 0x0029A880 File Offset: 0x00298A80
[Token(Token = "0x600B975")]
[Address(RVA = "0x1A74C80", Offset = "0x1A73A80", VA = "0x181A74C80")]
public OaepEncoding(IAsymmetricBlockCipher cipher, IDigest hash, byte[] encodingParams)
{
this.engine = cipher;
this.mgf1Hash = hash;
byte[] array = new byte[0];
this.defHash = array;
if (encodingParams != 0)
{
int length = encodingParams.Length;
}
throw new NullReferenceException();
}
// Token: 0x0600B976 RID: 47478 RVA: 0x0029A8C4 File Offset: 0x00298AC4
[Token(Token = "0x600B976")]
[Address(RVA = "0x1A74AF0", Offset = "0x1A738F0", VA = "0x181A74AF0")]
public OaepEncoding(IAsymmetricBlockCipher cipher, IDigest hash, IDigest mgf1Hash, byte[] encodingParams)
{
this.engine = cipher;
this.mgf1Hash = mgf1Hash;
byte[] array = new byte[0];
this.defHash = array;
throw new NullReferenceException();
}
// Token: 0x0600B977 RID: 47479 RVA: 0x0029A8FC File Offset: 0x00298AFC
[Token(Token = "0x600B977")]
[Address(RVA = "0x3F6400", Offset = "0x3F5200", VA = "0x1803F6400")]
public IAsymmetricBlockCipher GetUnderlyingCipher()
{
return this.engine;
}
// Token: 0x17001D04 RID: 7428
// (get) Token: 0x0600B978 RID: 47480 RVA: 0x0029A910 File Offset: 0x00298B10
[Token(Token = "0x17001D04")]
public string AlgorithmName
{
[Token(Token = "0x600B978")]
[Address(RVA = "0x1A74D70", Offset = "0x1A73B70", VA = "0x181A74D70", Slot = "4")]
get
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
return 0 + "/OAEPPadding";
}
}
// Token: 0x0600B979 RID: 47481 RVA: 0x0029A938 File Offset: 0x00298B38
[Token(Token = "0x600B979")]
[Address(RVA = "0x1A749A0", Offset = "0x1A737A0", VA = "0x181A749A0", Slot = "5")]
public void Init(bool forEncryption, ICipherParameters param)
{
while (param != 0 && param != 0 && param == 0)
{
}
SecureRandom secureRandom = new SecureRandom();
this.random = secureRandom;
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
this.forEncryption = forEncryption;
}
// Token: 0x0600B97A RID: 47482 RVA: 0x0029A978 File Offset: 0x00298B78
[Token(Token = "0x600B97A")]
[Address(RVA = "0x1A748C0", Offset = "0x1A736C0", VA = "0x181A748C0", Slot = "6")]
public int GetInputBlockSize()
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
if (this.forEncryption)
{
int num = this.defHash.Length;
num += num;
uint num2;
num2 -= (uint)num;
}
throw new NullReferenceException();
}
// Token: 0x0600B97B RID: 47483 RVA: 0x0029A9B0 File Offset: 0x00298BB0
[Token(Token = "0x600B97B")]
[Address(RVA = "0x1A74930", Offset = "0x1A73730", VA = "0x181A74930", Slot = "7")]
public int GetOutputBlockSize()
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
if (!this.forEncryption)
{
int num = this.defHash.Length;
num += num;
}
throw new NullReferenceException();
}
// Token: 0x0600B97C RID: 47484 RVA: 0x0029A9E4 File Offset: 0x00298BE4
[Token(Token = "0x600B97C")]
[Address(RVA = "0x1A74AC0", Offset = "0x1A738C0", VA = "0x181A74AC0", Slot = "8")]
public byte[] ProcessBlock(byte[] inBytes, int inOff, int inLen)
{
if (!this.forEncryption)
{
return this.DecodeBlock(inBytes, inOff, inLen);
}
return this.EncodeBlock(inBytes, inOff, inLen);
}
// Token: 0x0600B97D RID: 47485 RVA: 0x0029AA10 File Offset: 0x00298C10
[Token(Token = "0x600B97D")]
[Address(RVA = "0x1A74520", Offset = "0x1A73320", VA = "0x181A74520")]
private byte[] EncodeBlock(byte[] inBytes, int inOff, int inLen)
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
uint num2;
if (this.forEncryption)
{
int num = this.defHash.Length;
num += num;
num2 -= (uint)num;
}
Check.DataLength(inLen > (int)num2, "input data too long");
IAsymmetricBlockCipher asymmetricBlockCipher2 = this.engine;
byte[] array = this.defHash;
if (this.forEncryption)
{
int num3 = array.Length;
num3 += num3;
}
int num4 = array.Length;
num4 += num4;
num4++;
byte[] array2 = new byte[0];
int num5 = array2.Length;
int num6 = 0;
num5 -= inLen;
Array.Copy(inBytes, inOff, array2, num5, inLen);
int num7 = array2.Length;
num7 -= inLen;
byte[] array3 = this.defHash;
int length = array3.Length;
int num8 = 0;
Array.Copy(array3, num8, array2, length, length);
byte[] array4 = this.defHash;
SecureRandom secureRandom = this.random;
int length2 = array4.Length;
byte[] nextBytes = SecureRandom.GetNextBytes(secureRandom, length2);
byte[] array5 = this.defHash;
int length3 = array2.Length;
int num9 = 0;
int length4 = nextBytes.Length;
byte[] array6 = this.maskGeneratorFunction1(nextBytes, num9, length4, length3);
int num10 = this.defHash.Length;
if (num10 != array2.Length)
{
byte[] array7 = this.defHash;
num10++;
}
int length5 = this.defHash.Length;
int num11 = 0;
int num12 = 0;
Array.Copy(nextBytes, num12, array2, num11, length5);
int length6 = this.defHash.Length;
int num13 = array2.Length;
num13 -= length6;
byte[] array8 = this.maskGeneratorFunction1(array2, length6, num13, length6);
byte[] array9 = this.defHash;
if (num6 != array9.Length)
{
num6++;
byte[] array10 = this.defHash;
}
IAsymmetricBlockCipher asymmetricBlockCipher3 = this.engine;
int length7 = array2.Length;
throw new IndexOutOfRangeException();
}
// Token: 0x0600B97E RID: 47486 RVA: 0x0029ABE8 File Offset: 0x00298DE8
[Token(Token = "0x600B97E")]
[Address(RVA = "0x1A74110", Offset = "0x1A72F10", VA = "0x181A74110")]
private byte[] DecodeBlock(byte[] inBytes, int inOff, int inLen)
{
IAsymmetricBlockCipher asymmetricBlockCipher = this.engine;
IAsymmetricBlockCipher asymmetricBlockCipher2 = this.engine;
byte[] array = new byte[0];
int length = this.defHash.Length;
int num = array.Length;
num -= typeof(IAsymmetricBlockCipher).TypeHandle;
int num2 = 0;
int length2 = this.defHash.Length;
int num3 = array.Length;
num3 -= length2;
byte[] array2 = this.maskGeneratorFunction1(array, length2, num3, length2);
byte[] array3 = this.defHash;
byte[] array4;
if (num2 != array3.Length)
{
num2++;
array4 = this.defHash;
}
int num4 = array.Length;
int num5 = 0;
int length3 = array4.Length;
num4 -= length3;
byte[] array5 = this.maskGeneratorFunction1(array, num5, length3, num4);
int num6 = this.defHash.Length;
int num7 = array.Length;
if (num6 != num7)
{
byte[] array6 = this.defHash;
num7 = num6;
num6++;
}
int length4 = this.defHash.Length;
if (num2 != length4)
{
num2++;
}
if (num2 != num7)
{
num2++;
bool flag = num7 == num7;
}
num7++;
int num8 = num7 - 1;
num7 -= num7;
byte[] array7 = new byte[num7];
int length5 = array7.Length;
int num9 = 0;
Array.Copy(array, num7, array7, num9, length5);
return array7;
}
// Token: 0x0600B97F RID: 47487 RVA: 0x0029AD44 File Offset: 0x00298F44
[Token(Token = "0x600B97F")]
[Address(RVA = "0x189BD10", Offset = "0x189AB10", VA = "0x18189BD10")]
private void ItoOSP(int i, byte[] sp)
{
sp[0] = (byte)i;
sp[0] = (byte)i;
sp[0] = (byte)i;
sp[0] = (byte)i;
}
// Token: 0x0600B980 RID: 47488 RVA: 0x0029AD78 File Offset: 0x00298F78
[Token(Token = "0x600B980")]
[Address(RVA = "0x1A74DD0", Offset = "0x1A73BD0", VA = "0x181A74DD0")]
private byte[] maskGeneratorFunction1(byte[] Z, int zOff, int zLen, int length)
{
byte[] array = new byte[0];
IDigest digest = this.mgf1Hash;
byte[] array2 = new byte[array];
byte[] array3 = new byte[4];
IDigest digest2 = this.mgf1Hash;
int num = 0;
int num2 = 0;
int length2 = array2.Length;
array3[0] = (byte)num;
array3[0] = (byte)num;
array3[0] = (byte)num;
array3[0] = (byte)num;
IDigest digest3 = this.mgf1Hash;
if (num2 < num2)
{
num2 += num2;
num2++;
}
IDigest digest4 = this.mgf1Hash;
int num3 = 0;
num3 += num3;
num3++;
int num4 = 0;
IDigest digest5 = this.mgf1Hash;
int num5 = 0;
if (num5 < num4)
{
num5 += num5;
num5++;
}
int num6 = array2.Length;
int num7 = num6 * num;
int num8 = 0;
Array.Copy(array2, num8, array, num7, num6);
num++;
num8 += num8;
num6 += 4;
num6 += 19;
num8 += num8;
num6 += 4;
num6 += 19;
num8 += num8;
num6 += 5;
num6 += 19;
array3[0] = (byte)num;
array3[0] = (byte)num;
array3[0] = (byte)num;
array3[0] = (byte)num;
IDigest digest6 = this.mgf1Hash;
IDigest digest7 = this.mgf1Hash;
int length3 = array3.Length;
IDigest digest8 = this.mgf1Hash;
int length4 = array2.Length;
int num9 = array.Length;
int num10 = 0;
int num11 = length4 * num;
num9 -= num11;
Array.Copy(array2, num10, array, num11, num9);
return array;
}
// Token: 0x0400760B RID: 30219
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400760B")]
private byte[] defHash;
// Token: 0x0400760C RID: 30220
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400760C")]
private IDigest mgf1Hash;
// Token: 0x0400760D RID: 30221
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400760D")]
private IAsymmetricBlockCipher engine;
// Token: 0x0400760E RID: 30222
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x400760E")]
private SecureRandom random;
// Token: 0x0400760F RID: 30223
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x400760F")]
private bool forEncryption;
}
}