IStreamCipher.cs 1.9 KB

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