SignerInputBuffer.cs 830 B

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