summary refs log tree commit diff
path: root/crypto/src/cms/KeyAgreeRecipientInformation.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/cms/KeyAgreeRecipientInformation.cs')
-rw-r--r--crypto/src/cms/KeyAgreeRecipientInformation.cs4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/src/cms/KeyAgreeRecipientInformation.cs b/crypto/src/cms/KeyAgreeRecipientInformation.cs
index 8843ede0d..398082810 100644
--- a/crypto/src/cms/KeyAgreeRecipientInformation.cs
+++ b/crypto/src/cms/KeyAgreeRecipientInformation.cs
@@ -208,11 +208,9 @@ namespace Org.BouncyCastle.Cms
         public override CmsTypedStream GetContentStream(
             ICipherParameters key)
         {
-            if (!(key is AsymmetricKeyParameter))
+            if (!(key is AsymmetricKeyParameter receiverPrivateKey))
                 throw new ArgumentException("KeyAgreement requires asymmetric key", "key");
 
-            AsymmetricKeyParameter receiverPrivateKey = (AsymmetricKeyParameter) key;
-
             if (!receiverPrivateKey.IsPrivate)
                 throw new ArgumentException("Expected private key", "key");