SignerInputBuffer.cs 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
  7. {
  8. internal class SignerInputBuffer
  9. : MemoryStream
  10. {
  11. internal void UpdateSigner(ISigner s)
  12. {
  13. Streams.WriteBufTo(this, new SigStream(s));
  14. }
  15. private class SigStream
  16. : BaseOutputStream
  17. {
  18. private readonly ISigner s;
  19. internal SigStream(ISigner s)
  20. {
  21. this.s = s;
  22. }
  23. public override void WriteByte(byte b)
  24. {
  25. s.Update(b);
  26. }
  27. public override void Write(byte[] buf, int off, int len)
  28. {
  29. s.BlockUpdate(buf, off, len);
  30. }
  31. }
  32. }
  33. }
  34. #pragma warning restore
  35. #endif