summary refs log tree commit diff
path: root/crypto/src/cms
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-06-01 18:58:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-06-01 18:58:01 +0700
commit17dbcd1de2147c407f30f84d29ac6e223baf5d73 (patch)
tree95a935970c10b2d180a0aae388d60b431ed745ce /crypto/src/cms
parentMerge branch 'rastrup-patch-4' (diff)
downloadBouncyCastle.NET-ed25519-17dbcd1de2147c407f30f84d29ac6e223baf5d73.tar.xz
Support SM2 in SignerUtilities
- including support for non-standard SHA256withSM2
Diffstat (limited to 'crypto/src/cms')
-rw-r--r--crypto/src/cms/CMSSignedGenerator.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/src/cms/CMSSignedGenerator.cs b/crypto/src/cms/CMSSignedGenerator.cs
index c7bc4ea43..b618ae3d4 100644
--- a/crypto/src/cms/CMSSignedGenerator.cs
+++ b/crypto/src/cms/CMSSignedGenerator.cs
@@ -134,6 +134,8 @@ namespace Org.BouncyCastle.Cms
             algorithms["SHA512WITHCVC-ECDSA"] = EacObjectIdentifiers.id_TA_ECDSA_SHA_512;
             algorithms["SHA3-512WITHSPHINCS256"] = BCObjectIdentifiers.sphincs256_with_SHA3_512;
             algorithms["SHA512WITHSPHINCS256"] = BCObjectIdentifiers.sphincs256_with_SHA512;
+
+            algorithms["SHA256WITHSM2"] = GMObjectIdentifiers.sm2sign_with_sha256;
             algorithms["SM3WITHSM2"] = GMObjectIdentifiers.sm2sign_with_sm3;
 
             algorithms["SHA256WITHXMSS"] = BCObjectIdentifiers.xmss_with_SHA256;
@@ -200,6 +202,7 @@ namespace Org.BouncyCastle.Cms
             //
             // SM2
             //
+            noParams.Add((object)GMObjectIdentifiers.sm2sign_with_sha256);
             noParams.Add((object)GMObjectIdentifiers.sm2sign_with_sm3);
 
             //
@@ -283,8 +286,9 @@ namespace Org.BouncyCastle.Cms
             digestOids[CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001] = CryptoProObjectIdentifiers.GostR3411;
             digestOids[RosstandartObjectIdentifiers.id_tc26_signwithdigest_gost_3410_12_256] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256;
             digestOids[RosstandartObjectIdentifiers.id_tc26_signwithdigest_gost_3410_12_512] = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512;
-            digestOids[GMObjectIdentifiers.sm2sign_with_sm3] = GMObjectIdentifiers.sm3;
 
+            digestOids[GMObjectIdentifiers.sm2sign_with_sha256] = NistObjectIdentifiers.IdSha256;
+            digestOids[GMObjectIdentifiers.sm2sign_with_sm3] = GMObjectIdentifiers.sm3;
         }
 
         private static AlgorithmIdentifier Generate(string signatureAlgorithm)