OtherRevRefs.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Esf
  6. {
  7. /// <remarks>
  8. /// RFC 3126: 4.2.2 Complete Revocation Refs Attribute Definition
  9. /// <code>
  10. /// OtherRevRefs ::= SEQUENCE
  11. /// {
  12. /// otherRevRefType OtherRevRefType,
  13. /// otherRevRefs ANY DEFINED BY otherRevRefType
  14. /// }
  15. ///
  16. /// OtherRevRefType ::= OBJECT IDENTIFIER
  17. /// </code>
  18. /// </remarks>
  19. public class OtherRevRefs
  20. : Asn1Encodable
  21. {
  22. private readonly DerObjectIdentifier otherRevRefType;
  23. private readonly Asn1Object otherRevRefs;
  24. public static OtherRevRefs GetInstance(
  25. object obj)
  26. {
  27. if (obj == null || obj is OtherRevRefs)
  28. return (OtherRevRefs) obj;
  29. if (obj is Asn1Sequence)
  30. return new OtherRevRefs((Asn1Sequence) obj);
  31. throw new ArgumentException(
  32. "Unknown object in 'OtherRevRefs' factory: "
  33. + BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.GetTypeName(obj),
  34. "obj");
  35. }
  36. private OtherRevRefs(
  37. Asn1Sequence seq)
  38. {
  39. if (seq == null)
  40. throw new ArgumentNullException("seq");
  41. if (seq.Count != 2)
  42. throw new ArgumentException("Bad sequence size: " + seq.Count, "seq");
  43. this.otherRevRefType = (DerObjectIdentifier) seq[0].ToAsn1Object();
  44. this.otherRevRefs = seq[1].ToAsn1Object();
  45. }
  46. public OtherRevRefs(
  47. DerObjectIdentifier otherRevRefType,
  48. Asn1Encodable otherRevRefs)
  49. {
  50. if (otherRevRefType == null)
  51. throw new ArgumentNullException("otherRevRefType");
  52. if (otherRevRefs == null)
  53. throw new ArgumentNullException("otherRevRefs");
  54. this.otherRevRefType = otherRevRefType;
  55. this.otherRevRefs = otherRevRefs.ToAsn1Object();
  56. }
  57. public DerObjectIdentifier OtherRevRefType
  58. {
  59. get { return otherRevRefType; }
  60. }
  61. public Asn1Object OtherRevRefsObject
  62. {
  63. get { return otherRevRefs; }
  64. }
  65. public override Asn1Object ToAsn1Object()
  66. {
  67. return new DerSequence(otherRevRefType, otherRevRefs);
  68. }
  69. }
  70. }
  71. #pragma warning restore
  72. #endif