Closed bdel80 closed 4 years ago
Section 13.1.1
x: This contains the x-coordinate for the EC point. The integer is converted to an octet string as defined in [SEC1]. Leading zero octets MUST be preserved.
You have better eyes than me. Thanks !
I wrote the spec, I hope I have better eyes.
When generating EC2 keys with mbedTLS, you sometime have points that are not always the same size.
My understanding is that this is because of the compressed point format used, when the number it represents starts with zeros, they are not serialized.
This make the 2 checks in mbedtls.c at line 715 and 723 fail for no good reason:
CHECK_CONDITION(p->length == cbGroup, COSE_ERR_INVALID_PARAMETER);
I reread the COSE RFC spec, and couldnt find anything about requirind the EC points to be of fixed size.
By changing the checks to:
CHECK_CONDITION(p->length <= cbGroup, COSE_ERR_INVALID_PARAMETER);
The errors go away. And its produces valid signatures.Here is a sample of such key in cbor notation format: