@@ -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+ //
3541type 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+ //
4153func 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+ //
5169func (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+ //
7599func (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+ //
113143func (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+ //
154190func (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+ //
254296type 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+ //
261309func 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+ //
271325func (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+ //
307367func (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+ //
355421func (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+ //
395467func (m * SignMessage ) Verify (external []byte , verifiers ... Verifier ) error {
396468 if m == nil {
397469 return errors .New ("verifying nil SignMessage" )
0 commit comments