CompressedDataParser.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
  5. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  6. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
  7. {
  8. /**
  9. * RFC 3274 - CMS Compressed Data.
  10. * <pre>
  11. * CompressedData ::= SEQUENCE {
  12. * version CMSVersion,
  13. * compressionAlgorithm CompressionAlgorithmIdentifier,
  14. * encapContentInfo EncapsulatedContentInfo
  15. * }
  16. * </pre>
  17. */
  18. public class CompressedDataParser
  19. {
  20. private DerInteger _version;
  21. private AlgorithmIdentifier _compressionAlgorithm;
  22. private ContentInfoParser _encapContentInfo;
  23. public CompressedDataParser(
  24. Asn1SequenceParser seq)
  25. {
  26. this._version = (DerInteger)seq.ReadObject();
  27. this._compressionAlgorithm = AlgorithmIdentifier.GetInstance(seq.ReadObject().ToAsn1Object());
  28. this._encapContentInfo = new ContentInfoParser((Asn1SequenceParser)seq.ReadObject());
  29. }
  30. public DerInteger Version
  31. {
  32. get { return _version; }
  33. }
  34. public AlgorithmIdentifier CompressionAlgorithmIdentifier
  35. {
  36. get { return _compressionAlgorithm; }
  37. }
  38. public ContentInfoParser GetEncapContentInfo()
  39. {
  40. return _encapContentInfo;
  41. }
  42. }
  43. }
  44. #pragma warning restore
  45. #endif