OtherRevocationInfoFormat.cs 2.7 KB

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