OtherRevocationInfoFormat.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
  4. {
  5. public class OtherRevocationInfoFormat
  6. : Asn1Encodable
  7. {
  8. private readonly DerObjectIdentifier otherRevInfoFormat;
  9. private readonly Asn1Encodable otherRevInfo;
  10. public OtherRevocationInfoFormat(
  11. DerObjectIdentifier otherRevInfoFormat,
  12. Asn1Encodable otherRevInfo)
  13. {
  14. this.otherRevInfoFormat = otherRevInfoFormat;
  15. this.otherRevInfo = otherRevInfo;
  16. }
  17. private OtherRevocationInfoFormat(Asn1Sequence seq)
  18. {
  19. otherRevInfoFormat = DerObjectIdentifier.GetInstance(seq[0]);
  20. otherRevInfo = seq[1];
  21. }
  22. /**
  23. * return a OtherRevocationInfoFormat object from a tagged object.
  24. *
  25. * @param obj the tagged object holding the object we want.
  26. * @param explicit true if the object is meant to be explicitly
  27. * tagged false otherwise.
  28. * @exception IllegalArgumentException if the object held by the
  29. * tagged object cannot be converted.
  30. */
  31. public static OtherRevocationInfoFormat GetInstance(Asn1TaggedObject obj, bool isExplicit)
  32. {
  33. return GetInstance(Asn1Sequence.GetInstance(obj, isExplicit));
  34. }
  35. /**
  36. * return a OtherRevocationInfoFormat object from the given object.
  37. *
  38. * @param obj the object we want converted.
  39. * @exception IllegalArgumentException if the object cannot be converted.
  40. */
  41. public static OtherRevocationInfoFormat GetInstance(object obj)
  42. {
  43. if (obj is OtherRevocationInfoFormat otherRevocationInfoFormat)
  44. return otherRevocationInfoFormat;
  45. if (obj != null)
  46. return new OtherRevocationInfoFormat(Asn1Sequence.GetInstance(obj));
  47. return null;
  48. }
  49. public virtual DerObjectIdentifier InfoFormat
  50. {
  51. get { return otherRevInfoFormat; }
  52. }
  53. public virtual Asn1Encodable Info
  54. {
  55. get { return otherRevInfo; }
  56. }
  57. /**
  58. * Produce an object suitable for an ASN1OutputStream.
  59. * <pre>
  60. * OtherRevocationInfoFormat ::= SEQUENCE {
  61. * otherRevInfoFormat OBJECT IDENTIFIER,
  62. * otherRevInfo ANY DEFINED BY otherRevInfoFormat }
  63. * </pre>
  64. */
  65. public override Asn1Object ToAsn1Object()
  66. {
  67. return new DerSequence(otherRevInfoFormat, otherRevInfo);
  68. }
  69. }
  70. }
  71. #pragma warning restore
  72. #endif