EncryptedContentInfoParser.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
  2. #pragma warning disable
  3. using System;
  4. using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
  5. namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms
  6. {
  7. /**
  8. * <pre>
  9. * EncryptedContentInfo ::= SEQUENCE {
  10. * contentType ContentType,
  11. * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
  12. * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
  13. * }
  14. * </pre>
  15. */
  16. public class EncryptedContentInfoParser
  17. {
  18. private DerObjectIdentifier _contentType;
  19. private AlgorithmIdentifier _contentEncryptionAlgorithm;
  20. private Asn1TaggedObjectParser _encryptedContent;
  21. public EncryptedContentInfoParser(
  22. Asn1SequenceParser seq)
  23. {
  24. _contentType = (DerObjectIdentifier)seq.ReadObject();
  25. _contentEncryptionAlgorithm = AlgorithmIdentifier.GetInstance(seq.ReadObject().ToAsn1Object());
  26. _encryptedContent = (Asn1TaggedObjectParser)seq.ReadObject();
  27. }
  28. public DerObjectIdentifier ContentType
  29. {
  30. get { return _contentType; }
  31. }
  32. public AlgorithmIdentifier ContentEncryptionAlgorithm
  33. {
  34. get { return _contentEncryptionAlgorithm; }
  35. }
  36. public IAsn1Convertible GetEncryptedContent(
  37. int tag)
  38. {
  39. return _encryptedContent.GetObjectParser(tag, false);
  40. }
  41. }
  42. }
  43. #pragma warning restore
  44. #endif