COSE Working Group M. Jones
Internet-Draft Microsoft
Intended status: Standards Track June 15, 2017
Expires: December 17, 2017

Using RSA Algorithms with COSE Messages


The CBOR Object Signing and Encryption (COSE) specification defines cryptographic message encodings using Concise Binary Object Representation (CBOR). This specification defines algorithm encodings and representations enabling RSA algorithms to be used for COSE messages. Encodings for the use of RSASSA-PSS signatures, RSAES-OAEP encryption, and RSA keys are specified.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on December 17, 2017.

Copyright Notice

Copyright (c) 2017 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents ( in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

Table of Contents

1. Introduction

The CBOR Object Signing and Encryption (COSE) [I-D.ietf-cose-msg] specification defines cryptographic message encodings using Concise Binary Object Representation (CBOR) [RFC7049]. This specification defines algorithm encodings and representations enabling RSA algorithms to be used for COSE messages.

1.1. Requirements Notation and Conventions

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].

2. RSASSA-PSS Signature Algorithm

The RSASSA-PSS signature algorithm is defined in [RFC3447].

The RSASSA-PSS signature algorithm is parameterized with a hash function (h), a mask generation function (mgf) and a salt length (sLen). For this specification, the mask generation function is fixed to be MGF1 as defined in [RFC3447]. It has been recommended that the same hash function be used for hashing the data as well as in the mask generation function. This specification follows this recommendation. The salt length is the same length as the hash function output.

Implementations need to check that the key type is 'RSA' when creating or verifying a signature.

The RSASSA-PSS algorithms specified in this document are in the following table.

RSASSA-PSS Algorithm Values
Name Value Hash Salt Length Description
PS256 -37 SHA-256 32 RSASSA-PSS w/ SHA-256
PS384 -38 SHA-384 48 RSASSA-PSS w/ SHA-384
PS512 -39 SHA-512 64 RSASSA-PSS w/ SHA-512

3. RSAES-OAEP Key Encryption Algorithm

RSAES-OAEP is an asymmetric key encryption algorithm. The definition of RSAEA-OAEP can be found in Section 7.1 of [RFC3447]. The algorithm is parameterized using a masking generation function (mgf), a hash function (h) and encoding parameters (P). For the algorithm identifiers defined in this section:

The following table summarizes the rest of the values.

RSAES-OAEP Algorithm Values
Name Value Hash Description
RSAES-OAEP w/ RFC 3447 default parameters -40 SHA-1 RSAES-OAEP w/ SHA-1
RSAES-OAEP w/ SHA-256 -41 SHA-256 RSAES-OAEP w/ SHA-256
RSAES-OAEP w/ SHA-512 -42 SHA-512 RSAES-OAEP w/ SHA-512

The key type MUST be 'RSA'.

4. RSA Keys

Key types are identified by the 'kty' member of the COSE_Key object. This specification defines one value for this member in the following table.

Key Type Values
Name Value Description

This document defines a key structure for both the public and private parts of RSA keys. Together, an RSA public key and an RSA private key form an RSA key pair.

The document also provides support for the so-called "multi-prime" RSA keys, in which the modulus may have more than two prime factors. The benefit of multi-prime RSA is lower computational cost for the decryption and signature primitives. For a discussion on how multi-prime affects the security of RSA crypto-systems, the reader is referred to [MultiPrimeRSA].

This document follows the naming convention of [RFC3447] for the naming of the fields of an RSA public or private key. The requirements for fields for RSA keys are as follows:

The following table provides a summary of the label values and the types associated with each of those labels.

RSA Key Parameters
Key Type Name Label CBOR Type Description
3 n -1 bstr Modulus Parameter
3 e -2 bstr Exponent Parameter
3 d -3 bstr Private Exponent Parameter
3 p -4 bstr First Prime Factor
3 q -5 bstr Second Prime Factor
3 dP -6 bstr First Factor CRT Exponent
3 dQ -7 bstr Second Factor CRT Exponent
3 qInv -8 bstr First CRT Coefficient
3 other -9 array Other Primes Info
3 r_i -10 bstr i-th factor, Prime Factor
3 d_i -11 bstr i-th factor, Factor CRT Exponent
3 t_i -12 bstr i-th factor, Factor CRT Coefficient

