DerNull.cs 968 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1
  5. {
  6. /**
  7. * A Null object.
  8. */
  9. public class DerNull
  10. : Asn1Null
  11. {
  12. public static readonly DerNull Instance = new DerNull();
  13. private static readonly byte[] ZeroBytes = new byte[0];
  14. protected internal DerNull()
  15. {
  16. }
  17. internal override IAsn1Encoding GetEncoding(int encoding)
  18. {
  19. return new PrimitiveEncoding(Asn1Tags.Universal, Asn1Tags.Null, ZeroBytes);
  20. }
  21. internal override IAsn1Encoding GetEncodingImplicit(int encoding, int tagClass, int tagNo)
  22. {
  23. return new PrimitiveEncoding(tagClass, tagNo, ZeroBytes);
  24. }
  25. protected override bool Asn1Equals(Asn1Object asn1Object)
  26. {
  27. return asn1Object is DerNull;
  28. }
  29. protected override int Asn1GetHashCode()
  30. {
  31. return -1;
  32. }
  33. }
  34. }
  35. #pragma warning restore
  36. #endif