SignerSink.cs 754 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.Crypto.IO
  6. {
  7. public class SignerSink
  8. : BaseOutputStream
  9. {
  10. private readonly ISigner mSigner;
  11. public SignerSink(ISigner signer)
  12. {
  13. this.mSigner = signer;
  14. }
  15. public virtual ISigner Signer
  16. {
  17. get { return mSigner; }
  18. }
  19. public override void WriteByte(byte b)
  20. {
  21. mSigner.Update(b);
  22. }
  23. public override void Write(byte[] buf, int off, int len)
  24. {
  25. if (len > 0)
  26. {
  27. mSigner.BlockUpdate(buf, off, len);
  28. }
  29. }
  30. }
  31. }
  32. #pragma warning restore
  33. #endif