35
35
fixedTime = time .Date (2017 , 9 , 7 , 12 , 15 , 23 , 0 , time .UTC )
36
36
fixedTimeMillis = uint64 (fixedTime .UnixNano () / nanosPerMilli )
37
37
demoLogID = [32 ]byte {19 , 56 , 222 , 93 , 229 , 36 , 102 , 128 , 227 , 214 , 3 , 121 , 93 , 175 , 126 , 236 , 97 , 217 , 34 , 32 , 40 , 233 , 98 , 27 , 46 , 179 , 164 , 251 , 84 , 10 , 60 , 57 }
38
+ fakeIndex = uint8 (8 )
39
+ fakeExtension = []byte {0 , 0 , 5 , 0 , 0 , 0 , 0 , fakeIndex }
38
40
fakeSignature = []byte ("signed" )
39
41
)
40
42
@@ -81,7 +83,6 @@ const (
81
83
// tbs certificate, 3 bytes
82
84
"746273" +
83
85
// extensions length, 2 bytes
84
- // TODO(phboneff)
85
86
"0000" +
86
87
// extensions, 0 bytes
87
88
""
@@ -259,7 +260,7 @@ func TestBuildV1MerkleTreeLeafForCert(t *testing.T) {
259
260
t .Fatalf ("buildV1MerkleTreeLeafForCert()=nil,%v; want _,nil" , err )
260
261
}
261
262
var leaf types.MerkleTreeLeaf
262
- leafValue := entry .MerkleTreeLeaf (0 )
263
+ leafValue := entry .MerkleTreeLeaf (uint64 ( fakeIndex ) )
263
264
if rest , err := tls .Unmarshal (leafValue , & leaf ); err != nil {
264
265
t .Fatalf ("failed to reconstruct MerkleTreeLeaf: %s" , err )
265
266
} else if len (rest ) > 0 {
@@ -274,8 +275,7 @@ func TestBuildV1MerkleTreeLeafForCert(t *testing.T) {
274
275
SCTVersion : 0 ,
275
276
LogID : types.LogID {KeyID : demoLogID },
276
277
Timestamp : fixedTimeMillis ,
277
- // TODO(phboneff): add extension
278
- Extensions : types.CTExtensions {},
278
+ Extensions : types .CTExtensions (fakeExtension ),
279
279
Signature : types.DigitallySigned {
280
280
Algorithm : tls.SignatureAndHashAlgorithm {
281
281
Hash : tls .SHA256 ,
@@ -323,7 +323,7 @@ func TestSignV1SCTForPrecertificate(t *testing.T) {
323
323
t .Fatalf ("buildV1MerkleTreeLeafForCert()=nil,%v; want _,nil" , err )
324
324
}
325
325
var leaf types.MerkleTreeLeaf
326
- leafValue := entry .MerkleTreeLeaf (0 )
326
+ leafValue := entry .MerkleTreeLeaf (uint64 ( fakeIndex ) )
327
327
if rest , err := tls .Unmarshal (leafValue , & leaf ); err != nil {
328
328
t .Fatalf ("failed to reconstruct MerkleTreeLeaf: %s" , err )
329
329
} else if len (rest ) > 0 {
@@ -339,8 +339,7 @@ func TestSignV1SCTForPrecertificate(t *testing.T) {
339
339
SCTVersion : 0 ,
340
340
LogID : types.LogID {KeyID : demoLogID },
341
341
Timestamp : fixedTimeMillis ,
342
- // TODO(phboneff): add extension
343
- Extensions : types.CTExtensions {},
342
+ Extensions : types .CTExtensions (fakeExtension ),
344
343
Signature : types.DigitallySigned {
345
344
Algorithm : tls.SignatureAndHashAlgorithm {
346
345
Hash : tls .SHA256 ,
0 commit comments