CRLReason.cs 1.7 KB

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