This repository has been archived by the owner on May 5, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
implicit.txt
227 lines (189 loc) · 11.7 KB
/
implicit.txt
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
Test vectors for Implicit Certificate Generation and Public/Private Keys Reconstruction
=======================================================================================
As per SEC4
Certificate Generation Inputs:
- tbsCert: {octet string} To-be-signed user's certificate data
- RU: {ec256 point} User's certificate request public key
- dCA: {octet string} CA's private key
[- k: {octet string} CA's ephemeral key, should be randomly generated by the CA
but can be input to this function for test purposes]
Certificate Generation Outputs:
- PU: {ec256 point} User's public key reconstruction point
- CertU: {octet string} tbsCert || PU
In this script, to illustrate the concept, PU is concatenated with tbsCert;
i.e., H(CertU) = H(tbsCert || PU) is just for illustration purposes
Important Note:
- In 1609.2 v3 d9 Sec.6.4.3,
H(CertU) = H (H (ToBeSignedCertificate) || H (Entirety of issuer cert) )
- r: {octet string} private key reconstruction value
[- k: {octet string} CA's ephemeral key, should be kept secret
but is output from this function for test purposes]
------------
Private Key Reconstruction Inputs:
- kU: {octet string} User's certificate request private key, corresponding to RU
- CertU: {octet string} tbsCert || PU (see note above)
- r: {octet string} private key reconstruction value
Private Key Reconstruction Output:
- dU: {octet string} User's (reconstructed) private key
------------
Public Key Reconstruction Inputs:
- CertU: {octet string} tbsCert || PU (see note above)
- QCA: {ec256 point} CA's public key
Public Key Reconstruction Outputs:
- QU: {ec256_point} User's (reconstructed) public key
Test Vector #1:
===============
tbsCert is the bytes of the string "This is a test!":
tbsCert = 0x54686973206973206120746573742100
tbsCert[16] =
{ 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x21, 0x00 }
User's certificate request private key:
kU = 0x1384C31D6982D52BCA3BED8A7E60F52FECDAB44E5C0EA166815A8159E09FFB42
kU[32] =
{ 0x13, 0x84, 0xC3, 0x1D, 0x69, 0x82, 0xD5, 0x2B, 0xCA, 0x3B, 0xED, 0x8A, 0x7E, 0x60, 0xF5, 0x2F,
0xEC, 0xDA, 0xB4, 0x4E, 0x5C, 0x0E, 0xA1, 0x66, 0x81, 0x5A, 0x81, 0x59, 0xE0, 0x9F, 0xFB, 0x42 }
User's certificate request public key (x-coordinate):
RUx = 0xF45A99137B1BB2C150D6D8CF7292CA07DA68C003DAA766A9AF7F67F5EE916828
RUx[32] =
{ 0xF4, 0x5A, 0x99, 0x13, 0x7B, 0x1B, 0xB2, 0xC1, 0x50, 0xD6, 0xD8, 0xCF, 0x72, 0x92, 0xCA, 0x07,
0xDA, 0x68, 0xC0, 0x03, 0xDA, 0xA7, 0x66, 0xA9, 0xAF, 0x7F, 0x67, 0xF5, 0xEE, 0x91, 0x68, 0x28 }
User's certificate request public key (y-coordinate):
RUy = 0xF6A25216F44CB64A96C229AE00B479857B3B81C1319FB2ADF0E8DB2681769729
RUy[32] =
{ 0xF6, 0xA2, 0x52, 0x16, 0xF4, 0x4C, 0xB6, 0x4A, 0x96, 0xC2, 0x29, 0xAE, 0x00, 0xB4, 0x79, 0x85,
0x7B, 0x3B, 0x81, 0xC1, 0x31, 0x9F, 0xB2, 0xAD, 0xF0, 0xE8, 0xDB, 0x26, 0x81, 0x76, 0x97, 0x29 }
CA's private key:
dCA = 0x97D1368E8C07A54F66C9DCE284BA76CAF4178206614F809A4EB43CB3106AA60E
dCA[32] =
{ 0x97, 0xD1, 0x36, 0x8E, 0x8C, 0x07, 0xA5, 0x4F, 0x66, 0xC9, 0xDC, 0xE2, 0x84, 0xBA, 0x76, 0xCA,
0xF4, 0x17, 0x82, 0x06, 0x61, 0x4F, 0x80, 0x9A, 0x4E, 0xB4, 0x3C, 0xB3, 0x10, 0x6A, 0xA6, 0x0E }
CA's public key (x-coordinate):
QCAx = 0x3BB8FFD19B25EE1BB939CD4935FBFA8FBAADBA64843338A95595A70ED7479B70
QCAx[32] =
{ 0x3B, 0xB8, 0xFF, 0xD1, 0x9B, 0x25, 0xEE, 0x1B, 0xB9, 0x39, 0xCD, 0x49, 0x35, 0xFB, 0xFA, 0x8F,
0xBA, 0xAD, 0xBA, 0x64, 0x84, 0x33, 0x38, 0xA9, 0x55, 0x95, 0xA7, 0x0E, 0xD7, 0x47, 0x9B, 0x70 }
CA's public key (y-coordinate):
QCAy = 0xEB60DDC790E3CB05E85225F636D8A7C20DF3A8135C4B2AE5396367B4E86077F8
QCAy[32] =
{ 0xEB, 0x60, 0xDD, 0xC7, 0x90, 0xE3, 0xCB, 0x05, 0xE8, 0x52, 0x25, 0xF6, 0x36, 0xD8, 0xA7, 0xC2,
0x0D, 0xF3, 0xA8, 0x13, 0x5C, 0x4B, 0x2A, 0xE5, 0x39, 0x63, 0x67, 0xB4, 0xE8, 0x60, 0x77, 0xF8 }
CA's ephemeral private key (should be chosen at random by CA for every cert request):
k = 0xE2F9CBCEC3F28F7DFBEF044732C41119816C62909FB720B091FB8F380F1B70DC
k[32] =
{ 0xE2, 0xF9, 0xCB, 0xCE, 0xC3, 0xF2, 0x8F, 0x7D, 0xFB, 0xEF, 0x04, 0x47, 0x32, 0xC4, 0x11, 0x19,
0x81, 0x6C, 0x62, 0x90, 0x9F, 0xB7, 0x20, 0xB0, 0x91, 0xFB, 0x8F, 0x38, 0x0F, 0x1B, 0x70, 0xDC }
User's public key reconstruction point (x-coordinate):
PUx = 0x4A1890E30A584208DAD3838D0C5CECB1ED6B01D48893C684C59908F5B38E3D82
PUx[32] =
{ 0x4A, 0x18, 0x90, 0xE3, 0x0A, 0x58, 0x42, 0x08, 0xDA, 0xD3, 0x83, 0x8D, 0x0C, 0x5C, 0xEC, 0xB1,
0xED, 0x6B, 0x01, 0xD4, 0x88, 0x93, 0xC6, 0x84, 0xC5, 0x99, 0x08, 0xF5, 0xB3, 0x8E, 0x3D, 0x82 }
User's public key reconstruction point (y-coordinate):
PUy = 0xBAE8FB2EF2DC080F248F44FCEC458B1B35ECDC80F00C959292CBE21BE2FF2EA2
PUy[32] =
{ 0xBA, 0xE8, 0xFB, 0x2E, 0xF2, 0xDC, 0x08, 0x0F, 0x24, 0x8F, 0x44, 0xFC, 0xEC, 0x45, 0x8B, 0x1B,
0x35, 0xEC, 0xDC, 0x80, 0xF0, 0x0C, 0x95, 0x92, 0x92, 0xCB, 0xE2, 0x1B, 0xE2, 0xFF, 0x2E, 0xA2 }
User's CertU (encoded in this way for illustration purpose and testing only):
CertU = 0x54686973206973206120746573742100024a1890e30a584208dad3838d0c5cecb1ed6b01d48893c684c59908f5b38e3d82
CertU[49] =
{ 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x21, 0x00,
0x02, 0x4A, 0x18, 0x90, 0xE3, 0x0A, 0x58, 0x42, 0x08, 0xDA, 0xD3, 0x83, 0x8D, 0x0C, 0x5C, 0xEC,
0xB1, 0xED, 0x6B, 0x01, 0xD4, 0x88, 0x93, 0xC6, 0x84, 0xC5, 0x99, 0x08, 0xF5, 0xB3, 0x8E, 0x3D,
0x82 }
User's private key reconstruction value:
r = 0x1FA86893A1AABE8A79F63360F4B6D5617380B4D84B8C260DD8D3D64163C874FD
r[32] =
{ 0x1F, 0xA8, 0x68, 0x93, 0xA1, 0xAA, 0xBE, 0x8A, 0x79, 0xF6, 0x33, 0x60, 0xF4, 0xB6, 0xD5, 0x61,
0x73, 0x80, 0xB4, 0xD8, 0x4B, 0x8C, 0x26, 0x0D, 0xD8, 0xD3, 0xD6, 0x41, 0x63, 0xC8, 0x74, 0xFD }
User's reconstructed private key:
dU = 0xC8599ECA52B58D691B2BB609CDB53DDD9F49C0D635AB652EC79C546914590274
dU[32] =
{ 0xC8, 0x59, 0x9E, 0xCA, 0x52, 0xB5, 0x8D, 0x69, 0x1B, 0x2B, 0xB6, 0x09, 0xCD, 0xB5, 0x3D, 0xDD,
0x9F, 0x49, 0xC0, 0xD6, 0x35, 0xAB, 0x65, 0x2E, 0xC7, 0x9C, 0x54, 0x69, 0x14, 0x59, 0x02, 0x74 }
User's reconstructed public key (x-coordinate):
QUx = 0x6E89D7C0F910AAA4AD3137EBE01EF781C0BAB6748318D66FE714471F7F860EB2
QUx[32] =
{ 0x6E, 0x89, 0xD7, 0xC0, 0xF9, 0x10, 0xAA, 0xA4, 0xAD, 0x31, 0x37, 0xEB, 0xE0, 0x1E, 0xF7, 0x81,
0xC0, 0xBA, 0xB6, 0x74, 0x83, 0x18, 0xD6, 0x6F, 0xE7, 0x14, 0x47, 0x1F, 0x7F, 0x86, 0x0E, 0xB2 }
User's reconstructed public key (y-coordinate):
QUy = 0x1EFE06E2ACC3A2343D2E4445F2083BFA4379672DFBFE0B2575002082407FFDDC
QUy[32] =
{ 0x1E, 0xFE, 0x06, 0xE2, 0xAC, 0xC3, 0xA2, 0x34, 0x3D, 0x2E, 0x44, 0x45, 0xF2, 0x08, 0x3B, 0xFA,
0x43, 0x79, 0x67, 0x2D, 0xFB, 0xFE, 0x0B, 0x25, 0x75, 0x00, 0x20, 0x82, 0x40, 0x7F, 0xFD, 0xDC }
Test Vector #2:
===============
tbsCert is the bytes of the string "This is a test!":
tbsCert = 0x54686973206973206120746573742100
tbsCert[16] =
{ 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x21, 0x00 }
User's certificate request private key:
kU = 0x1384C31D6982D52BCA3BED8A7E60F52FECDAB44E5C0EA166815A8159E09FFB42
kU[32] =
{ 0x13, 0x84, 0xC3, 0x1D, 0x69, 0x82, 0xD5, 0x2B, 0xCA, 0x3B, 0xED, 0x8A, 0x7E, 0x60, 0xF5, 0x2F,
0xEC, 0xDA, 0xB4, 0x4E, 0x5C, 0x0E, 0xA1, 0x66, 0x81, 0x5A, 0x81, 0x59, 0xE0, 0x9F, 0xFB, 0x42 }
User's certificate request public key (x-coordinate):
RUx = 0xF45A99137B1BB2C150D6D8CF7292CA07DA68C003DAA766A9AF7F67F5EE916828
RUx[32] =
{ 0xF4, 0x5A, 0x99, 0x13, 0x7B, 0x1B, 0xB2, 0xC1, 0x50, 0xD6, 0xD8, 0xCF, 0x72, 0x92, 0xCA, 0x07,
0xDA, 0x68, 0xC0, 0x03, 0xDA, 0xA7, 0x66, 0xA9, 0xAF, 0x7F, 0x67, 0xF5, 0xEE, 0x91, 0x68, 0x28 }
User's certificate request public key (y-coordinate):
RUy = 0xF6A25216F44CB64A96C229AE00B479857B3B81C1319FB2ADF0E8DB2681769729
RUy[32] =
{ 0xF6, 0xA2, 0x52, 0x16, 0xF4, 0x4C, 0xB6, 0x4A, 0x96, 0xC2, 0x29, 0xAE, 0x00, 0xB4, 0x79, 0x85,
0x7B, 0x3B, 0x81, 0xC1, 0x31, 0x9F, 0xB2, 0xAD, 0xF0, 0xE8, 0xDB, 0x26, 0x81, 0x76, 0x97, 0x29 }
CA's private key:
dCA = 0x97D1368E8C07A54F66C9DCE284BA76CAF4178206614F809A4EB43CB3106AA60E
dCA[32] =
{ 0x97, 0xD1, 0x36, 0x8E, 0x8C, 0x07, 0xA5, 0x4F, 0x66, 0xC9, 0xDC, 0xE2, 0x84, 0xBA, 0x76, 0xCA,
0xF4, 0x17, 0x82, 0x06, 0x61, 0x4F, 0x80, 0x9A, 0x4E, 0xB4, 0x3C, 0xB3, 0x10, 0x6A, 0xA6, 0x0E }
CA's public key (x-coordinate):
QCAx = 0x3BB8FFD19B25EE1BB939CD4935FBFA8FBAADBA64843338A95595A70ED7479B70
QCAx[32] =
{ 0x3B, 0xB8, 0xFF, 0xD1, 0x9B, 0x25, 0xEE, 0x1B, 0xB9, 0x39, 0xCD, 0x49, 0x35, 0xFB, 0xFA, 0x8F,
0xBA, 0xAD, 0xBA, 0x64, 0x84, 0x33, 0x38, 0xA9, 0x55, 0x95, 0xA7, 0x0E, 0xD7, 0x47, 0x9B, 0x70 }
CA's public key (y-coordinate):
QCAy = 0xEB60DDC790E3CB05E85225F636D8A7C20DF3A8135C4B2AE5396367B4E86077F8
QCAy[32] =
{ 0xEB, 0x60, 0xDD, 0xC7, 0x90, 0xE3, 0xCB, 0x05, 0xE8, 0x52, 0x25, 0xF6, 0x36, 0xD8, 0xA7, 0xC2,
0x0D, 0xF3, 0xA8, 0x13, 0x5C, 0x4B, 0x2A, 0xE5, 0x39, 0x63, 0x67, 0xB4, 0xE8, 0x60, 0x77, 0xF8 }
CA's ephemeral private key (should be chosen at random by CA for every cert request):
k = 0x3396DA2ECBFC6E5F231E2C80EB27AB84F09DD5E724F8652ADE86E60BC800EAD7
k[32] =
{ 0x33, 0x96, 0xDA, 0x2E, 0xCB, 0xFC, 0x6E, 0x5F, 0x23, 0x1E, 0x2C, 0x80, 0xEB, 0x27, 0xAB, 0x84,
0xF0, 0x9D, 0xD5, 0xE7, 0x24, 0xF8, 0x65, 0x2A, 0xDE, 0x86, 0xE6, 0x0B, 0xC8, 0x00, 0xEA, 0xD7 }
User's public key reconstruction point (x-coordinate):
PUx = 0x6694D1F99A18CBE8035E053B2E56C12EECB94E9D5DBA88E07E5B50CBE309103E
PUx[32] =
{ 0x66, 0x94, 0xD1, 0xF9, 0x9A, 0x18, 0xCB, 0xE8, 0x03, 0x5E, 0x05, 0x3B, 0x2E, 0x56, 0xC1, 0x2E,
0xEC, 0xB9, 0x4E, 0x9D, 0x5D, 0xBA, 0x88, 0xE0, 0x7E, 0x5B, 0x50, 0xCB, 0xE3, 0x09, 0x10, 0x3E }
User's public key reconstruction point (y-coordinate):
PUy = 0x74A698788B8F35B3A86E553228D592FCB7C85611637690A85EEACA02EB178887
PUy[32] =
{ 0x74, 0xA6, 0x98, 0x78, 0x8B, 0x8F, 0x35, 0xB3, 0xA8, 0x6E, 0x55, 0x32, 0x28, 0xD5, 0x92, 0xFC,
0xB7, 0xC8, 0x56, 0x11, 0x63, 0x76, 0x90, 0xA8, 0x5E, 0xEA, 0xCA, 0x02, 0xEB, 0x17, 0x88, 0x87 }
User's CertU (encoded in this way for illustration purpose and testing only):
CertU = 0x54686973206973206120746573742100036694d1f99a18cbe8035e053b2e56c12eecb94e9d5dba88e07e5b50cbe309103e
CertU[49] =
{ 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x21, 0x00,
0x03, 0x66, 0x94, 0xD1, 0xF9, 0x9A, 0x18, 0xCB, 0xE8, 0x03, 0x5E, 0x05, 0x3B, 0x2E, 0x56, 0xC1,
0x2E, 0xEC, 0xB9, 0x4E, 0x9D, 0x5D, 0xBA, 0x88, 0xE0, 0x7E, 0x5B, 0x50, 0xCB, 0xE3, 0x09, 0x10,
0x3E }
User's private key reconstruction value:
r = 0x001CF7456A157A90FCEA0634699E7A3644FEBFB86C119E6A9686928B8E3F7EF0
r[32] =
{ 0x00, 0x1C, 0xF7, 0x45, 0x6A, 0x15, 0x7A, 0x90, 0xFC, 0xEA, 0x06, 0x34, 0x69, 0x9E, 0x7A, 0x36,
0x44, 0xFE, 0xBF, 0xB8, 0x6C, 0x11, 0x9E, 0x6A, 0x96, 0x86, 0x92, 0x8B, 0x8E, 0x3F, 0x7E, 0xF0 }
User's reconstructed private key:
dU = 0xC9CCC8E83AB985C436A8BC09C0CAA8A5AC627DD7BC9336A5E8AB81B77D3A031D
dU[32] =
{ 0xC9, 0xCC, 0xC8, 0xE8, 0x3A, 0xB9, 0x85, 0xC4, 0x36, 0xA8, 0xBC, 0x09, 0xC0, 0xCA, 0xA8, 0xA5,
0xAC, 0x62, 0x7D, 0xD7, 0xBC, 0x93, 0x36, 0xA5, 0xE8, 0xAB, 0x81, 0xB7, 0x7D, 0x3A, 0x03, 0x1D }
User's reconstructed public key (x-coordinate):
QUx = 0x8ED40E9601BEEB146A4A0AB96D20EE0FE4CA1E389397F2B1CC67AD9F5B0F579E
QUx[32] =
{ 0x8E, 0xD4, 0x0E, 0x96, 0x01, 0xBE, 0xEB, 0x14, 0x6A, 0x4A, 0x0A, 0xB9, 0x6D, 0x20, 0xEE, 0x0F,
0xE4, 0xCA, 0x1E, 0x38, 0x93, 0x97, 0xF2, 0xB1, 0xCC, 0x67, 0xAD, 0x9F, 0x5B, 0x0F, 0x57, 0x9E }
User's reconstructed public key (y-coordinate):
QUy = 0x73E589E8A9A135306F4AA324F17B66906153BD333961F9BE530F20EB8D3339C7
QUy[32] =
{ 0x73, 0xE5, 0x89, 0xE8, 0xA9, 0xA1, 0x35, 0x30, 0x6F, 0x4A, 0xA3, 0x24, 0xF1, 0x7B, 0x66, 0x90,
0x61, 0x53, 0xBD, 0x33, 0x39, 0x61, 0xF9, 0xBE, 0x53, 0x0F, 0x20, 0xEB, 0x8D, 0x33, 0x39, 0xC7 }