ICipher.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto
  6. {
  7. /// <summary>
  8. /// Base interface for a ciphers that do not require data to be block aligned.
  9. /// <para>
  10. /// Note: In cases where the underlying algorithm is block based, these ciphers may add or remove padding as needed.
  11. /// </para>
  12. /// </summary>
  13. public interface ICipher
  14. {
  15. /// <summary>
  16. /// Return the size of the output buffer required for a Write() plus a
  17. /// close() with the write() being passed inputLen bytes.
  18. /// <para>
  19. /// The returned size may be dependent on the initialisation of this cipher
  20. /// and may not be accurate once subsequent input data is processed as the cipher may
  21. /// add, add or remove padding, as it sees fit.
  22. /// </para>
  23. /// </summary>
  24. /// <returns>The space required to accommodate a call to processBytes and doFinal with inputLen bytes of input.</returns>
  25. /// <param name="inputLen">The length of the expected input.</param>
  26. int GetMaxOutputSize(int inputLen);
  27. /// <summary>
  28. /// Return the size of the output buffer required for a write() with the write() being
  29. /// passed inputLen bytes and just updating the cipher output.
  30. /// </summary>
  31. /// <returns>The space required to accommodate a call to processBytes with inputLen bytes of input.</returns>
  32. /// <param name="inputLen">The length of the expected input.</param>
  33. int GetUpdateOutputSize(int inputLen);
  34. /// <summary>
  35. /// Gets the stream for reading/writing data processed/to be processed.
  36. /// </summary>
  37. /// <value>The stream associated with this cipher.</value>
  38. Stream Stream { get; }
  39. }
  40. }
  41. #pragma warning restore
  42. #endif