TlsMacSink.cs 853 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto
  6. {
  7. public class TlsMacSink
  8. : BaseOutputStream
  9. {
  10. private readonly TlsMac m_mac;
  11. public TlsMacSink(TlsMac mac)
  12. {
  13. this.m_mac = mac;
  14. }
  15. public virtual TlsMac Mac
  16. {
  17. get { return m_mac; }
  18. }
  19. public override void WriteByte(byte b)
  20. {
  21. m_mac.Update(new byte[]{ b }, 0, 1);
  22. }
  23. public override void Write(byte[] buf, int off, int len)
  24. {
  25. if (len > 0)
  26. {
  27. m_mac.Update(buf, off, len);
  28. }
  29. }
  30. }
  31. }
  32. #pragma warning restore
  33. #endif