summary refs log tree commit diff
path: root/crypto/src/asn1/cms
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cms')
-rw-r--r--crypto/src/asn1/cms/AuthEnvelopedDataParser.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs b/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs
index 950040b26..1e1e72c02 100644
--- a/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs
+++ b/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs
@@ -22,7 +22,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 		private DerInteger			version;
 		private IAsn1Convertible	nextObject;
 		private bool				originatorInfoCalled;
-		private EncryptedContentInfoParser authEncryptedContentInfoParser;
+        private bool                isData;
 
 		public AuthEnvelopedDataParser(
 			Asn1SequenceParser	seq)
@@ -87,8 +87,9 @@ namespace Org.BouncyCastle.Asn1.Cms
 			{
 				Asn1SequenceParser o = (Asn1SequenceParser) nextObject;
 				nextObject = null;
-				authEncryptedContentInfoParser = new EncryptedContentInfoParser(o);
-				return authEncryptedContentInfoParser;
+                EncryptedContentInfoParser encryptedContentInfoParser = new EncryptedContentInfoParser(o);
+                isData = CmsObjectIdentifiers.Data.Equals(encryptedContentInfoParser.ContentType);
+                return encryptedContentInfoParser;
 			}
 
 			return null;
@@ -110,7 +111,7 @@ namespace Org.BouncyCastle.Asn1.Cms
 
 			// "The authAttrs MUST be present if the content type carried in
 			// EncryptedContentInfo is not id-data."
-			if (!authEncryptedContentInfoParser.ContentType.Equals(CmsObjectIdentifiers.Data))
+			if (!isData)
 				throw new Asn1ParsingException("authAttrs must be present with non-data content");
 
 			return null;