PkixCertPathChecker.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Pkix
  6. {
  7. public abstract class PkixCertPathChecker
  8. {
  9. protected PkixCertPathChecker()
  10. {
  11. }
  12. /**
  13. * Initializes the internal state of this <code>PKIXCertPathChecker</code>.
  14. * <p>
  15. * The <code>forward</code> flag specifies the order that certificates
  16. * will be passed to the {@link #check check} method (forward or reverse). A
  17. * <code>PKIXCertPathChecker</code> <b>must</b> support reverse checking
  18. * and <b>may</b> support forward checking.
  19. * </p>
  20. *
  21. * @param forward
  22. * the order that certificates are presented to the
  23. * <code>check</code> method. If <code>true</code>,
  24. * certificates are presented from target to most-trusted CA
  25. * (forward); if <code>false</code>, from most-trusted CA to
  26. * target (reverse).
  27. * @exception CertPathValidatorException
  28. * if this <code>PKIXCertPathChecker</code> is unable to
  29. * check certificates in the specified order; it should never
  30. * be thrown if the forward flag is false since reverse
  31. * checking must be supported
  32. */
  33. public abstract void Init(bool forward);
  34. //throws CertPathValidatorException;
  35. /**
  36. * Indicates if forward checking is supported. Forward checking refers to
  37. * the ability of the <code>PKIXCertPathChecker</code> to perform its
  38. * checks when certificates are presented to the <code>check</code> method
  39. * in the forward direction (from target to most-trusted CA).
  40. *
  41. * @return <code>true</code> if forward checking is supported,
  42. * <code>false</code> otherwise
  43. */
  44. public abstract bool IsForwardCheckingSupported();
  45. /**
  46. * Returns an immutable <code>Set</code> of X.509 certificate extensions
  47. * that this <code>PKIXCertPathChecker</code> supports (i.e. recognizes,
  48. * is able to process), or <code>null</code> if no extensions are
  49. * supported.
  50. * <p>
  51. * Each element of the set is a <code>String</code> representing the
  52. * Object Identifier (OID) of the X.509 extension that is supported. The OID
  53. * is represented by a set of nonnegative integers separated by periods.
  54. * </p><p>
  55. * All X.509 certificate extensions that a <code>PKIXCertPathChecker</code>
  56. * might possibly be able to process should be included in the set.
  57. * </p>
  58. *
  59. * @return an immutable <code>Set</code> of X.509 extension OIDs (in
  60. * <code>String</code> format) supported by this
  61. * <code>PKIXCertPathChecker</code>, or <code>null</code> if no
  62. * extensions are supported
  63. */
  64. public abstract ISet GetSupportedExtensions();
  65. /**
  66. * Performs the check(s) on the specified certificate using its internal
  67. * state and removes any critical extensions that it processes from the
  68. * specified collection of OID strings that represent the unresolved
  69. * critical extensions. The certificates are presented in the order
  70. * specified by the <code>init</code> method.
  71. *
  72. * @param cert
  73. * the <code>Certificate</code> to be checked
  74. * @param unresolvedCritExts
  75. * a <code>Collection</code> of OID strings representing the
  76. * current set of unresolved critical extensions
  77. * @exception CertPathValidatorException
  78. * if the specified certificate does not pass the check
  79. */
  80. public abstract void Check(X509Certificate cert, ISet unresolvedCritExts);
  81. //throws CertPathValidatorException;
  82. /**
  83. * Returns a clone of this object. Calls the <code>Object.clone()</code>
  84. * method. All subclasses which maintain state must support and override
  85. * this method, if necessary.
  86. *
  87. * @return a copy of this <code>PKIXCertPathChecker</code>
  88. */
  89. public virtual object Clone()
  90. {
  91. // TODO Check this
  92. return base.MemberwiseClone();
  93. }
  94. }
  95. }
  96. #pragma warning restore
  97. #endif