summary refs log tree commit diff
path: root/crypto/src/cms/SignerInformation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/cms/SignerInformation.cs')
-rw-r--r--crypto/src/cms/SignerInformation.cs10
1 files changed, 2 insertions, 8 deletions
diff --git a/crypto/src/cms/SignerInformation.cs b/crypto/src/cms/SignerInformation.cs
index 551d9b737..99d300121 100644
--- a/crypto/src/cms/SignerInformation.cs
+++ b/crypto/src/cms/SignerInformation.cs
@@ -433,11 +433,9 @@ namespace Org.BouncyCastle.Cms
 					if (isCounterSignature)
 						throw new CmsException("[For counter signatures,] the signedAttributes field MUST NOT contain a content-type attribute");
 
-					if (!(validContentType is DerObjectIdentifier))
+					if (!(validContentType is DerObjectIdentifier signedContentType))
 						throw new CmsException("content-type attribute value not of ASN.1 type 'OBJECT IDENTIFIER'");
 
-					DerObjectIdentifier signedContentType = (DerObjectIdentifier)validContentType;
-
 					if (!signedContentType.Equals(contentType))
 						throw new CmsException("content-type attribute value does not match eContentType");
 				}
@@ -454,12 +452,8 @@ namespace Org.BouncyCastle.Cms
 				}
 				else
 				{
-					if (!(validMessageDigest is Asn1OctetString))
-					{
+					if (!(validMessageDigest is Asn1OctetString signedMessageDigest))
 						throw new CmsException("message-digest attribute value not of ASN.1 type 'OCTET STRING'");
-					}
-
-					Asn1OctetString signedMessageDigest = (Asn1OctetString)validMessageDigest;
 
 					if (!Arrays.AreEqual(resultDigest, signedMessageDigest.GetOctets()))
 						throw new CmsException("message-digest attribute value does not match calculated value");