PrimaryUserId.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Bcpg.Sig
  5. {
  6. /**
  7. * packet giving whether or not the signature is signed using the primary user ID for the key.
  8. */
  9. public class PrimaryUserId
  10. : SignatureSubpacket
  11. {
  12. private static byte[] BooleanToByteArray(bool val)
  13. {
  14. return new byte[1]{ Convert.ToByte(val) };
  15. }
  16. public PrimaryUserId(
  17. bool critical,
  18. bool isLongLength,
  19. byte[] data)
  20. : base(SignatureSubpacketTag.PrimaryUserId, critical, isLongLength, data)
  21. {
  22. }
  23. public PrimaryUserId(
  24. bool critical,
  25. bool isPrimaryUserId)
  26. : base(SignatureSubpacketTag.PrimaryUserId, critical, false, BooleanToByteArray(isPrimaryUserId))
  27. {
  28. }
  29. public bool IsPrimaryUserId()
  30. {
  31. return data[0] != 0;
  32. }
  33. }
  34. }
  35. #pragma warning restore
  36. #endif