PkixCertPathValidatorResult.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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(TrustAnchor trustAnchor, PkixPolicyNode policyTree,
  31. AsymmetricKeyParameter subjectPublicKey)
  32. {
  33. if (trustAnchor == null)
  34. throw new ArgumentNullException(nameof(trustAnchor));
  35. if (subjectPublicKey == null)
  36. throw new ArgumentNullException(nameof(subjectPublicKey));
  37. this.trustAnchor = trustAnchor;
  38. this.policyTree = policyTree;
  39. this.subjectPublicKey = subjectPublicKey;
  40. }
  41. public object Clone()
  42. {
  43. return new PkixCertPathValidatorResult(this.TrustAnchor, this.PolicyTree, this.SubjectPublicKey);
  44. }
  45. public override string ToString()
  46. {
  47. StringBuilder sb = new StringBuilder();
  48. sb.AppendLine("PKIXCertPathValidatorResult: [");
  49. sb.Append(" Trust Anchor: ").Append(TrustAnchor).AppendLine();
  50. sb.Append(" Policy Tree: ").Append(PolicyTree).AppendLine();
  51. sb.Append(" Subject Public Key: ").Append(SubjectPublicKey).AppendLine();
  52. return sb.ToString();
  53. }
  54. }
  55. }
  56. #pragma warning restore
  57. #endif