This commit is contained in:
niko
2026-04-12 16:51:38 +02:00
parent 1b6f6d81d0
commit c12fbe3fc6
17828 changed files with 2994770 additions and 0 deletions
@@ -0,0 +1,199 @@
using System;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
using Hjg.Pngcs;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
{
// Token: 0x02001BEA RID: 7146
[Token(Token = "0x2001BEA")]
public class Chacha20Poly1305 : TlsCipher
{
// Token: 0x0600AFF9 RID: 45049 RVA: 0x00260888 File Offset: 0x0025EA88
[Token(Token = "0x600AFF9")]
[Address(RVA = "0x2332570", Offset = "0x2331570", VA = "0x182332570")]
public Chacha20Poly1305(TlsContext context)
{
do
{
base..ctor();
}
while (!TlsUtilities.IsTlsV12(context));
this.context = context;
byte[] array = TlsUtilities.CalculateKeyBlock(context, 88);
int num;
KeyParameter keyParameter = new KeyParameter(array, num, 32);
num = 0;
KeyParameter keyParameter2 = new KeyParameter(array, 32, 32);
byte[] array2 = Arrays.CopyOfRange(array, 64, 76);
byte[] array3 = Arrays.CopyOfRange(array, 76, 88);
ChaCha7539Engine chaCha7539Engine = new ChaCha7539Engine();
this.encryptCipher = chaCha7539Engine;
ChaCha7539Engine chaCha7539Engine2 = new ChaCha7539Engine();
this.decryptCipher = chaCha7539Engine2;
if (chaCha7539Engine2 == 0)
{
}
this.encryptIV = array3;
this.decryptIV = array2;
ChaCha7539Engine chaCha7539Engine3 = this.encryptCipher;
byte[] array4 = this.encryptIV;
ParametersWithIV parametersWithIV = new ParametersWithIV(keyParameter2, array4);
chaCha7539Engine3.Reset();
ChaCha7539Engine chaCha7539Engine4 = this.decryptCipher;
byte[] array5 = this.decryptIV;
ParametersWithIV parametersWithIV2 = new ParametersWithIV(keyParameter, array5);
string algorithmName = ((IStreamCipher)chaCha7539Engine4).AlgorithmName;
}
// Token: 0x0600AFFA RID: 45050 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600AFFA")]
[Address(RVA = "0x23322C0", Offset = "0x23312C0", VA = "0x1823322C0", Slot = "7")]
public virtual int GetPlaintextLimit(int ciphertextLimit)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600AFFB RID: 45051 RVA: 0x00260960 File Offset: 0x0025EB60
[Token(Token = "0x600AFFB")]
[Address(RVA = "0x2331EF0", Offset = "0x2330EF0", VA = "0x182331EF0", Slot = "8")]
public virtual byte[] EncodePlaintext(long seqNo, byte type, byte[] plaintext, int offset, int len)
{
byte[] array = this.encryptIV;
byte[] array2 = new byte[this.encryptCipher];
this.encryptCipher.AdvanceCounter();
return array2;
}
// Token: 0x0600AFFC RID: 45052 RVA: 0x00260994 File Offset: 0x0025EB94
[Token(Token = "0x600AFFC")]
[Address(RVA = "0x2331CE0", Offset = "0x2330CE0", VA = "0x182331CE0", Slot = "9")]
public virtual byte[] DecodeCiphertext(long seqNo, byte type, byte[] ciphertext, int offset, int len)
{
bool flag;
do
{
byte[] array = this.decryptIV;
}
while (!flag);
byte[] array3;
byte[] array2 = new byte[array3];
this.decryptCipher.AdvanceCounter();
return array2;
}
// Token: 0x0600AFFD RID: 45053 RVA: 0x002609C4 File Offset: 0x0025EBC4
[Token(Token = "0x600AFFD")]
[Address(RVA = "0x23322D0", Offset = "0x23312D0", VA = "0x1823322D0", Slot = "10")]
protected virtual KeyParameter InitRecord(IStreamCipher cipher, bool forEncryption, long seqNo, byte[] iv)
{
throw new NullReferenceException();
}
// Token: 0x0600AFFE RID: 45054 RVA: 0x002609D8 File Offset: 0x0025EBD8
[Token(Token = "0x600AFFE")]
[Address(RVA = "0x2331AB0", Offset = "0x2330AB0", VA = "0x182331AB0", Slot = "11")]
protected virtual byte[] CalculateNonce(long seqNo, byte[] iv)
{
byte[] array = new byte[12];
TlsUtilities.WriteUint64(seqNo, array, 4);
int num = 0;
num++;
return array;
}
// Token: 0x0600AFFF RID: 45055 RVA: 0x00260A04 File Offset: 0x0025EC04
[Token(Token = "0x600AFFF")]
[Address(RVA = "0x2332060", Offset = "0x2331060", VA = "0x182332060", Slot = "12")]
protected virtual KeyParameter GenerateRecordMacKey(IStreamCipher cipher)
{
byte[] array = new byte[64];
int num = 0;
num += num;
num++;
int num2;
uint num3;
KeyParameter keyParameter = new KeyParameter(array, num2, (int)num3);
num2 = 0;
int num4 = 0;
Arrays.Fill(array, (byte)num4);
return keyParameter;
}
// Token: 0x0600B000 RID: 45056 RVA: 0x00260A4C File Offset: 0x0025EC4C
[Token(Token = "0x600B000")]
[Address(RVA = "0x2331B90", Offset = "0x2330B90", VA = "0x182331B90", Slot = "13")]
protected virtual byte[] CalculateRecordMac(KeyParameter macKey, byte[] additionalData, byte[] buf, int off, int len)
{
Poly1305 poly = new Poly1305();
int length = additionalData.Length;
return MacUtilities.DoFinal(poly);
}
// Token: 0x0600B001 RID: 45057 RVA: 0x00260A74 File Offset: 0x0025EC74
[Token(Token = "0x600B001")]
[Address(RVA = "0x23323B0", Offset = "0x23313B0", VA = "0x1823323B0", Slot = "14")]
protected virtual void UpdateRecordMacLength(IMac mac, int len)
{
int length = Pack.UInt64_To_LE((ulong)len).Length;
}
// Token: 0x0600B002 RID: 45058 RVA: 0x00260A94 File Offset: 0x0025EC94
[Token(Token = "0x600B002")]
[Address(RVA = "0x2332430", Offset = "0x2331430", VA = "0x182332430", Slot = "15")]
protected virtual void UpdateRecordMacText(IMac mac, byte[] buf, int off, int len)
{
if (mac < 0)
{
}
}
// Token: 0x0600B003 RID: 45059 RVA: 0x00260AAC File Offset: 0x0025ECAC
[Token(Token = "0x600B003")]
[Address(RVA = "0x23321C0", Offset = "0x23311C0", VA = "0x1823321C0", Slot = "16")]
protected virtual byte[] GetAdditionalData(long seqNo, byte type, int len)
{
byte[] array = new byte[13];
int num = 0;
TlsUtilities.WriteUint64(seqNo, array, num);
TlsUtilities.WriteUint8(type, array, 8);
TlsContext tlsContext = this.context;
PngHelperInternal.WriteInt2tobytes(len, array, 11);
return array;
}
// Token: 0x04006ED0 RID: 28368
[Token(Token = "0x4006ED0")]
private static readonly byte[] Zeroes = new byte[15];
// Token: 0x04006ED1 RID: 28369
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4006ED1")]
protected readonly TlsContext context;
// Token: 0x04006ED2 RID: 28370
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4006ED2")]
protected readonly ChaCha7539Engine encryptCipher;
// Token: 0x04006ED3 RID: 28371
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4006ED3")]
protected readonly ChaCha7539Engine decryptCipher;
// Token: 0x04006ED4 RID: 28372
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4006ED4")]
protected readonly byte[] encryptIV;
// Token: 0x04006ED5 RID: 28373
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4006ED5")]
protected readonly byte[] decryptIV;
}
}