PKIFailureInfo.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cmp
  5. {
  6. /**
  7. * <pre>
  8. * PKIFailureInfo ::= BIT STRING {
  9. * badAlg (0),
  10. * -- unrecognized or unsupported Algorithm Identifier
  11. * badMessageCheck (1), -- integrity check failed (e.g., signature did not verify)
  12. * badRequest (2),
  13. * -- transaction not permitted or supported
  14. * badTime (3), -- messageTime was not sufficiently close to the system time, as defined by local policy
  15. * badCertId (4), -- no certificate could be found matching the provided criteria
  16. * badDataFormat (5),
  17. * -- the data submitted has the wrong format
  18. * wrongAuthority (6), -- the authority indicated in the request is different from the one creating the response token
  19. * incorrectData (7), -- the requester's data is incorrect (for notary services)
  20. * missingTimeStamp (8), -- when the timestamp is missing but should be there (by policy)
  21. * badPOP (9) -- the proof-of-possession failed
  22. * certRevoked (10),
  23. * certConfirmed (11),
  24. * wrongIntegrity (12),
  25. * badRecipientNonce (13),
  26. * timeNotAvailable (14),
  27. * -- the TSA's time source is not available
  28. * unacceptedPolicy (15),
  29. * -- the requested TSA policy is not supported by the TSA
  30. * unacceptedExtension (16),
  31. * -- the requested extension is not supported by the TSA
  32. * addInfoNotAvailable (17)
  33. * -- the additional information requested could not be understood
  34. * -- or is not available
  35. * badSenderNonce (18),
  36. * badCertTemplate (19),
  37. * signerNotTrusted (20),
  38. * transactionIdInUse (21),
  39. * unsupportedVersion (22),
  40. * notAuthorized (23),
  41. * systemUnavail (24),
  42. * systemFailure (25),
  43. * -- the request cannot be handled due to system failure
  44. * duplicateCertReq (26)
  45. * </pre>
  46. */
  47. public class PkiFailureInfo
  48. : DerBitString
  49. {
  50. public const int BadAlg = (1 << 7); // unrecognized or unsupported Algorithm Identifier
  51. public const int BadMessageCheck = (1 << 6); // integrity check failed (e.g., signature did not verify)
  52. public const int BadRequest = (1 << 5);
  53. public const int BadTime = (1 << 4); // -- messageTime was not sufficiently close to the system time, as defined by local policy
  54. public const int BadCertId = (1 << 3); // no certificate could be found matching the provided criteria
  55. public const int BadDataFormat = (1 << 2);
  56. public const int WrongAuthority = (1 << 1); // the authority indicated in the request is different from the one creating the response token
  57. public const int IncorrectData = 1; // the requester's data is incorrect (for notary services)
  58. public const int MissingTimeStamp = (1 << 15); // when the timestamp is missing but should be there (by policy)
  59. public const int BadPop = (1 << 14); // the proof-of-possession failed
  60. public const int CertRevoked = (1 << 13);
  61. public const int CertConfirmed = (1 << 12);
  62. public const int WrongIntegrity = (1 << 11);
  63. public const int BadRecipientNonce = (1 << 10);
  64. public const int TimeNotAvailable = (1 << 9); // the TSA's time source is not available
  65. public const int UnacceptedPolicy = (1 << 8); // the requested TSA policy is not supported by the TSA
  66. public const int UnacceptedExtension = (1 << 23); //the requested extension is not supported by the TSA
  67. public const int AddInfoNotAvailable = (1 << 22); //the additional information requested could not be understood or is not available
  68. public const int BadSenderNonce = (1 << 21);
  69. public const int BadCertTemplate = (1 << 20);
  70. public const int SignerNotTrusted = (1 << 19);
  71. public const int TransactionIdInUse = (1 << 18);
  72. public const int UnsupportedVersion = (1 << 17);
  73. public const int NotAuthorized = (1 << 16);
  74. public const int SystemUnavail = (1 << 31);
  75. public const int SystemFailure = (1 << 30); //the request cannot be handled due to system failure
  76. public const int DuplicateCertReq = (1 << 29);
  77. /**
  78. * Basic constructor.
  79. */
  80. public PkiFailureInfo(int info)
  81. : base(info)
  82. {
  83. }
  84. public PkiFailureInfo(
  85. DerBitString info)
  86. : base(info.GetBytes(), info.PadBits)
  87. {
  88. }
  89. public override string ToString()
  90. {
  91. return "PkiFailureInfo: 0x" + this.IntValue.ToString("X");
  92. }
  93. }
  94. }
  95. #pragma warning restore
  96. #endif