summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--crypto/src/cms/CMSEnvelopedGenerator.cs9
-rw-r--r--crypto/src/cms/CMSUtils.cs9
-rw-r--r--crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs2
-rw-r--r--crypto/src/security/GeneratorUtilities.cs7
4 files changed, 23 insertions, 4 deletions
diff --git a/crypto/src/cms/CMSEnvelopedGenerator.cs b/crypto/src/cms/CMSEnvelopedGenerator.cs
index 9830cefcc..702afc664 100644
--- a/crypto/src/cms/CMSEnvelopedGenerator.cs
+++ b/crypto/src/cms/CMSEnvelopedGenerator.cs
@@ -8,6 +8,7 @@ using Org.BouncyCastle.Asn1.Nist;
 using Org.BouncyCastle.Asn1.Ntt;
 using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
+using Org.BouncyCastle.Asn1.Sec;
 using Org.BouncyCastle.Asn1.X509;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
@@ -104,8 +105,12 @@ namespace Org.BouncyCastle.Cms
 		public static readonly string Camellia256Wrap	= NttObjectIdentifiers.IdCamellia256Wrap.Id;
 		public static readonly string SeedWrap			= KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap.Id;
 
-		public static readonly string ECDHSha1Kdf		= X9ObjectIdentifiers.DHSinglePassStdDHSha1KdfScheme.Id;
-		public static readonly string ECMqvSha1Kdf		= X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme.Id;
+        public static readonly string ECDHSha1Kdf       = X9ObjectIdentifiers.DHSinglePassStdDHSha1KdfScheme.Id;
+        public static readonly string ECMqvSha1Kdf      = X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme.Id;
+        public static readonly string ECMqvSha224Kdf    = SecObjectIdentifiers.mqvSinglePass_sha224kdf_scheme.Id;
+        public static readonly string ECMqvSha256Kdf    = SecObjectIdentifiers.mqvSinglePass_sha256kdf_scheme.Id;
+        public static readonly string ECMqvSha384Kdf    = SecObjectIdentifiers.mqvSinglePass_sha384kdf_scheme.Id;
+        public static readonly string ECMqvSha512Kdf    = SecObjectIdentifiers.mqvSinglePass_sha512kdf_scheme.Id;
 
 		internal readonly IList<RecipientInfoGenerator> recipientInfoGenerators = new List<RecipientInfoGenerator>();
 		internal readonly SecureRandom m_random;
diff --git a/crypto/src/cms/CMSUtils.cs b/crypto/src/cms/CMSUtils.cs
index 0041d2fac..56509ed7f 100644
--- a/crypto/src/cms/CMSUtils.cs
+++ b/crypto/src/cms/CMSUtils.cs
@@ -5,7 +5,9 @@ using System.IO;
 using Org.BouncyCastle.Asn1;
 using Org.BouncyCastle.Asn1.Cms;
 using Org.BouncyCastle.Asn1.Ocsp;
+using Org.BouncyCastle.Asn1.Sec;
 using Org.BouncyCastle.Asn1.X509;
+using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Utilities.Collections;
 using Org.BouncyCastle.Utilities.IO;
 using Org.BouncyCastle.X509;
@@ -213,5 +215,12 @@ namespace Org.BouncyCastle.Cms
                     throw new ArgumentException("cannot add unsuccessful OCSP response to CMS SignedData");
             }
         }
+
+		internal static bool IsMqv(DerObjectIdentifier oid) =>
+			X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme.Equals(oid) ||
+			SecObjectIdentifiers.mqvSinglePass_sha224kdf_scheme.Equals(oid) ||
+			SecObjectIdentifiers.mqvSinglePass_sha256kdf_scheme.Equals(oid) ||
+			SecObjectIdentifiers.mqvSinglePass_sha384kdf_scheme.Equals(oid) ||
+			SecObjectIdentifiers.mqvSinglePass_sha512kdf_scheme.Equals(oid);
     }
 }
diff --git a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
index ab7c1a0bd..fc1554205 100644
--- a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
+++ b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs
@@ -75,7 +75,7 @@ namespace Org.BouncyCastle.Cms
 			}
 
 			Asn1OctetString ukm = null;
-			if (m_keyAgreementOid.Id.Equals(CmsEnvelopedGenerator.ECMqvSha1Kdf))
+            if (CmsUtilities.IsMqv(m_keyAgreementOid))
 			{
 				try
 				{
diff --git a/crypto/src/security/GeneratorUtilities.cs b/crypto/src/security/GeneratorUtilities.cs
index 26898aaf8..cb6ca9c1b 100644
--- a/crypto/src/security/GeneratorUtilities.cs
+++ b/crypto/src/security/GeneratorUtilities.cs
@@ -12,6 +12,7 @@ using Org.BouncyCastle.Asn1.Ntt;
 using Org.BouncyCastle.Asn1.Oiw;
 using Org.BouncyCastle.Asn1.Pkcs;
 using Org.BouncyCastle.Asn1.Rosstandart;
+using Org.BouncyCastle.Asn1.Sec;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Crypto;
 using Org.BouncyCastle.Crypto.Generators;
@@ -217,7 +218,11 @@ namespace Org.BouncyCastle.Security
                 "ECIES");
             AddKpgAlgorithm("ECDHC");
             AddKpgAlgorithm("ECMQV",
-                X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme);
+                X9ObjectIdentifiers.MqvSinglePassSha1KdfScheme,
+                SecObjectIdentifiers.mqvSinglePass_sha224kdf_scheme,
+                SecObjectIdentifiers.mqvSinglePass_sha256kdf_scheme,
+                SecObjectIdentifiers.mqvSinglePass_sha384kdf_scheme,
+                SecObjectIdentifiers.mqvSinglePass_sha512kdf_scheme);
             AddKpgAlgorithm("ECDSA");
             AddKpgAlgorithm("ECGOST3410",
                 "ECGOST-3410",