Skip to content

Commit 0475594

Browse files
Merge pull request #58 from veraison/COSE_Sign-is-experimental
Mark COSE Sign as experimental
2 parents 08be6c0 + fd82999 commit 0475594

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ _ = msg.Verify(nil, verifier)
7575
go-cose supports two different signature structures:
7676
- [cose.Sign1Message](https://pkg.go.dev/github.com/veraison/go-cose#Sign1Message) implements [COSE_Sign1](https://datatracker.ietf.org/doc/html/rfc8152#section-4.2).
7777
- [cose.SignMessage](https://pkg.go.dev/github.com/veraison/go-cose#SignMessage) implements [COSE_Sign](https://datatracker.ietf.org/doc/html/rfc8152#section-4.1).
78+
> :warning: The COSE_Sign API is currently **EXPERIMENTAL** and may be changed or removed in a later release. In addition, the amount of functional and security testing it has received so far is significantly lower than the COSE_Sign1 API.
7879
7980
### Built-in Algorithms
8081

example_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import (
1212
)
1313

1414
// This example demonstrates signing and verifying COSE_Sign signatures.
15+
//
16+
// The COSE Sign API is EXPERIMENTAL and may be changed or removed in a later
17+
// release.
1518
func ExampleSignMessage() {
1619
// create a signature holder
1720
sigHolder := cose.NewSignature()

sign.go

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,24 @@ var signaturePrefix = []byte{
3232
// Signature represents a decoded COSE_Signature.
3333
//
3434
// Reference: https://tools.ietf.org/html/rfc8152#section-4.1
35+
//
36+
// Experimental
37+
//
38+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
39+
// later release.
40+
//
3541
type Signature struct {
3642
Headers Headers
3743
Signature []byte
3844
}
3945

4046
// NewSignature returns a Signature with header initialized.
47+
//
48+
// Experimental
49+
//
50+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
51+
// later release.
52+
//
4153
func NewSignature() *Signature {
4254
return &Signature{
4355
Headers: Headers{
@@ -48,6 +60,12 @@ func NewSignature() *Signature {
4860
}
4961

5062
// MarshalCBOR encodes Signature into a COSE_Signature object.
63+
//
64+
// Experimental
65+
//
66+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
67+
// later release.
68+
//
5169
func (s *Signature) MarshalCBOR() ([]byte, error) {
5270
if s == nil {
5371
return nil, errors.New("cbor: MarshalCBOR on nil Signature pointer")
@@ -72,6 +90,12 @@ func (s *Signature) MarshalCBOR() ([]byte, error) {
7290
}
7391

7492
// UnmarshalCBOR decodes a COSE_Signature object into Signature.
93+
//
94+
// Experimental
95+
//
96+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
97+
// later release.
98+
//
7599
func (s *Signature) UnmarshalCBOR(data []byte) error {
76100
if s == nil {
77101
return errors.New("cbor: UnmarshalCBOR on nil Signature pointer")
@@ -110,6 +134,12 @@ func (s *Signature) UnmarshalCBOR(data []byte) error {
110134
// payload of its parent message.
111135
//
112136
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-4.4
137+
//
138+
// Experimental
139+
//
140+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
141+
// later release.
142+
//
113143
func (s *Signature) Sign(rand io.Reader, signer Signer, protected cbor.RawMessage, payload, external []byte) error {
114144
if s == nil {
115145
return errors.New("signing nil Signature")
@@ -151,6 +181,12 @@ func (s *Signature) Sign(rand io.Reader, signer Signer, protected cbor.RawMessag
151181
// payload of its parent message.
152182
//
153183
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-4.4
184+
//
185+
// Experimental
186+
//
187+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
188+
// later release.
189+
//
154190
func (s *Signature) Verify(verifier Verifier, protected cbor.RawMessage, payload, external []byte) error {
155191
if s == nil {
156192
return errors.New("verifying nil Signature")
@@ -251,13 +287,25 @@ var signMessagePrefix = []byte{
251287
// SignMessage represents a decoded COSE_Sign message.
252288
//
253289
// Reference: https://tools.ietf.org/html/rfc8152#section-4.1
290+
//
291+
// Experimental
292+
//
293+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
294+
// later release.
295+
//
254296
type SignMessage struct {
255297
Headers Headers
256298
Payload []byte
257299
Signatures []*Signature
258300
}
259301

260302
// NewSignMessage returns a SignMessage with header initialized.
303+
//
304+
// Experimental
305+
//
306+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
307+
// later release.
308+
//
261309
func NewSignMessage() *SignMessage {
262310
return &SignMessage{
263311
Headers: Headers{
@@ -268,6 +316,12 @@ func NewSignMessage() *SignMessage {
268316
}
269317

270318
// MarshalCBOR encodes SignMessage into a COSE_Sign_Tagged object.
319+
//
320+
// Experimental
321+
//
322+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
323+
// later release.
324+
//
271325
func (m *SignMessage) MarshalCBOR() ([]byte, error) {
272326
if m == nil {
273327
return nil, errors.New("cbor: MarshalCBOR on nil SignMessage pointer")
@@ -304,6 +358,12 @@ func (m *SignMessage) MarshalCBOR() ([]byte, error) {
304358
}
305359

306360
// UnmarshalCBOR decodes a COSE_Sign_Tagged object into SignMessage.
361+
//
362+
// Experimental
363+
//
364+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
365+
// later release.
366+
//
307367
func (m *SignMessage) UnmarshalCBOR(data []byte) error {
308368
if m == nil {
309369
return errors.New("cbor: UnmarshalCBOR on nil SignMessage pointer")
@@ -352,6 +412,12 @@ func (m *SignMessage) UnmarshalCBOR(data []byte) error {
352412
// See `Signature.Sign()` for advanced signing scenarios.
353413
//
354414
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-4.4
415+
//
416+
// Experimental
417+
//
418+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
419+
// later release.
420+
//
355421
func (m *SignMessage) Sign(rand io.Reader, external []byte, signers ...Signer) error {
356422
if m == nil {
357423
return errors.New("signing nil SignMessage")
@@ -392,6 +458,12 @@ func (m *SignMessage) Sign(rand io.Reader, external []byte, signers ...Signer) e
392458
// policies.
393459
//
394460
// Reference: https://datatracker.ietf.org/doc/html/rfc8152#section-4.4
461+
//
462+
// Experimental
463+
//
464+
// Notice: The COSE Sign API is EXPERIMENTAL and may be changed or removed in a
465+
// later release.
466+
//
395467
func (m *SignMessage) Verify(external []byte, verifiers ...Verifier) error {
396468
if m == nil {
397469
return errors.New("verifying nil SignMessage")

0 commit comments

Comments
 (0)