diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-21 00:26:34 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-07-21 00:26:34 +0700 |
commit | 9f36987f992075b2f61214f6d83433efd597e93e (patch) | |
tree | 4cc2e19d8dc1229479acbcdf2bb62811b0344785 /crypto/src/asn1/cmp/PKIHeader.cs | |
parent | Refactoring in Asn1.Cms (diff) | |
download | BouncyCastle.NET-ed25519-9f36987f992075b2f61214f6d83433efd597e93e.tar.xz |
Refactoring in Asn1.Cmp
Diffstat (limited to 'crypto/src/asn1/cmp/PKIHeader.cs')
-rw-r--r-- | crypto/src/asn1/cmp/PKIHeader.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crypto/src/asn1/cmp/PKIHeader.cs b/crypto/src/asn1/cmp/PKIHeader.cs index 6914ae613..c000c8b98 100644 --- a/crypto/src/asn1/cmp/PKIHeader.cs +++ b/crypto/src/asn1/cmp/PKIHeader.cs @@ -1,7 +1,6 @@ using System; using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Asn1.Cmp { @@ -27,7 +26,7 @@ namespace Org.BouncyCastle.Asn1.Cmp public static PkiHeader GetInstance(Asn1TaggedObject taggedObject, bool declaredExplicit) { - return GetInstance(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); + return new PkiHeader(Asn1Sequence.GetInstance(taggedObject, declaredExplicit)); } private readonly DerInteger pvno; @@ -52,8 +51,8 @@ namespace Org.BouncyCastle.Asn1.Cmp for (int pos = 3; pos < seq.Count; ++pos) { Asn1TaggedObject tObj = Asn1TaggedObject.GetInstance(seq[pos]); - if (Asn1Tags.ContextSpecific != tObj.TagClass) - continue; + if (!tObj.HasContextTag()) + throw new ArgumentException("unknown tag: " + Asn1Utilities.GetTagText(tObj)); switch (tObj.TagNo) { @@ -85,7 +84,7 @@ namespace Org.BouncyCastle.Asn1.Cmp generalInfo = Asn1Sequence.GetInstance(tObj, true); break; default: - throw new ArgumentException("unknown tag number: " + tObj.TagNo, nameof(seq)); + throw new ArgumentException("unknown tag number: " + tObj.TagNo); } } } |