Revocable.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
  5. {
  6. /**
  7. * packet giving whether or not is revocable.
  8. */
  9. public class Revocable
  10. : SignatureSubpacket
  11. {
  12. private static byte[] BooleanToByteArray(
  13. bool value)
  14. {
  15. byte[] data = new byte[1];
  16. if (value)
  17. {
  18. data[0] = 1;
  19. return data;
  20. }
  21. else
  22. {
  23. return data;
  24. }
  25. }
  26. public Revocable(
  27. bool critical,
  28. bool isLongLength,
  29. byte[] data)
  30. : base(SignatureSubpacketTag.Revocable, critical, isLongLength, data)
  31. {
  32. }
  33. public Revocable(
  34. bool critical,
  35. bool isRevocable)
  36. : base(SignatureSubpacketTag.Revocable, critical, false, BooleanToByteArray(isRevocable))
  37. {
  38. }
  39. public bool IsRevocable()
  40. {
  41. return data[0] != 0;
  42. }
  43. }
  44. }
  45. #pragma warning restore
  46. #endif