DerNull.cs 913 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 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 int EncodedLength(bool withID)
  18. {
  19. return Asn1OutputStream.GetLengthOfEncodingDL(withID, 0);
  20. }
  21. internal override void Encode(Asn1OutputStream asn1Out, bool withID)
  22. {
  23. asn1Out.WriteEncodingDL(withID, Asn1Tags.Null, 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