IAsymmetricBlockCipher.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. using System;
  3. namespace Org.BouncyCastle.Crypto
  4. {
  5. /// <remarks>Base interface for a public/private key block cipher.</remarks>
  6. public interface IAsymmetricBlockCipher
  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">Initialise for encryption if true, for decryption if false.</param>
  12. /// <param name="parameters">The key or other data required by the cipher.</param>
  13. void Init(bool forEncryption, ICipherParameters parameters);
  14. /// <returns>The maximum size, in bytes, an input block may be.</returns>
  15. int GetInputBlockSize();
  16. /// <returns>The maximum size, in bytes, an output block will be.</returns>
  17. int GetOutputBlockSize();
  18. /// <summary>Process a block.</summary>
  19. /// <param name="inBuf">The input buffer.</param>
  20. /// <param name="inOff">The offset into <paramref>inBuf</paramref> that the input block begins.</param>
  21. /// <param name="inLen">The length of the input block.</param>
  22. /// <exception cref="InvalidCipherTextException">Input decrypts improperly.</exception>
  23. /// <exception cref="DataLengthException">Input is too large for the cipher.</exception>
  24. byte[] ProcessBlock(byte[] inBuf, int inOff, int inLen);
  25. }
  26. }
  27. #endif