GenMsgContent.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /**
  6. * <pre>GenMsgContent ::= SEQUENCE OF InfoTypeAndValue</pre>
  7. */
  8. public class GenMsgContent
  9. : Asn1Encodable
  10. {
  11. public static GenMsgContent GetInstance(object obj)
  12. {
  13. if (obj is GenMsgContent genMsgContent)
  14. return genMsgContent;
  15. if (obj != null)
  16. return new GenMsgContent(Asn1Sequence.GetInstance(obj));
  17. return null;
  18. }
  19. private readonly Asn1Sequence m_content;
  20. private GenMsgContent(Asn1Sequence seq)
  21. {
  22. m_content = seq;
  23. }
  24. public GenMsgContent(InfoTypeAndValue itv)
  25. {
  26. m_content = new DerSequence(itv);
  27. }
  28. public GenMsgContent(params InfoTypeAndValue[] itvs)
  29. {
  30. m_content = new DerSequence(itvs);
  31. }
  32. public virtual InfoTypeAndValue[] ToInfoTypeAndValueArray()
  33. {
  34. return m_content.MapElements(InfoTypeAndValue.GetInstance);
  35. }
  36. /**
  37. * <pre>
  38. * GenMsgContent ::= SEQUENCE OF InfoTypeAndValue
  39. * </pre>
  40. * @return a basic ASN.1 object representation.
  41. */
  42. public override Asn1Object ToAsn1Object()
  43. {
  44. return m_content;
  45. }
  46. }
  47. }
  48. #pragma warning restore
  49. #endif