CRLReason.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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(
  48. DerEnumerated reason)
  49. : base(reason.Value.IntValue)
  50. {
  51. }
  52. public override string ToString()
  53. {
  54. int reason = Value.IntValue;
  55. string str = (reason < 0 || reason > 10) ? "Invalid" : ReasonString[reason];
  56. return "CrlReason: " + str;
  57. }
  58. }
  59. }
  60. #pragma warning restore
  61. #endif