Exportable.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 signature creation time.
  8. */
  9. public class Exportable
  10. : SignatureSubpacket
  11. {
  12. private static byte[] BooleanToByteArray(bool val)
  13. {
  14. byte[] data = new byte[1];
  15. if (val)
  16. {
  17. data[0] = 1;
  18. return data;
  19. }
  20. else
  21. {
  22. return data;
  23. }
  24. }
  25. public Exportable(
  26. bool critical,
  27. bool isLongLength,
  28. byte[] data)
  29. : base(SignatureSubpacketTag.Exportable, critical, isLongLength, data)
  30. {
  31. }
  32. public Exportable(
  33. bool critical,
  34. bool isExportable)
  35. : base(SignatureSubpacketTag.Exportable, critical, false, BooleanToByteArray(isExportable))
  36. {
  37. }
  38. public bool IsExportable()
  39. {
  40. return data[0] != 0;
  41. }
  42. }
  43. }
  44. #pragma warning restore
  45. #endif