summary refs log tree commit diff
path: root/crypto/src/asn1
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2018-09-18 14:21:19 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2018-09-18 14:21:19 +0700
commitf7b6049eb3cc4687ca0d0791da80ed42b0b2327c (patch)
tree57722e5acff55ca1b6aed01b5f9efa092a80262b /crypto/src/asn1
parentCode cleanup (diff)
downloadBouncyCastle.NET-ed25519-f7b6049eb3cc4687ca0d0791da80ed42b0b2327c.tar.xz
Add missing default and improve extensions handling
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r--crypto/src/asn1/x509/TBSCertificateStructure.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/src/asn1/x509/TBSCertificateStructure.cs b/crypto/src/asn1/x509/TBSCertificateStructure.cs
index 9df078539..e69e985f5 100644
--- a/crypto/src/asn1/x509/TBSCertificateStructure.cs
+++ b/crypto/src/asn1/x509/TBSCertificateStructure.cs
@@ -121,7 +121,7 @@ namespace Org.BouncyCastle.Asn1.X509
 
             while (extras > 0)
 			{
-				DerTaggedObject extra = (DerTaggedObject) seq[seqStart + 6 + extras];
+				DerTaggedObject extra = (DerTaggedObject)seq[seqStart + 6 + extras];
 
 				switch (extra.TagNo)
 				{
@@ -140,9 +140,13 @@ namespace Org.BouncyCastle.Asn1.X509
                     if (isV2)
                         throw new ArgumentException("version 2 certificate cannot contain extensions");
 
-                    extensions = X509Extensions.GetInstance(extra);
+                    extensions = X509Extensions.GetInstance(Asn1Sequence.GetInstance(extra, true));
 					break;
                 }
+                default:
+                {
+                    throw new ArgumentException("Unknown tag encountered in structure: " + extra.TagNo);
+                }
                 }
                 extras--;
 			}