SingleResp.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp;
  5. using Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  6. using Best.HTTP.SecureProtocol.Org.BouncyCastle.X509;
  7. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Ocsp
  8. {
  9. public class SingleResp
  10. : X509ExtensionBase
  11. {
  12. internal readonly SingleResponse resp;
  13. public SingleResp(
  14. SingleResponse resp)
  15. {
  16. this.resp = resp;
  17. }
  18. public CertificateID GetCertID()
  19. {
  20. return new CertificateID(resp.CertId);
  21. }
  22. /**
  23. * Return the status object for the response - null indicates good.
  24. *
  25. * @return the status object for the response, null if it is good.
  26. */
  27. public object GetCertStatus()
  28. {
  29. CertStatus s = resp.CertStatus;
  30. if (s.TagNo == 0)
  31. {
  32. return null; // good
  33. }
  34. if (s.TagNo == 1)
  35. {
  36. return new RevokedStatus(RevokedInfo.GetInstance(s.Status));
  37. }
  38. return new UnknownStatus();
  39. }
  40. public DateTime ThisUpdate
  41. {
  42. get { return resp.ThisUpdate.ToDateTime(); }
  43. }
  44. /**
  45. * return the NextUpdate value - note: this is an optional field so may
  46. * be returned as null.
  47. *
  48. * @return nextUpdate, or null if not present.
  49. */
  50. public DateTime? NextUpdate => resp.NextUpdate?.ToDateTime();
  51. public X509Extensions SingleExtensions
  52. {
  53. get { return resp.SingleExtensions; }
  54. }
  55. protected override X509Extensions GetX509Extensions()
  56. {
  57. return SingleExtensions;
  58. }
  59. }
  60. }
  61. #pragma warning restore
  62. #endif