CBOR, COSE and RSA Key Pairs

--

In computer security, we often have to represent binary data, in single values or groups of characters, bytes, words, long words, signed integers, floating-point values, double-precision floating-point values, and so on. This might be in the form of a data object, a signature or even encrypted content. For this, the ANS.1 DER format is often used, such as presenting digital certificates and signatures. An improvement on this for small messages with security is Concise Binary Object Representation (CBOR) — and which is defined in RFC8949 [1]. While JSON represents text-based data objects CBOR focuses on binary objects. It has been designed to create a lightweight encoder and decoder. This supports the use of CBOR within an IoT infrastructure. The data, also, does not require a data schema to be able to decode it, along with being extensible.

CBOR integrates security into small data objects and small message sizes. In this case, we will generate an RSA key pair. With this we have two prime numbers (p and q), and compute the modulus:

N=pq

We then pick an encryption key value (e=0x010001) and then compute:

d=e^{−1} (modϕ)

and where:

ϕ=(p−1)(q−1)

The public key is then (e,N) and the private key is (d,N). To encrypt a message (M), we create a…

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.