#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR) #pragma warning disable using System; using System.IO; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto { /// Base interface for a TLS bulk cipher. public interface TlsCipher { /// Return the maximum input size for a ciphertext given a maximum output size for the plaintext of /// plaintextLimit bytes. /// the maximum output size for the plaintext. /// the maximum input size of the ciphertext for plaintextlimit bytes of output. int GetCiphertextDecodeLimit(int plaintextLimit); /// Return the maximum output size for a ciphertext given an actual input plaintext size of /// plaintextLength bytes and a maximum input plaintext size of plaintextLimit bytes. /// the actual input size for the plaintext. /// the maximum input size for the plaintext. /// the maximum output size of the ciphertext for plaintextlimit bytes of input. int GetCiphertextEncodeLimit(int plaintextLength, int plaintextLimit); /// Return the maximum size for the plaintext given ciphertextlimit bytes of ciphertext. /// the maximum number of bytes of ciphertext. /// the maximum size of the plaintext for ciphertextlimit bytes of input. int GetPlaintextLimit(int ciphertextLimit); /// Encode the passed in plaintext using the current bulk cipher. /// sequence number of the message represented by plaintext. /// content type of the message represented by plaintext. /// used for the record. /// extra bytes to allocate at start of returned byte array. /// array holding input plaintext to the cipher. /// offset into input array the plaintext starts at. /// length of the plaintext in the array. /// A containing the result of encoding (after 'headerAllocation' unused /// bytes). /// TlsEncodeResult EncodePlaintext(long seqNo, short contentType, ProtocolVersion recordVersion, int headerAllocation, byte[] plaintext, int offset, int len); /// Decode the passed in ciphertext using the current bulk cipher. /// sequence number of the message represented by ciphertext. /// content type used in the record for this message. /// used for the record. /// array holding input ciphertext to the cipher. /// offset into input array the ciphertext starts at. /// length of the ciphertext in the array. /// A containing the result of decoding. /// TlsDecodeResult DecodeCiphertext(long seqNo, short recordType, ProtocolVersion recordVersion, byte[] ciphertext, int offset, int len); /// void RekeyDecoder(); /// void RekeyEncoder(); bool UsesOpaqueRecordType { get; } } } #pragma warning restore #endif