LazyASN1InputStream.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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.Asn1
  6. {
  7. public class LazyAsn1InputStream
  8. : Asn1InputStream
  9. {
  10. public LazyAsn1InputStream(
  11. byte[] input)
  12. : base(input)
  13. {
  14. }
  15. public LazyAsn1InputStream(
  16. Stream inputStream)
  17. : base(inputStream)
  18. {
  19. }
  20. internal LazyAsn1InputStream(Stream input, int limit, byte[][] tmpBuffers)
  21. : base(input, limit, tmpBuffers)
  22. {
  23. }
  24. internal override DerSequence CreateDerSequence(
  25. DefiniteLengthInputStream dIn)
  26. {
  27. return new LazyDerSequence(dIn.ToArray());
  28. }
  29. internal override DerSet CreateDerSet(
  30. DefiniteLengthInputStream dIn)
  31. {
  32. return new LazyDerSet(dIn.ToArray());
  33. }
  34. internal override Asn1EncodableVector ReadVector(DefiniteLengthInputStream defIn)
  35. {
  36. int remaining = defIn.Remaining;
  37. if (remaining < 1)
  38. return new Asn1EncodableVector(0);
  39. return new LazyAsn1InputStream(defIn, remaining, tmpBuffers).ReadVector();
  40. }
  41. }
  42. }
  43. #pragma warning restore
  44. #endif