summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-07-21 23:51:00 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-07-21 23:51:00 +0700
commitc2d847a1bf7570dffdbc3980515c2e0c559e9989 (patch)
tree07c90ee01368ee2241ec097f197c21985b39b84e /crypto/src
parentUse Pack (diff)
downloadBouncyCastle.NET-ed25519-c2d847a1bf7570dffdbc3980515c2e0c559e9989.tar.xz
Hold boolean instead of the parser
Diffstat (limited to 'crypto/src')
-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;