IMac.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /**
  7. * The base interface for implementations of message authentication codes (MACs).
  8. */
  9. public interface IMac
  10. {
  11. /**
  12. * Initialise the MAC.
  13. *
  14. * @param param the key and other data required by the MAC.
  15. * @exception ArgumentException if the parameters argument is
  16. * inappropriate.
  17. */
  18. void Init(ICipherParameters parameters);
  19. /**
  20. * Return the name of the algorithm the MAC implements.
  21. *
  22. * @return the name of the algorithm the MAC implements.
  23. */
  24. string AlgorithmName { get; }
  25. /**
  26. * Return the block size for this MAC (in bytes).
  27. *
  28. * @return the block size for this MAC in bytes.
  29. */
  30. int GetMacSize();
  31. /**
  32. * add a single byte to the mac for processing.
  33. *
  34. * @param in the byte to be processed.
  35. * @exception InvalidOperationException if the MAC is not initialised.
  36. */
  37. void Update(byte input);
  38. /**
  39. * @param in the array containing the input.
  40. * @param inOff the index in the array the data begins at.
  41. * @param len the length of the input starting at inOff.
  42. * @exception InvalidOperationException if the MAC is not initialised.
  43. * @exception DataLengthException if there isn't enough data in in.
  44. */
  45. void BlockUpdate(byte[] input, int inOff, int len);
  46. /**
  47. * Compute the final stage of the MAC writing the output to the out
  48. * parameter.
  49. * <p>
  50. * doFinal leaves the MAC in the same state it was after the last init.
  51. * </p>
  52. * @param out the array the MAC is to be output to.
  53. * @param outOff the offset into the out buffer the output is to start at.
  54. * @exception DataLengthException if there isn't enough space in out.
  55. * @exception InvalidOperationException if the MAC is not initialised.
  56. */
  57. int DoFinal(byte[] output, int outOff);
  58. /**
  59. * Reset the MAC. At the end of resetting the MAC should be in the
  60. * in the same state it was after the last init (if there was one).
  61. */
  62. void Reset();
  63. }
  64. }
  65. #pragma warning restore
  66. #endif