DERSetGenerator.cs 823 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System.IO;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1
  5. {
  6. public class DerSetGenerator
  7. : DerGenerator
  8. {
  9. private readonly MemoryStream _bOut = new MemoryStream();
  10. public DerSetGenerator(
  11. Stream outStream)
  12. : base(outStream)
  13. {
  14. }
  15. public DerSetGenerator(
  16. Stream outStream,
  17. int tagNo,
  18. bool isExplicit)
  19. : base(outStream, tagNo, isExplicit)
  20. {
  21. }
  22. public override void AddObject(
  23. Asn1Encodable obj)
  24. {
  25. new DerOutputStream(_bOut).WriteObject(obj);
  26. }
  27. public override Stream GetRawOutputStream()
  28. {
  29. return _bOut;
  30. }
  31. public override void Close()
  32. {
  33. WriteDerEncoded(Asn1Tags.Constructed | Asn1Tags.Set, _bOut.ToArray());
  34. }
  35. }
  36. }
  37. #pragma warning restore
  38. #endif