diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-08 14:39:47 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2021-02-08 14:39:47 +0700 |
commit | 35a005ff4a08c5a0a963e9c861abdf49e086c1ea (patch) | |
tree | c9de1bceb45ba966c172577bfd225e4c86348506 /crypto/src/asn1 | |
parent | Implement TODO checks (diff) | |
download | BouncyCastle.NET-ed25519-35a005ff4a08c5a0a963e9c861abdf49e086c1ea.tar.xz |
Implement TODO checks
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/cms/AuthEnvelopedDataParser.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs b/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs index 35cb3bfcc..52f0bf720 100644 --- a/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs +++ b/crypto/src/asn1/cms/AuthEnvelopedDataParser.cs @@ -22,15 +22,17 @@ namespace Org.BouncyCastle.Asn1.Cms private DerInteger version; private IAsn1Convertible nextObject; private bool originatorInfoCalled; + private EncryptedContentInfoParser authEncryptedContentInfoParser; public AuthEnvelopedDataParser( Asn1SequenceParser seq) { this.seq = seq; - // TODO // "It MUST be set to 0." this.version = (DerInteger)seq.ReadObject(); + if (version.IntValueExact != 0) + throw new Asn1ParsingException("AuthEnvelopedData version number must be 0"); } public DerInteger Version @@ -85,7 +87,8 @@ namespace Org.BouncyCastle.Asn1.Cms { Asn1SequenceParser o = (Asn1SequenceParser) nextObject; nextObject = null; - return new EncryptedContentInfoParser(o); + authEncryptedContentInfoParser = new EncryptedContentInfoParser(o); + return authEncryptedContentInfoParser; } return null; @@ -105,9 +108,10 @@ namespace Org.BouncyCastle.Asn1.Cms return (Asn1SetParser)((Asn1TaggedObjectParser)o).GetObjectParser(Asn1Tags.Set, false); } - // TODO // "The authAttrs MUST be present if the content type carried in // EncryptedContentInfo is not id-data." + if (!authEncryptedContentInfoParser.ContentType.Equals(CmsObjectIdentifiers.Data)) + throw new Asn1ParsingException("authAttrs must be present with non-data content"); return null; } |