-
Notifications
You must be signed in to change notification settings - Fork 25
/
sm9-sign
118 lines (102 loc) · 6.55 KB
/
sm9-sign
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
*********************** SM9 key Generation ***************************
*********************The signed key = (xdA, ydA):*********************
A5702F05CF1315305E2D6EB64B0DEB923DB1A0BCF0CAFF90523AC8754AA69820
78559A844411F9825C109F5EE3F52D720DD01785392A727BB1556952B2B013D3
**********************PublicKey Ppubs=[ks]P2:*************************
9F64080B3084F733E48AFF4B41B565011CE0711C5E392CFB0AB1B6791B94C408
29DBA116152D1F786CE843ED24A3B573414D2177386A92DD8F14D65696EA5E32
69850938ABEA0112B57329F447E3A0CBAD3E2FDB1A77F335E89E1408D0EF1C25
41E00A53DDA532DA1A7CE027B7A46F741006E85F5CDFF0730E75C05FB4E3216D
********************** SM9 signature algorithm***************************
***********************g=e(P1,Ppubs):****************************
4E378FB5561CD0668F906B731AC58FEE25738EDF09CADC7A29C0ABC0177AEA6D
28B3404A61908F5D6198815C99AF1990C8AF38655930058C28C21BB539CE0000
38BFFE40A22D529A0C66124B2C308DAC9229912656F62B4FACFCED408E02380F
A01F2C8BEE81769609462C69C96AA923FD863E209D3CE26DD889B55E2E3873DB
67E0E0C2EED7A6993DCE28FE9AA2EF56834307860839677F96685F2B44D0911F
5A1AE172102EFD95DF7338DBC577C66D8D6C15E0A0158C7507228EFB078F42A6
1604A3FCFA9783E667CE9FCB1062C2A5C6685C316DDA62DE0548BAA6BA30038B
93634F44FA13AF76169F3CC8FBEA880ADAFF8475D5FD28A75DEB83C44362B439
B3129A75D31D17194675A1BC56947920898FBF390A5BF5D931CE6CBB3340F66D
4C744E69C4A2E1C8ED72F796D151A17CE2325B943260FC460B9F73CB57C9014B
84B87422330D7936EABA1109FA5A7A7181EE16F2438B0AEB2F38FD5F7554E57A
AAB9F06A4EEBA4323A7833DB202E4E35639D93FA3305AF73F0F071D7D284FCFB
***********************randnum r:********************************
33C8616B06704813203DFD00965022ED15975C662337AED648835DC4B1CBE
***************************w=gr:**********************************
81377B8FDBC2839B4FA2D0E0F8AA6853BBBE9E9C4099608F8612C6078ACD7563
815AEBA217AD502DA0F48704CC73CABB3C06209BD87142E14CBD99E8BCA1680F
30DADC5CD9E207AEE32209F6C3CA3EC0D800A1A42D33C73153DED47C70A39D2E
8EAF5D179A1836B359A9D1D9BFC19F2EFCDB829328620962BD3FDF15F2567F58
A543D25609AE943920679194ED30328BB33FD15660BDE485C6B79A7B32B01398
3F012DB04BA59FE88DB889321CC2373D4C0C35E84F7AB1FF33679BCA575D6765
4F8624EB435B838CCA77B2D0347E65D5E46964412A096F4150D8C5EDE5440DDF
656FCB663D24731E80292188A2471B8B68AA993899268499D23C89755A1A897
44643CEAD40F0965F28E1CD2895C3D118E4F65C9A0E3E741B6DD52C0EE2D25F5
898D60848026B7EFB8FCC1B2442ECF0795F8A81CEE99A6248F294C82C90D26BD
6A814AAF475F128AEF43A128E37F80154AE6CB92CAD7D1501BAE30F750B3A9BD
1F96B08E97997363911314705BFB9A9DBB97F75553EC90FBB2DDAE53C8F68E42
****************************h:*************************************
823C4B21E4BD2DFE1ED92C606653E996668563152FC33F55D7BFBB9BD9705ADB
**************************l=(r-h)mod N:****************************
3406F1643496DFF8385C82CF5F4442B0123E89ABAF898013FB13AE36D9799108
**************************S=[l]dSA=(xS,yS):*************************
73BF96923CE58B6AD0E13E9643A406D8EB98417C50EF1B29CEF9ADB48B6D598C
856712F1C2E0968AB7769F42A99586AED139D5B8B3E15891827CC2ACED9BAA05
******************* SM9 verification algorithm *************************
***********************g=e(P1,Ppubs):****************************
4E378FB5561CD0668F906B731AC58FEE25738EDF09CADC7A29C0ABC0177AEA6D
28B3404A61908F5D6198815C99AF1990C8AF38655930058C28C21BB539CE0000
38BFFE40A22D529A0C66124B2C308DAC9229912656F62B4FACFCED408E02380F
A01F2C8BEE81769609462C69C96AA923FD863E209D3CE26DD889B55E2E3873DB
67E0E0C2EED7A6993DCE28FE9AA2EF56834307860839677F96685F2B44D0911F
5A1AE172102EFD95DF7338DBC577C66D8D6C15E0A0158C7507228EFB078F42A6
1604A3FCFA9783E667CE9FCB1062C2A5C6685C316DDA62DE0548BAA6BA30038B
93634F44FA13AF76169F3CC8FBEA880ADAFF8475D5FD28A75DEB83C44362B439
B3129A75D31D17194675A1BC56947920898FBF390A5BF5D931CE6CBB3340F66D
4C744E69C4A2E1C8ED72F796D151A17CE2325B943260FC460B9F73CB57C9014B
84B87422330D7936EABA1109FA5A7A7181EE16F2438B0AEB2F38FD5F7554E57A
AAB9F06A4EEBA4323A7833DB202E4E35639D93FA3305AF73F0F071D7D284FCFB
***************************w=gh:**********************************
B59486D6F3AE4649ADF387C5A22790E42B98051A339B3403B17B1F2B38259EFE
1632C30AA86001F52EEFED517AA672D70F03AF3EE9197017EDA431436CFBDACE
2F635B5B0243F6F4876A1D9149EAFAB71060EA4352DE6D4A83B5F8F3DF73EFF0
3A27F33E024339B83F16E58AE524A5FAA3E7FD009568A9FF23752BC8DD85B704
8208E26734BC66731AEE530692B3AE277EA70D6BBAF8F485295D067E67B3B4F
1DBDDD78126E962E950CEBB385C3F7A3E0A5597F9C3B9FB3F5DAC3DAA85FD016
189E64A3C0A0D87611A83AEC8F3A3688C0ABF2F64860CF331463ACB3A4AABB04
6E3FA26F762D1A2371601BE00DA702B1A726273CE843D991CE5C2EABAB2EAC6F
A5BCFFD540EE56B5A26CCDA566FD8ABC3615CB7DEA8F240E0BF4615816C2B23E
A074A0AA62A26C283F11543CECDEA5242113FE2E982CCBDA2D495EF6C05550A6
2E3F160C96C160595A1034B5156920668A7BEE5E82E0B8BE06963FDDBDEB5AAE
DCF9EA28617B5965313B917D556DA0D3A557C4112CE1C4A06B327D7DC18273D
****************************h1:**********************************
2ACC468C3926B0BDB2767E99FF26E084DE9CED8DBC7D5FBF418027B667862FAB
************************** u=e(S1,P):*****************************
A97A171304A0316FC8BA21B911289C4371E73B7D2163AC5B44F3B52588EB69A1
1838972BF0CA86E17147468A869A3261FCC27993AA50E36727918ED5ABD71C0C
291663C49DF9B4A82B122412B749BF144341F2E22564506145E0B77173496F50
ABB3B115E006FAE8EC3CB133F411DF05B32CFA157716082DEEDF7BDB188966DF
5FCC7DBDFC714FC8989E0331838142275EAE6B6309BAD1DEFE28263AD66E6780
48697F5C62EE4342325A9EF03775A52F1C0B9D5FB08D99E8D65A436B8A9AF05E
5C53DC7E4D8A0B7557920B21FA5F2E75B38C4445F0CF9153AC4127240530F5D5
1BBD7B34565F80CCB4528093CE9FAFDF6AD84FD620F3B5BC324DA19BB665151
4AE8D62318D2BA35F9494189100BCD82F1B1399B0B14867700D3D7A243D02D3A
701409A66ED452DEC4586735CF3631379501DC756466F6F18E3BC002722531AE
7B9A10CEB34F11956A04E3064663D87B844B452C3D81C91A8223938D1A9ABBC4
753A274B8E9E35AF503B7C2E39ABB32BC8674FC8EC012D8BEBDFFF2FE0985F85
************************* w=u*t: **********************************
81377B8FDBC2839B4FA2D0E0F8AA6853BBBE9E9C4099608F8612C6078ACD7563
815AEBA217AD502DA0F48704CC73CABB3C06209BD87142E14CBD99E8BCA1680F
30DADC5CD9E207AEE32209F6C3CA3EC0D800A1A42D33C73153DED47C70A39D2E
8EAF5D179A1836B359A9D1D9BFC19F2EFCDB829328620962BD3FDF15F2567F58
A543D25609AE943920679194ED30328BB33FD15660BDE485C6B79A7B32B01398
3F012DB04BA59FE88DB889321CC2373D4C0C35E84F7AB1FF33679BCA575D6765
4F8624EB435B838CCA77B2D0347E65D5E46964412A096F4150D8C5EDE5440DDF
656FCB663D24731E80292188A2471B8B68AA993899268499D23C89755A1A897
44643CEAD40F0965F28E1CD2895C3D118E4F65C9A0E3E741B6DD52C0EE2D25F5
898D60848026B7EFB8FCC1B2442ECF0795F8A81CEE99A6248F294C82C90D26BD
6A814AAF475F128AEF43A128E37F80154AE6CB92CAD7D1501BAE30F750B3A9BD
1F96B08E97997363911314705BFB9A9DBB97F75553EC90FBB2DDAE53C8F68E42
**************************** h2:***********************************
823C4B21E4BD2DFE1ED92C606653E996668563152FC33F55D7BFBB9BD9705ADB