CMSProcessableByteArray.cs 820 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.IO;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
  6. {
  7. /**
  8. * a holding class for a byte array of data to be processed.
  9. */
  10. public class CmsProcessableByteArray
  11. : CmsProcessable, CmsReadable
  12. {
  13. private readonly byte[] bytes;
  14. public CmsProcessableByteArray(byte[] bytes)
  15. {
  16. this.bytes = bytes;
  17. }
  18. public virtual Stream GetInputStream()
  19. {
  20. return new MemoryStream(bytes, false);
  21. }
  22. public virtual void Write(Stream zOut)
  23. {
  24. zOut.Write(bytes, 0, bytes.Length);
  25. }
  26. /// <returns>A clone of the byte array</returns>
  27. [Obsolete]
  28. public virtual object GetContent()
  29. {
  30. return bytes.Clone();
  31. }
  32. }
  33. }
  34. #pragma warning restore
  35. #endif