5. IANA Considerations

5.1. COSE Algorithms Registrations

This section registers the following values in the IANA "COSE Algorithms" registry [IANA.COSE].

5.2. COSE Key Type Registrations

This section registers the following values in the IANA "COSE Key Type" registry [IANA.COSE].

5.3. COSE Key Type Parameters Registrations

This section registers the following values in the IANA "COSE Key Type Parameters" registry [IANA.COSE].

6. Security Considerations

6.1. Key Size Security Considerations

A key size of 2048 bits or larger MUST be used with these algorithms. This key size corresponds roughly to the same strength as provided by a 128-bit symmetric encryption algorithm. Implementations SHOULD be able to encrypt and decrypt with modulus between 2048 and 16K bits in length. Applications can impose additional restrictions on the length of the modulus.

In addition to needing to worry about keys that are too small to provide the required security, there are issues with keys that are too large. Denial of service attacks have been mounted with overly large keys or oddly sized keys. This has the potential to consume resources with these keys. It is highly recommended that checks on the key length be done before starting a cryptographic operation.

There are two reasonable ways to address this attack. First, a key should not be used for a cryptographic operation until it has been verified that it is controlled by a party trusted by the recipient. This approach means that no cryptography will be done until a trust decision about the key has been made, a process described in Appendix D, Item 4 of [RFC7515]. Second, applications can impose maximum as well as minimum length requirements on keys. This limits the resources that would otherwise be consumed by the use of overly large keys.

6.2. RSASSA-PSS Security Considerations

There is a theoretical hash substitution attack that can be mounted against RSASSA-PSS [HASHID]. However, the requirement that the same hash function be used consistently for all operations is an effective mitigation against it. Unlike ECDSA, hash function outputs are not truncated so that the full hash value is always signed. The internal padding structure of RSASSA-PSS means that one needs to have multiple collisions between the two hash functions to be successful in producing a forgery based on changing the hash function. This is highly unlikely.

6.3. RSAES-OAEP Security Considerations

A version of RSAES-OAEP using the default parameters specified in Appendix A.2.1 of RFC 3447 is included because this is the most widely implemented set of OAEP parameter choices. (Those default parameters are the SHA-1 hash function and the MGF1 with SHA-1 mask generation function.)

Keys used with RSAES-OAEP must follow the constraints in Section 7.1 of RFC 3447. Also, keys with a low public key exponent value, as described in Section 3 of "Twenty Years of Attacks on the RSA Cryptosystem", must not be used.

7. References

7.1. Normative References

[Boneh99] Boneh, D., "Twenty Years of Attacks on the RSA Cryptosystem", Notices of the American Mathematical Society (AMS), Vol. 46, No. 2, pp. 203-213, 1999.
[I-D.ietf-cose-msg] Schaad, J., "CBOR Object Signing and Encryption (COSE)", Internet-Draft draft-ietf-cose-msg-24, November 2016.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997.
[RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, DOI 10.17487/RFC3447, February 2003.
[RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013.
[RFC7515] Jones, M., Bradley, J. and N. Sakimura, "JSON Web Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 2015.

7.2. Informative References

[HASHID] Kaliski, B., "On Hash Function Firewalls in Signature Schemes", Lecture Notes in Computer Science, Volume 2271, pp. 1-16, DOI 10.1007/3-540-45760-7_1, February 2002.
[IANA.COSE] IANA, "CBOR Object Signing and Encryption (COSE)"
[MultiPrimeRSA] Hinek, M. and D. Cheriton, "On the Security of Multi-prime RSA", June 2006.

Appendix A. Acknowledgements

This specification incorporates text from draft-ietf-cose-msg-05 by Jim Schaad. Thanks are due to Roni Even, Steve Kent, Kathleen Moriarty, Rich Salz, and Jim Schaad for their reviews of the specification.

Appendix B. Document History

[[ to be removed by the RFC Editor before publication as an RFC ]]






Author's Address

Michael B. Jones Microsoft EMail: URI: