Mbed OS Reference
Loading...
Searching...
No Matches
t_cose_defines.h File Reference

Constants from COSE standard and IANA registry. More...

Go to the source code of this file.

Macros

#define COSE_HEADER_PARAM_ALG   1
 Label of COSE header that indicates an algorithm. More...
 
#define COSE_HEADER_PARAM_KID   4
 Label of COSE header that contains a key ID. More...
 
#define COSE_ALGORITHM_ES256   -7
 Indicates ECDSA with SHA-256. More...
 
#define COSE_ALGORITHM_ES384   -35
 Indicates ECDSA with SHA-384. More...
 
#define COSE_ALGORITHM_ES512   -36
 Indicates ECDSA with SHA-384. More...
 
#define COSE_ALG_SHA256_PROPRIETARY   -72000
 COSE-style algorithm ID for SHA256. More...
 
#define COSE_KEY_COMMON_KTY   1
 Label for data item containing the key type. More...
 
#define COSE_KEY_COMMON_KID   2
 Label for data item containing the key's kid. More...
 
#define COSE_KEY_PARAM_CRV   -1
 Label for data item indicating EC curve. More...
 
#define COSE_KEY_PARAM_X_COORDINATE   -2
 Label for data item that is an X coordinate of an EC key. More...
 
#define COSE_KEY_PARAM_Y_COORDINATE   -3
 Label for data item that is a y coordinate of an EC key. More...
 
#define COSE_KEY_PARAM_PRIVATE_D   -4
 Label for data item that is d, the private part of EC key. More...
 
#define COSE_KEY_TYPE_OKP   1
 Key type is Octet Key Pair. More...
 
#define COSE_KEY_TYPE_EC2   2
 Key is a 2-parameter EC key. More...
 
#define COSE_KEY_TYPE_SYMMETRIC   4
 Key is a symmetric key. More...
 
#define COSE_ELLIPTIC_CURVE_P_256   1
 Key type for NIST P-256 key. More...
 
#define COSE_ELLIPTIC_CURVE_P_384   2
 Key type for NIST P-384 key. More...
 
#define COSE_ELLIPTIC_CURVE_P_521   3
 Key type for NIST P-521 key. More...
 
#define COSE_SIG_CONTEXT_STRING_SIGNATURE1   "Signature1"
 This is a string constant used by COSE to label COSE_Sign1 structures. More...
 

Detailed Description

Constants from COSE standard and IANA registry.

