From 89e1c718af537ca504dac681f7a388202bc60cdc Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Fri, 5 Oct 2018 12:33:19 -0400 Subject: Add more SM2 signature tests Using the standard SM2 and P-256 curves, instead of the SM2 test curve, for both SM3 and SHA-256 hashes. All values generated with GmSSL --- src/tests/data/pubkey/sm2_sig.vec | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'src/tests') diff --git a/src/tests/data/pubkey/sm2_sig.vec b/src/tests/data/pubkey/sm2_sig.vec index b2e588128..b2d6f2480 100644 --- a/src/tests/data/pubkey/sm2_sig.vec +++ b/src/tests/data/pubkey/sm2_sig.vec @@ -22,3 +22,59 @@ Msg = B524F552CD82B8B028476E005C377FB19A87E6FC682D48BB5D42E3D9B9EFFE76 x = 0x128B2FA8BD433C6C068C8D803DFF79792A519A55171B1B650C23661D15897263 Nonce = 6CB28D99385C175C94F94E934817663FC176D925DD72B727260DBAAE1FB2F96F Signature = 40F1EC59F793D9F49E09DCEF49130D4194F79FB1EED2CAA55BACDB49C4E755D16FC6DAC32C5D5CF10C77DFB20F7C2EB667A457872FB09EC56327A67EC7DEEBE7 + +# Same test as above but using SHA-256. Generated with GmSSL +Hash = SHA-256 +Ident = ALICE123@YAHOO.COM +Msg = 6D65737361676520646967657374 +x = 0x128B2FA8BD433C6C068C8D803DFF79792A519A55171B1B650C23661D15897263 +Nonce = 6CB28D99385C175C94F94E934817663FC176D925DD72B727260DBAAE1FB2F96F +Signature = 7D62A5EDBDDC8AF4D69C9E37A60D31F5CEFE8727709117E0869648D0A9AE4F571E5E89718B716AAFC6253443168E4F7CF7E1B7B3934307686CE5947C1BD55EDA + +# Using SM2 standard curve. Generated with GmSSL + +P = 0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF +A = 0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC +B = 0x28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93 +xG = 0x32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7 +yG = 0xBC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0 +Order = 0xFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123 +Cofactor = 1 + +Hash = SM3 +Ident = sm2test@example.com +Msg = 686920636861707079 +x = 0x110E7973206F68C19EE5F7328C036F26911C8C73B4E4F36AE3291097F8984FFC +Nonce = 3174C6FFC3C279D2422F3FC0A9F3E574674A4490FE45A5325CAF7D3EC4C8F96C +Signature = 05890B9077B92E47B17A1FF42A814280E556AFD92B4A98B9670BF8B1A274C2FAE3ABBB8DB2B6ECD9B24ECCEA7F679FB9A4B1DB52F4AA985E443AD73237FA1993 + +Hash = SHA-256 +Ident = sm2test@example.com +Msg = 686920636861707079 +x = 0x110E7973206F68C19EE5F7328C036F26911C8C73B4E4F36AE3291097F8984FFC +Nonce = 3174C6FFC3C279D2422F3FC0A9F3E574674A4490FE45A5325CAF7D3EC4C8F96C +Signature = 94DA20EA69E4FC70692158BF3D30F87682A4B2F84DF4A4829A1EFC5D9C979D3FEE15AF8D455B728AB80E592FCB654BF5B05620B2F4D25749D263D5C01FAD365F + +# Using P-256 curve. Generated with GmSSL + +P = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF +A = 0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC +B = 0x5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B +xG = 0x6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296 +yG = 0x4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5 +Order = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551 +Cofactor = 1 + +Hash = SM3 +Ident = sm2_p256_test@example.com +Msg = 6E6F206261636B646F6F72732068657265 +x = 0x110E7973206F68C19EE5F7328C036F26911C8C73B4E4F36AE3291097F8984FFC +Nonce = 3174C6FFC3C279D2422F3FC0A9F3E574674A4490FE45A5325CAF7D3EC4C8F96C +Signature = 96AA39A0C4A5C454653F394E86386F2E38BE14C57D0E555F3A27A5CEF30E51BD62372BE4AC97DBE725AC0B279BB8FD15883858D814FD792DDB0A401DCC988E70 + +Hash = SHA-256 +Ident = sm2_p256_test@example.com +Msg = 6E6F206261636B646F6F72732068657265 +x = 0x110E7973206F68C19EE5F7328C036F26911C8C73B4E4F36AE3291097F8984FFC +Nonce = 3174C6FFC3C279D2422F3FC0A9F3E574674A4490FE45A5325CAF7D3EC4C8F96C +Signature = 503D234A22123D7029271EB9E0D763619A69868DE8296C13EDD4CA32D280CFDE0BDE97699B77268584DDD238DA120095F01130AD2DB37184270F37C02FB2E86B -- cgit v1.2.3