IStreamCipher.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto
  5. {
  6. /// <summary>The interface stream ciphers conform to.</summary>
  7. public interface IStreamCipher
  8. {
  9. /// <summary>The name of the algorithm this cipher implements.</summary>
  10. string AlgorithmName { get; }
  11. /// <summary>Initialise the cipher.</summary>
  12. /// <param name="forEncryption">If true the cipher is initialised for encryption,
  13. /// if false for decryption.</param>
  14. /// <param name="parameters">The key and other data required by the cipher.</param>
  15. /// <exception cref="ArgumentException">
  16. /// If the parameters argument is inappropriate.
  17. /// </exception>
  18. void Init(bool forEncryption, ICipherParameters parameters);
  19. /// <summary>encrypt/decrypt a single byte returning the result.</summary>
  20. /// <param name="input">the byte to be processed.</param>
  21. /// <returns>the result of processing the input byte.</returns>
  22. byte ReturnByte(byte input);
  23. /// <summary>
  24. /// Process a block of bytes from <c>input</c> putting the result into <c>output</c>.
  25. /// </summary>
  26. /// <param name="input">The input byte array.</param>
  27. /// <param name="inOff">
  28. /// The offset into <c>input</c> where the data to be processed starts.
  29. /// </param>
  30. /// <param name="length">The number of bytes to be processed.</param>
  31. /// <param name="output">The output buffer the processed bytes go into.</param>
  32. /// <param name="outOff">
  33. /// The offset into <c>output</c> the processed data starts at.
  34. /// </param>
  35. /// <exception cref="DataLengthException">If the output buffer is too small.</exception>
  36. void ProcessBytes(byte[] input, int inOff, int length, byte[] output, int outOff);
  37. /// <summary>
  38. /// Reset the cipher to the same state as it was after the last init (if there was one).
  39. /// </summary>
  40. void Reset();
  41. }
  42. }
  43. #pragma warning restore
  44. #endif