Topic: R, S components of ECDSA signature as binary string
Hi,
I’m using
wc_ecc_sign_hash_ex
to get generate an ECDSA signature, and get the R and S components.
I need these to encode a CBOR COSE message (RFC 8152). The signature in a COSE message is a concatenation of the R and S components as a byte string. From RFC 8152:
The signature algorithm results in a pair of integers (R, S). These
integers will be the same length as the length of the key used for
the signature process. The signature is encoded by converting the
integers into byte strings of the same length as the key size. The
length is rounded up to the nearest byte and is left padded with zero
bits to get to the correct length. The two integers are then
concatenated together to form a byte string that is the resulting
signature.
But, I can’t figure out how to get from R and S as (mp_int), to a byte string, with wolfSSL, without using the internal mp_read_unsigned_bin.
Is there a way?
Thanks for any help!