summary refs log tree commit diff
path: root/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs')
-rw-r--r--crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
index 4460c8265..88c3b6e40 100644
--- a/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
+++ b/crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs
@@ -1,3 +1,5 @@
+using System;
+
 namespace Org.BouncyCastle.Asn1.Cmp
 {
 	public class CAKeyUpdAnnContent
@@ -23,7 +25,11 @@ namespace Org.BouncyCastle.Asn1.Cmp
 
 		private CAKeyUpdAnnContent(Asn1Sequence seq)
 		{
-			m_oldWithNew = CmpCertificate.GetInstance(seq[0]);
+            int count = seq.Count;
+            if (count != 3)
+                throw new ArgumentException("Bad sequence size: " + count, nameof(seq));
+
+            m_oldWithNew = CmpCertificate.GetInstance(seq[0]);
 			m_newWithOld = CmpCertificate.GetInstance(seq[1]);
 			m_newWithNew = CmpCertificate.GetInstance(seq[2]);
 		}