GenRepContent.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cmp
  4. {
  5. public class GenRepContent
  6. : Asn1Encodable
  7. {
  8. public static GenRepContent GetInstance(object obj)
  9. {
  10. if (obj is GenRepContent genRepContent)
  11. return genRepContent;
  12. if (obj != null)
  13. return new GenRepContent(Asn1Sequence.GetInstance(obj));
  14. return null;
  15. }
  16. private readonly Asn1Sequence m_content;
  17. private GenRepContent(Asn1Sequence seq)
  18. {
  19. m_content = seq;
  20. }
  21. public GenRepContent(InfoTypeAndValue itv)
  22. {
  23. m_content = new DerSequence(itv);
  24. }
  25. public GenRepContent(params InfoTypeAndValue[] itvs)
  26. {
  27. m_content = new DerSequence(itvs);
  28. }
  29. public virtual InfoTypeAndValue[] ToInfoTypeAndValueArray()
  30. {
  31. return m_content.MapElements(InfoTypeAndValue.GetInstance);
  32. }
  33. /**
  34. * <pre>
  35. * GenRepContent ::= SEQUENCE OF InfoTypeAndValue
  36. * </pre>
  37. * @return a basic ASN.1 object representation.
  38. */
  39. public override Asn1Object ToAsn1Object()
  40. {
  41. return m_content;
  42. }
  43. }
  44. }
  45. #pragma warning restore
  46. #endif