Skip to content

Commit 6c337fd

Browse files
committed
corim/signedcorim: check for mandatory alg and kid
1 parent e629156 commit 6c337fd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

corim/signedcorim.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ func (o *SignedCorim) processHdrs() error {
5959
return errors.New("missing mandatory protected header")
6060
}
6161

62-
v, ok := hdr.Protected[cose.HeaderLabelContentType]
62+
v, ok := hdr.Protected[cose.HeaderLabelAlgorithm]
63+
if !ok {
64+
return errors.New("missing mandatory algorithm")
65+
}
66+
67+
v, ok = hdr.Protected[cose.HeaderLabelContentType]
6368
if !ok {
6469
return errors.New("missing mandatory content type")
6570
}
@@ -68,9 +73,10 @@ func (o *SignedCorim) processHdrs() error {
6873
return fmt.Errorf("expecting content type %q, got %q instead", ContentType, v)
6974
}
7075

71-
// TODO(tho) key id is apparently mandatory, which doesn't look right.
72-
// TODO(tho) Check with the CoRIM design team.
73-
// See https://github.com/veraison/corim/issues/14
76+
v, ok = hdr.Protected[cose.HeaderLabelKeyID]
77+
if !ok {
78+
// return errors.New("missing mandatory key id")
79+
}
7480

7581
v, ok = hdr.Protected[HeaderLabelCorimMeta]
7682
if !ok {

0 commit comments

Comments
 (0)