TrustSignature.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 trust.
  8. */
  9. public class TrustSignature
  10. : SignatureSubpacket
  11. {
  12. private static byte[] IntToByteArray(
  13. int v1,
  14. int v2)
  15. {
  16. return new byte[]{ (byte)v1, (byte)v2 };
  17. }
  18. public TrustSignature(
  19. bool critical,
  20. bool isLongLength,
  21. byte[] data)
  22. : base(SignatureSubpacketTag.TrustSig, critical, isLongLength, data)
  23. {
  24. }
  25. public TrustSignature(
  26. bool critical,
  27. int depth,
  28. int trustAmount)
  29. : base(SignatureSubpacketTag.TrustSig, critical, false, IntToByteArray(depth, trustAmount))
  30. {
  31. }
  32. public int Depth
  33. {
  34. get { return data[0] & 0xff; }
  35. }
  36. public int TrustAmount
  37. {
  38. get { return data[1] & 0xff; }
  39. }
  40. }
  41. }
  42. #pragma warning restore
  43. #endif