BerNull.cs 684 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1
  5. {
  6. /**
  7. * A BER Null object.
  8. */
  9. public class BerNull
  10. : DerNull
  11. {
  12. public static new readonly BerNull Instance = new BerNull(0);
  13. [Obsolete("Use static Instance object")]
  14. public BerNull()
  15. {
  16. }
  17. private BerNull(int dummy) : base(dummy)
  18. {
  19. }
  20. internal override void Encode(
  21. DerOutputStream derOut)
  22. {
  23. if (derOut is Asn1OutputStream || derOut is BerOutputStream)
  24. {
  25. derOut.WriteByte(Asn1Tags.Null);
  26. }
  27. else
  28. {
  29. base.Encode(derOut);
  30. }
  31. }
  32. }
  33. }
  34. #pragma warning restore
  35. #endif