aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/data
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-09-20 17:33:06 +0000
committerJack Lloyd <[email protected]>2017-09-20 17:33:06 +0000
commit98993f542727787dcdc8e549a748a94886643458 (patch)
tree1d369c60817b5ae0bd616f6b046322950cd65065 /src/tests/data
parentbbbc4c59ec85ec912b482afab1eccc0fd3b1f87a (diff)
Update SM2 to use ASN.1 encoding for ciphertexts
There are in fact 3 different variations of SM2 standard, first C1||C2||C3, then C1||C3||C2, then (most recently) an ASN.1 encoding. This makes us compatible with GmSSL This work was sponsored by Ribose Inc (@riboseinc).
Diffstat (limited to 'src/tests/data')
-rw-r--r--src/tests/data/pubkey/sm2_enc.vec30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/tests/data/pubkey/sm2_enc.vec b/src/tests/data/pubkey/sm2_enc.vec
index 120eab583..0fd3b3e34 100644
--- a/src/tests/data/pubkey/sm2_enc.vec
+++ b/src/tests/data/pubkey/sm2_enc.vec
@@ -1,5 +1,5 @@
-# Example from draft-shen-sm2-ecdsa-02
-# Corrected to use (C1||C3||C2) - the draft is wrong!
+
+# The standard SM2 test input, ASN.1 from GmSSL
P = 0x8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3
A = 0x787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498
@@ -9,7 +9,29 @@ yG = 0x0680512BCBB42C07D47349D2153B70C4E5D7FDFCBFA36EA1A85841B9E46E09A2
Order = 0x8542D69E4C044F18E8B92435BF6FF7DD297720630485628D5AE74EE7C32E79B7
Cofactor = 1
-Msg = 656E6372797074696F6E207374616E64617264
x = 0x1649AB77A00637BD5E2EFE283FBF353534AA7F7CB89463F208DDBC2920BB0DA0
+
+Msg = 656E6372797074696F6E207374616E64617264
Nonce = 4C62EEFD6ECFC2B95B92FD6C3D9575148AFA17425546D49018E5388D49DD7B4F
-Ciphertext = 04245C26FB68B1DDDDB12C4B6BF9F2B6D5FE60A383B0D18D1C4144ABF17F6252E776CB9264C2A7E88E52B19903FDC47378F605E36811F5C07423A24B84400F01B89C3D7360C30156FAB7C80A0276712DA9D8094A634B766D3A285E07480653426D650053A89B41C418B0C3AAD00D886C00286467
+Ciphertext = 307B0220245C26FB68B1DDDDB12C4B6BF9F2B6D5FE60A383B0D18D1C4144ABF17F6252E7022076CB9264C2A7E88E52B19903FDC47378F605E36811F5C07423A24B84400F01B804209C3D7360C30156FAB7C80A0276712DA9D8094A634B766D3A285E07480653426D0413650053A89B41C418B0C3AAD00D886C00286467
+
+# Same test as above but using SHA-256, generated by GmSSL
+
+Hash = SHA-256
+Ciphertext = 307B0220245C26FB68B1DDDDB12C4B6BF9F2B6D5FE60A383B0D18D1C4144ABF17F6252E7022076CB9264C2A7E88E52B19903FDC47378F605E36811F5C07423A24B84400F01B80420BE89139D07853100EFA763F60CBE30099EA3DF7F8F364F9D10A5E988E3C5AAFC0413229E6C9AEE2BB92CAD649FE2C035689785DA33
+
+
+# Random tests by GmSSL
+Hash = SM3
+
+Msg = 61207465737420696E707574
+Nonce = 04B4EC222E5F984A397837C481FC5A81A19B542D694E8BBF2E58E0FB19E92F0E
+Ciphertext = 3074022039EA73E877679ED0BBAD126B9A61F882DEDC329FAAF5529D5B3EE167B95322E502203A36529C0BF5525501FA9F18F18F1571EBDE47951519B4E04F214560363C35990420FE3D9CB71BA55F7F173911E2FF4CD5239392B91291254C33970E6ABF097D5FE1040CADF4FA9A4E56FCAAD1AD9C97
+
+Msg = 61207465737420696E707574
+Nonce = 34B4EC222E5F984A397837C481FC5A81A19B542D694E8BBF2E58E0FB19E92F0E
+Ciphertext = 307402201DFD5BCA0C187B656EBD41628F6B26A406C2874E659D371258CA60365F644C5A0220239CA0E0E482BD9B3C444EFE4618324D9217DCCBBDF70B477EEF93756A85C276042023FBAD7B932F7321F24737E553BE536534D3B0ADF0D77DC631E50D90AD872A07040CD2F70E71D686471CF0F0CD49
+
+Msg = 79657420616E6F74686572207465737420696E70757420666F7220796F75
+Nonce = 218F4211FB45868ADD749992E8C899B28DEF9AFEAE49B19BE0657A481D06D36B
+Ciphertext = 30818602206838137EABA46E36D2E89556A623EB6C790635138CF7DC50B0B4932C5CBFA892022051532CB347883709856962B2762B047B6EA4597C957016AB1F24D4DCD55148340420DD1DC1C83FBFA04B831B61D39BA2F3B60C9443DCC82E172913F598A7357DCA53041E394D660717179357030E5282DD4E7DCE144D6C168ED42A1AD093E406AC0D