@@ -286,6 +286,7 @@ func TestSignedCorim_FromCOSE_fail_corim_bad_cbor(t *testing.T) {
286286 / protected / << {
287287 / alg / 1: -7, / ECDSA 256 /
288288 / content-type / 3: "application/rim+cbor",
289+ / kid / 4: h'1',
289290 / corim-meta / 8: h'a200a1006941434d45204c74642e01a101c11a5fad2056'
290291 } >>,
291292 / unprotected / {},
@@ -295,12 +296,12 @@ func TestSignedCorim_FromCOSE_fail_corim_bad_cbor(t *testing.T) {
295296 )
296297 */
297298 tv := []byte {
298- 0xd2 , 0x84 , 0x58 , 0x32 , 0xa3 , 0x01 , 0x26 , 0x03 , 0x74 , 0x61 , 0x70 , 0x70 ,
299+ 0xd2 , 0x84 , 0x58 , 0x35 , 0xa4 , 0x01 , 0x26 , 0x03 , 0x74 , 0x61 , 0x70 , 0x70 ,
299300 0x6c , 0x69 , 0x63 , 0x61 , 0x74 , 0x69 , 0x6f , 0x6e , 0x2f , 0x72 , 0x69 , 0x6d ,
300- 0x2b , 0x63 , 0x62 , 0x6f , 0x72 , 0x08 , 0x57 , 0xa2 , 0x00 , 0xa1 , 0x00 , 0x69 ,
301- 0x41 , 0x43 , 0x4d , 0x45 , 0x20 , 0x4c , 0x74 , 0x64 , 0x2e , 0x01 , 0xa1 , 0x01 ,
302- 0xc1 , 0x1a , 0x5f , 0xad , 0x20 , 0x56 , 0xa0 , 0x44 , 0xba , 0xdc , 0xb0 , 0x30 ,
303- 0x44 , 0xde , 0xad , 0xbe , 0xef ,
301+ 0x2b , 0x63 , 0x62 , 0x6f , 0x72 , 0x04 , 0x41 , 0x31 , 0x08 , 0x57 , 0xa2 , 0x00 ,
302+ 0xa1 , 0x00 , 0x69 , 0x41 , 0x43 , 0x4d , 0x45 , 0x20 , 0x4c , 0x74 , 0x64 , 0x2e ,
303+ 0x01 , 0xa1 , 0x01 , 0xc1 , 0x1a , 0x5f , 0xad , 0x20 , 0x56 , 0xa0 , 0x44 , 0xba ,
304+ 0xdc , 0xb0 , 0x30 , 0x44 , 0xde , 0xad , 0xbe , 0xef ,
304305 }
305306
306307 var actual SignedCorim
@@ -316,6 +317,7 @@ func TestSignedCorim_FromCOSE_fail_invalid_corim(t *testing.T) {
316317 / protected / << {
317318 / alg / 1: -7, / ECDSA 256 /
318319 / content-type / 3: "application/rim+cbor",
320+ / kid / 4: h'1',
319321 / corim-meta / 8: h'a200a1006941434d45204c74642e01a101c11a5fad2056'
320322 } >>,
321323 / unprotected / {},
@@ -327,13 +329,13 @@ func TestSignedCorim_FromCOSE_fail_invalid_corim(t *testing.T) {
327329 )
328330 */
329331 tv := []byte {
330- 0xd2 , 0x84 , 0x58 , 0x32 , 0xa3 , 0x01 , 0x26 , 0x03 , 0x74 , 0x61 , 0x70 , 0x70 ,
332+ 0xd2 , 0x84 , 0x58 , 0x35 , 0xa4 , 0x01 , 0x26 , 0x03 , 0x74 , 0x61 , 0x70 , 0x70 ,
331333 0x6c , 0x69 , 0x63 , 0x61 , 0x74 , 0x69 , 0x6f , 0x6e , 0x2f , 0x72 , 0x69 , 0x6d ,
332- 0x2b , 0x63 , 0x62 , 0x6f , 0x72 , 0x08 , 0x57 , 0xa2 , 0x00 , 0xa1 , 0x00 , 0x69 ,
333- 0x41 , 0x43 , 0x4d , 0x45 , 0x20 , 0x4c , 0x74 , 0x64 , 0x2e , 0x01 , 0xa1 , 0x01 ,
334- 0xc1 , 0x1a , 0x5f , 0xad , 0x20 , 0x56 , 0xa0 , 0x50 , 0xa1 , 0x00 , 0x6d , 0x69 ,
335- 0x6e , 0x76 , 0x61 , 0x6c , 0x69 , 0x64 , 0x20 , 0x63 , 0x6f , 0x72 , 0x69 , 0x6d ,
336- 0x44 , 0xde , 0xad , 0xbe , 0xef ,
334+ 0x2b , 0x63 , 0x62 , 0x6f , 0x72 , 0x04 , 0x41 , 0x31 , 0x08 , 0x57 , 0xa2 , 0x00 ,
335+ 0xa1 , 0x00 , 0x69 , 0x41 , 0x43 , 0x4d , 0x45 , 0x20 , 0x4c , 0x74 , 0x64 , 0x2e ,
336+ 0x01 , 0xa1 , 0x01 , 0xc1 , 0x1a , 0x5f , 0xad , 0x20 , 0x56 , 0xa0 , 0x50 , 0xa1 ,
337+ 0x00 , 0x6d , 0x69 , 0x6e , 0x76 , 0x61 , 0x6c , 0x69 , 0x64 , 0x20 , 0x63 , 0x6f ,
338+ 0x72 , 0x69 , 0x6d , 0x44 , 0xde , 0xad , 0xbe , 0xef ,
337339 }
338340
339341 var actual SignedCorim
@@ -435,13 +437,15 @@ func TestSignedCorim_SignVerify_ok(t *testing.T) {
435437 } {
436438 signer , err := NewSignerFromJWK (key )
437439 require .NoError (t , err )
440+ kid , err := getKidFromJWK (key )
441+ require .NoError (t , err )
438442
439443 var SignedCorimIn SignedCorim
440444
441445 SignedCorimIn .UnsignedCorim = * unsignedCorimFromCBOR (t , testGoodUnsignedCorimCBOR )
442446 SignedCorimIn .Meta = * metaGood (t )
443447
444- cbor , err := SignedCorimIn .Sign (signer )
448+ cbor , err := SignedCorimIn .Sign (signer , kid )
445449 assert .Nil (t , err )
446450
447451 var SignedCorimOut SignedCorim
@@ -462,12 +466,14 @@ func TestSignedCorim_SignVerify_ok(t *testing.T) {
462466func TestSignedCorim_SignVerify_fail_tampered (t * testing.T ) {
463467 signer , err := NewSignerFromJWK (testES256Key )
464468 require .NoError (t , err )
469+ kid , err := getKidFromJWK (testES256Key )
470+ require .NoError (t , err )
465471
466472 var SignedCorimIn SignedCorim
467473
468474 SignedCorimIn .UnsignedCorim = * unsignedCorimFromCBOR (t , testGoodUnsignedCorimCBOR )
469475
470- cbor , err := SignedCorimIn .Sign (signer )
476+ cbor , err := SignedCorimIn .Sign (signer , kid )
471477 assert .Nil (t , err )
472478
473479 var SignedCorimOut SignedCorim
@@ -493,6 +499,8 @@ func TestSignedCorim_SignVerify_fail_tampered(t *testing.T) {
493499func TestSignedCorim_Sign_fail_bad_corim (t * testing.T ) {
494500 signer , err := NewSignerFromJWK (testES256Key )
495501 require .NoError (t , err )
502+ kid , err := getKidFromJWK (testES256Key )
503+ require .NoError (t , err )
496504
497505 var SignedCorimIn SignedCorim
498506
@@ -501,7 +509,7 @@ func TestSignedCorim_Sign_fail_bad_corim(t *testing.T) {
501509
502510 SignedCorimIn .UnsignedCorim = * emptyCorim
503511
504- _ , err = SignedCorimIn .Sign (signer )
512+ _ , err = SignedCorimIn .Sign (signer , kid )
505513 assert .EqualError (t , err , "failed validation of unsigned CoRIM: empty id" )
506514}
507515
@@ -513,7 +521,7 @@ func TestSignedCorim_Sign_fail_no_signer(t *testing.T) {
513521
514522 SignedCorimIn .UnsignedCorim = * emptyCorim
515523
516- _ , err := SignedCorimIn .Sign (nil )
524+ _ , err := SignedCorimIn .Sign (nil , nil )
517525 assert .EqualError (t , err , "nil signer" )
518526}
519527
0 commit comments