ContentInfoParser.cs 964 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. /**
  7. * Produce an object suitable for an Asn1OutputStream.
  8. * <pre>
  9. * ContentInfo ::= SEQUENCE {
  10. * contentType ContentType,
  11. * content
  12. * [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL }
  13. * </pre>
  14. */
  15. public class ContentInfoParser
  16. {
  17. private DerObjectIdentifier contentType;
  18. private Asn1TaggedObjectParser content;
  19. public ContentInfoParser(
  20. Asn1SequenceParser seq)
  21. {
  22. contentType = (DerObjectIdentifier)seq.ReadObject();
  23. content = (Asn1TaggedObjectParser)seq.ReadObject();
  24. }
  25. public DerObjectIdentifier ContentType
  26. {
  27. get { return contentType; }
  28. }
  29. public IAsn1Convertible GetContent(
  30. int tag)
  31. {
  32. if (content == null)
  33. return null;
  34. return content.GetObjectParser(tag, true);
  35. }
  36. }
  37. }
  38. #pragma warning restore
  39. #endif