IBufferedCipher.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. namespace Org.BouncyCastle.Crypto
  4. {
  5. /// <remarks>Block cipher engines are expected to conform to this interface.</remarks>
  6. public interface IBufferedCipher
  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. void Init(bool forEncryption, ICipherParameters parameters);
  15. int GetBlockSize();
  16. int GetOutputSize(int inputLen);
  17. int GetUpdateOutputSize(int inputLen);
  18. byte[] ProcessByte(byte input);
  19. int ProcessByte(byte input, byte[] output, int outOff);
  20. byte[] ProcessBytes(byte[] input);
  21. byte[] ProcessBytes(byte[] input, int inOff, int length);
  22. int ProcessBytes(byte[] input, byte[] output, int outOff);
  23. int ProcessBytes(byte[] input, int inOff, int length, byte[] output, int outOff);
  24. byte[] DoFinal();
  25. byte[] DoFinal(byte[] input);
  26. byte[] DoFinal(byte[] input, int inOff, int length);
  27. int DoFinal(byte[] output, int outOff);
  28. int DoFinal(byte[] input, byte[] output, int outOff);
  29. int DoFinal(byte[] input, int inOff, int length, byte[] output, int outOff);
  30. /// <summary>
  31. /// Reset the cipher. After resetting the cipher is in the same state
  32. /// as it was after the last init (if there was one).
  33. /// </summary>
  34. void Reset();
  35. }
  36. }
  37. #endif