PkixCertPathValidatorResult.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using System.Text;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
  6. using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
  7. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Pkix
  8. {
  9. /// <summary>
  10. /// Summary description for PkixCertPathValidatorResult.
  11. /// </summary>
  12. public class PkixCertPathValidatorResult
  13. //: ICertPathValidatorResult
  14. {
  15. private TrustAnchor trustAnchor;
  16. private PkixPolicyNode policyTree;
  17. private AsymmetricKeyParameter subjectPublicKey;
  18. public PkixPolicyNode PolicyTree
  19. {
  20. get { return this.policyTree; }
  21. }
  22. public TrustAnchor TrustAnchor
  23. {
  24. get { return this.trustAnchor; }
  25. }
  26. public AsymmetricKeyParameter SubjectPublicKey
  27. {
  28. get { return this.subjectPublicKey; }
  29. }
  30. public PkixCertPathValidatorResult(
  31. TrustAnchor trustAnchor,
  32. PkixPolicyNode policyTree,
  33. AsymmetricKeyParameter subjectPublicKey)
  34. {
  35. if (subjectPublicKey == null)
  36. {
  37. throw new NullReferenceException("subjectPublicKey must be non-null");
  38. }
  39. if (trustAnchor == null)
  40. {
  41. throw new NullReferenceException("trustAnchor must be non-null");
  42. }
  43. this.trustAnchor = trustAnchor;
  44. this.policyTree = policyTree;
  45. this.subjectPublicKey = subjectPublicKey;
  46. }
  47. public object Clone()
  48. {
  49. return new PkixCertPathValidatorResult(this.TrustAnchor, this.PolicyTree, this.SubjectPublicKey);
  50. }
  51. public override String ToString()
  52. {
  53. StringBuilder sB = new StringBuilder();
  54. sB.Append("PKIXCertPathValidatorResult: [ \n");
  55. sB.Append(" Trust Anchor: ").Append(this.TrustAnchor).Append('\n');
  56. sB.Append(" Policy Tree: ").Append(this.PolicyTree).Append('\n');
  57. sB.Append(" Subject Public Key: ").Append(this.SubjectPublicKey).Append("\n]");
  58. return sB.ToString();
  59. }
  60. }
  61. }
  62. #pragma warning restore
  63. #endif