This file contains constants identifiers defined in [COSE (RFC 8152)] (https://tools.ietf.org/html/rfc8152) and [IANA COSE Registry] (https://www.iana.org/assignments/cose/cose.xhtml). They include algorithm IDs and other constants.

Many constants in the IANA registry are not included here yet as they are not needed by t_cose. They can be added if they become needed.

Definition in file t_cose_defines.h.

Macro Definition Documentation

◆ COSE_HEADER_PARAM_ALG

#define COSE_HEADER_PARAM_ALG   1

Label of COSE header that indicates an algorithm.

Definition at line 41 of file t_cose_defines.h.

◆ COSE_HEADER_PARAM_KID

#define COSE_HEADER_PARAM_KID   4

Label of COSE header that contains a key ID.

Definition at line 48 of file t_cose_defines.h.

◆ COSE_ALGORITHM_ES256

#define COSE_ALGORITHM_ES256   -7

Indicates ECDSA with SHA-256.

Value for COSE_HEADER_PARAM_ALG to indicate ECDSA. w/SHA-256

Definition at line 73 of file t_cose_defines.h.

◆ COSE_ALGORITHM_ES384

#define COSE_ALGORITHM_ES384   -35

Indicates ECDSA with SHA-384.

Value for COSE_HEADER_PARAM_ALG to indicate ECDSA. w/SHA-384

Definition at line 82 of file t_cose_defines.h.

◆ COSE_ALGORITHM_ES512

#define COSE_ALGORITHM_ES512   -36

Indicates ECDSA with SHA-384.

Value for COSE_HEADER_PARAM_ALG to indicate ECDSA. w/SHA-512

Definition at line 91 of file t_cose_defines.h.

◆ COSE_ALG_SHA256_PROPRIETARY

#define COSE_ALG_SHA256_PROPRIETARY   -72000

COSE-style algorithm ID for SHA256.

The official COSE algorithm registry doesn't yet define an ID for a pure hash function. One is needed for internal use, so this is defined.

This is only used internally in the implementation and doesn't appear in any protocol messages so there are no interoperability issues. When this gets defined in the IANA registry, that value can be substituted here and all will work fine.

Definition at line 106 of file t_cose_defines.h.

◆ COSE_KEY_COMMON_KTY

#define COSE_KEY_COMMON_KTY   1

Label for data item containing the key type.

In a COSE_Key, label that indicates the data item containing the key type.

Definition at line 123 of file t_cose_defines.h.

◆ COSE_KEY_COMMON_KID

#define COSE_KEY_COMMON_KID   2

Label for data item containing the key's kid.

In a COSE_Key, label that indicates the data item containing the kid of this key.

Definition at line 133 of file t_cose_defines.h.

◆ COSE_KEY_PARAM_CRV

#define COSE_KEY_PARAM_CRV   -1

Label for data item indicating EC curve.

In a COSE_Key that holds an EC key of either type COSE_KEY_TYPE_EC2 or COSE_KEY_TYPE_OKP this labels the data item with the EC curve for the key.

Definition at line 151 of file t_cose_defines.h.

◆ COSE_KEY_PARAM_X_COORDINATE

#define COSE_KEY_PARAM_X_COORDINATE   -2

Label for data item that is an X coordinate of an EC key.

In a COSE_Key that holds an EC key, this is label that indicates the data item containing the X coordinate.

This is used for both key types COSE_KEY_TYPE_EC2 and COSE_KEY_TYPE_OKP.

Definition at line 164 of file t_cose_defines.h.

◆ COSE_KEY_PARAM_Y_COORDINATE

#define COSE_KEY_PARAM_Y_COORDINATE   -3

Label for data item that is a y coordinate of an EC key.

In a COSE_Key that holds an EC key, this is label that indicates the data item containing the Y coordinate.

This is used only for key type COSE_KEY_TYPE_EC2.

Definition at line 176 of file t_cose_defines.h.

◆ COSE_KEY_PARAM_PRIVATE_D

#define COSE_KEY_PARAM_PRIVATE_D   -4

Label for data item that is d, the private part of EC key.

In a COSE_Key that holds an EC key, this is label that indicates the data item containing the Y coordinate.

This is used for both key types COSE_KEY_TYPE_EC2 and COSE_KEY_TYPE_OKP.

Definition at line 189 of file t_cose_defines.h.

◆ COSE_KEY_TYPE_OKP

#define COSE_KEY_TYPE_OKP   1

Key type is Octet Key Pair.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_COMMON_KTY that indicates the COSE_Key is some sort of key pair represented by some octets. It may or may not be an EC key.

Definition at line 208 of file t_cose_defines.h.

◆ COSE_KEY_TYPE_EC2

#define COSE_KEY_TYPE_EC2   2

Key is a 2-parameter EC key.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_COMMON_KTY that indicates the COSE_Key is an EC key specified with two coordinates, X and Y.

Definition at line 219 of file t_cose_defines.h.

◆ COSE_KEY_TYPE_SYMMETRIC

#define COSE_KEY_TYPE_SYMMETRIC   4

Key is a symmetric key.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_COMMON_KTY that indicates the COSE_Key is a symmetric key.

Definition at line 230 of file t_cose_defines.h.

◆ COSE_ELLIPTIC_CURVE_P_256

#define COSE_ELLIPTIC_CURVE_P_256   1

Key type for NIST P-256 key.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_PARAM_CRV to indicate the NIST P-256 curve, also known as secp256r1.

This key type is always COSE_KEY_TYPE_EC2.

Definition at line 250 of file t_cose_defines.h.

◆ COSE_ELLIPTIC_CURVE_P_384

#define COSE_ELLIPTIC_CURVE_P_384   2

Key type for NIST P-384 key.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_PARAM_CRV to indicate the NIST P-384 curve, also known as secp384r1.

This key type is always COSE_KEY_TYPE_EC2.

Definition at line 263 of file t_cose_defines.h.

◆ COSE_ELLIPTIC_CURVE_P_521

#define COSE_ELLIPTIC_CURVE_P_521   3

Key type for NIST P-521 key.

In a COSE_Key, this is a value of the data item labeled COSE_KEY_PARAM_CRV to indicate the NIST P-521 curve, also known as secp521r1.

Definition at line 274 of file t_cose_defines.h.

◆ COSE_SIG_CONTEXT_STRING_SIGNATURE1

#define COSE_SIG_CONTEXT_STRING_SIGNATURE1   "Signature1"

This is a string constant used by COSE to label COSE_Sign1 structures.

See RFC 8152, section 4.4.

Definition at line 288 of file t_cose_defines.h.