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: 0x02001B0A RID: 6922 [Token(Token = "0x2001B0A")] public class Chacha20Poly1305 : TlsCipher { // Token: 0x0600AC2B RID: 44075 RVA: 0x002577E4 File Offset: 0x002559E4 [Token(Token = "0x600AC2B")] [Address(RVA = "0x18AB980", Offset = "0x18AA780", VA = "0x1818AB980")] 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: 0x0600AC2C RID: 44076 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600AC2C")] [Address(RVA = "0x18AB670", Offset = "0x18AA470", VA = "0x1818AB670", Slot = "7")] public virtual int GetPlaintextLimit(int ciphertextLimit) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x0600AC2D RID: 44077 RVA: 0x002578BC File Offset: 0x00255ABC [Token(Token = "0x600AC2D")] [Address(RVA = "0x18AB2A0", Offset = "0x18AA0A0", VA = "0x1818AB2A0", 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: 0x0600AC2E RID: 44078 RVA: 0x002578F0 File Offset: 0x00255AF0 [Token(Token = "0x600AC2E")] [Address(RVA = "0x18AB090", Offset = "0x18A9E90", VA = "0x1818AB090", 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: 0x0600AC2F RID: 44079 RVA: 0x00257920 File Offset: 0x00255B20 [Token(Token = "0x600AC2F")] [Address(RVA = "0x18AB680", Offset = "0x18AA480", VA = "0x1818AB680", Slot = "10")] protected virtual KeyParameter InitRecord(IStreamCipher cipher, bool forEncryption, long seqNo, byte[] iv) { int num = 0; KeyParameter keyParameter; if (num < keyParameter) { num += num; num++; } throw new NullReferenceException(); } // Token: 0x0600AC30 RID: 44080 RVA: 0x00257940 File Offset: 0x00255B40 [Token(Token = "0x600AC30")] [Address(RVA = "0x18AAE60", Offset = "0x18A9C60", VA = "0x1818AAE60", 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: 0x0600AC31 RID: 44081 RVA: 0x0025796C File Offset: 0x00255B6C [Token(Token = "0x600AC31")] [Address(RVA = "0x18AB410", Offset = "0x18AA210", VA = "0x1818AB410", 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: 0x0600AC32 RID: 44082 RVA: 0x002579B4 File Offset: 0x00255BB4 [Token(Token = "0x600AC32")] [Address(RVA = "0x18AAF40", Offset = "0x18A9D40", VA = "0x1818AAF40", 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: 0x0600AC33 RID: 44083 RVA: 0x002579DC File Offset: 0x00255BDC [Token(Token = "0x600AC33")] [Address(RVA = "0x18AB7C0", Offset = "0x18AA5C0", VA = "0x1818AB7C0", Slot = "14")] protected virtual void UpdateRecordMacLength(IMac mac, int len) { int length = Pack.UInt64_To_LE((ulong)len).Length; } // Token: 0x0600AC34 RID: 44084 RVA: 0x002579FC File Offset: 0x00255BFC [Token(Token = "0x600AC34")] [Address(RVA = "0x18AB840", Offset = "0x18AA640", VA = "0x1818AB840", Slot = "15")] protected virtual void UpdateRecordMacText(IMac mac, byte[] buf, int off, int len) { if (mac < 0) { } } // Token: 0x0600AC35 RID: 44085 RVA: 0x00257A14 File Offset: 0x00255C14 [Token(Token = "0x600AC35")] [Address(RVA = "0x18AB570", Offset = "0x18AA370", VA = "0x1818AB570", 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: 0x04006D17 RID: 27927 [Token(Token = "0x4006D17")] private static readonly byte[] Zeroes = new byte[15]; // Token: 0x04006D18 RID: 27928 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4006D18")] protected readonly TlsContext context; // Token: 0x04006D19 RID: 27929 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4006D19")] protected readonly ChaCha7539Engine encryptCipher; // Token: 0x04006D1A RID: 27930 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4006D1A")] protected readonly ChaCha7539Engine decryptCipher; // Token: 0x04006D1B RID: 27931 [FieldOffset(Offset = "0x28")] [Token(Token = "0x4006D1B")] protected readonly byte[] encryptIV; // Token: 0x04006D1C RID: 27932 [FieldOffset(Offset = "0x30")] [Token(Token = "0x4006D1C")] protected readonly byte[] decryptIV; } }