diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-13 11:18:57 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-03-13 11:18:57 +0700 |
commit | 9b6a49d24e163898a87db80bf33c7d47642d6338 (patch) | |
tree | d9f7fb113d71512311f4f3e5e64d990d372743fe | |
parent | Refactoring in Asn1 classes (diff) | |
download | BouncyCastle.NET-ed25519-9b6a49d24e163898a87db80bf33c7d47642d6338.tar.xz |
Report unsupported tags
-rw-r--r-- | crypto/src/asn1/Asn1InputStream.cs | 4 | ||||
-rw-r--r-- | crypto/src/asn1/Asn1TaggedObject.cs | 5 | ||||
-rw-r--r-- | crypto/src/asn1/Asn1UniversalTypes.cs | 7 |
3 files changed, 13 insertions, 3 deletions
diff --git a/crypto/src/asn1/Asn1InputStream.cs b/crypto/src/asn1/Asn1InputStream.cs index b4a87eae1..9ac9a6b02 100644 --- a/crypto/src/asn1/Asn1InputStream.cs +++ b/crypto/src/asn1/Asn1InputStream.cs @@ -433,7 +433,11 @@ namespace Org.BouncyCastle.Asn1 return DerVideotexString.CreatePrimitive(bytes); case Asn1Tags.VisibleString: return DerVisibleString.CreatePrimitive(bytes); + + case Asn1Tags.Real: + case Asn1Tags.EmbeddedPdv: case Asn1Tags.Time: + case Asn1Tags.UnrestrictedString: case Asn1Tags.Date: case Asn1Tags.TimeOfDay: case Asn1Tags.DateTime: diff --git a/crypto/src/asn1/Asn1TaggedObject.cs b/crypto/src/asn1/Asn1TaggedObject.cs index 314170750..ea882f31d 100644 --- a/crypto/src/asn1/Asn1TaggedObject.cs +++ b/crypto/src/asn1/Asn1TaggedObject.cs @@ -294,9 +294,8 @@ namespace Org.BouncyCastle.Asn1 public Asn1Object GetBaseUniversal(bool declaredExplicit, int tagNo) { - Asn1UniversalType universalType = Asn1UniversalTypes.Get(tagNo); - if (null == universalType) - throw new ArgumentException("unsupported UNIVERSAL tag number: " + tagNo, nameof(tagNo)); + Asn1UniversalType universalType = Asn1UniversalTypes.Get(tagNo) + ?? throw new ArgumentException("unsupported UNIVERSAL tag number: " + tagNo, nameof(tagNo)); return GetBaseUniversal(declaredExplicit, universalType); } diff --git a/crypto/src/asn1/Asn1UniversalTypes.cs b/crypto/src/asn1/Asn1UniversalTypes.cs index f5b5d0498..0ca20fc9c 100644 --- a/crypto/src/asn1/Asn1UniversalTypes.cs +++ b/crypto/src/asn1/Asn1UniversalTypes.cs @@ -65,7 +65,14 @@ namespace Org.BouncyCastle.Asn1 case Asn1Tags.Real: case Asn1Tags.EmbeddedPdv: + case Asn1Tags.Time: case Asn1Tags.UnrestrictedString: + case Asn1Tags.Date: + case Asn1Tags.TimeOfDay: + case Asn1Tags.DateTime: + case Asn1Tags.Duration: + case Asn1Tags.ObjectIdentifierIri: + case Asn1Tags.RelativeOidIri: default: return null; } |