CRLReason.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509
  4. {
  5. /**
  6. * The CRLReason enumeration.
  7. * <pre>
  8. * CRLReason ::= Enumerated {
  9. * unspecified (0),
  10. * keyCompromise (1),
  11. * cACompromise (2),
  12. * affiliationChanged (3),
  13. * superseded (4),
  14. * cessationOfOperation (5),
  15. * certificateHold (6),
  16. * removeFromCRL (8),
  17. * privilegeWithdrawn (9),
  18. * aACompromise (10)
  19. * }
  20. * </pre>
  21. */
  22. public class CrlReason
  23. : DerEnumerated
  24. {
  25. public const int Unspecified = 0;
  26. public const int KeyCompromise = 1;
  27. public const int CACompromise = 2;
  28. public const int AffiliationChanged = 3;
  29. public const int Superseded = 4;
  30. public const int CessationOfOperation = 5;
  31. public const int CertificateHold = 6;
  32. // 7 -> Unknown
  33. public const int RemoveFromCrl = 8;
  34. public const int PrivilegeWithdrawn = 9;
  35. public const int AACompromise = 10;
  36. private static readonly string[] ReasonString = new string[]
  37. {
  38. "Unspecified", "KeyCompromise", "CACompromise", "AffiliationChanged",
  39. "Superseded", "CessationOfOperation", "CertificateHold", "Unknown",
  40. "RemoveFromCrl", "PrivilegeWithdrawn", "AACompromise"
  41. };
  42. public CrlReason(
  43. int reason)
  44. : base(reason)
  45. {
  46. }
  47. public CrlReason(DerEnumerated reason)
  48. : base(reason.IntValueExact)
  49. {
  50. }
  51. public override string ToString()
  52. {
  53. int reason = IntValueExact;
  54. string str = (reason < 0 || reason > 10) ? "Invalid" : ReasonString[reason];
  55. return "CrlReason: " + str;
  56. }
  57. }
  58. }
  59. #pragma warning restore
  60. #endif