summary refs log tree commit diff
path: root/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs')
-rw-r--r--crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs20
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
index 479aa50cb..37bd1f770 100644
--- a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
+++ b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
@@ -14,11 +14,9 @@ using Org.BouncyCastle.X509;
 
 namespace Org.BouncyCastle.Cms
 {
-	internal class KeyAgreeRecipientInfoGenerator
+    internal class KeyAgreeRecipientInfoGenerator
 		: RecipientInfoGenerator
 	{
-		private static readonly CmsEnvelopedHelper Helper = CmsEnvelopedHelper.Instance;
-
         private readonly List<KeyAgreeRecipientIdentifier> m_recipientIDs = new List<KeyAgreeRecipientIdentifier>();
         private readonly List<AsymmetricKeyParameter> m_recipientKeys = new List<AsymmetricKeyParameter>();
 
@@ -75,7 +73,7 @@ namespace Org.BouncyCastle.Cms
 			}
 
 			Asn1OctetString ukm = null;
-			if (m_keyAgreementOid.Id.Equals(CmsEnvelopedGenerator.ECMqvSha1Kdf))
+            if (CmsUtilities.IsMqv(m_keyAgreementOid))
 			{
 				try
 				{
@@ -146,12 +144,10 @@ namespace Org.BouncyCastle.Cms
 				new DerSequence(recipientEncryptedKeys)));
 		}
 
-		private static OriginatorPublicKey CreateOriginatorPublicKey(AsymmetricKeyParameter publicKey)
-		{
-			SubjectPublicKeyInfo spki = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
-			return new OriginatorPublicKey(
-                new AlgorithmIdentifier(spki.AlgorithmID.Algorithm, DerNull.Instance),
-				spki.PublicKeyData.GetBytes());
-		}
-	}
+		private static OriginatorPublicKey CreateOriginatorPublicKey(AsymmetricKeyParameter publicKey) =>
+			CreateOriginatorPublicKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey));
+
+        private static OriginatorPublicKey CreateOriginatorPublicKey(SubjectPublicKeyInfo originatorKeyInfo) =>
+			new OriginatorPublicKey(originatorKeyInfo.Algorithm, originatorKeyInfo.PublicKey);
+    }
 }