RFC 8446 section 4.2.3 ECDSA-Sig-Value DER encoding. More...
Go to the source code of this file.
Functions | |
| QSC_EXPORT_API qsc_tls_status | qsc_tls_ecdsa_der_encode (const uint8_t *rs, size_t componentsize, uint8_t *output, size_t outlen, size_t *written) |
| DER-encode a raw r||s ECDSA signature. | |
| QSC_EXPORT_API qsc_tls_status | qsc_tls_ecdsa_der_decode (const uint8_t *der, size_t derlen, size_t componentsize, uint8_t *output, size_t outlen) |
| Decode a DER-encoded ECDSA signature into raw r||s form. | |
RFC 8446 section 4.2.3 ECDSA-Sig-Value DER encoding.
TLS 1.3 ECDSA signatures on the wire are DER-encoded as: ECDSA-Sig-Value ::= SEQUENCE { r INTEGER, s INTEGER } QSC's ecdsa primitive produces raw r||s of fixed width. These helpers convert between the two representations. INTEGER encoding rules (X.690):
| QSC_EXPORT_API qsc_tls_status qsc_tls_ecdsa_der_decode | ( | const uint8_t * | der, |
| size_t | derlen, | ||
| size_t | componentsize, | ||
| uint8_t * | output, | ||
| size_t | outlen ) |
Decode a DER-encoded ECDSA signature into raw r||s form.
| der | [const uint8_t*] DER-encoded signature. |
| derlen | [size_t] DER signature length. |
| componentsize | [size_t] Expected size of each component (defines output width). |
| output | [uint8_t*] Destination r||s buffer; must be at least 2*componentsize bytes. |
| outlen | [size_t] Capacity of output. |
| QSC_EXPORT_API qsc_tls_status qsc_tls_ecdsa_der_encode | ( | const uint8_t * | rs, |
| size_t | componentsize, | ||
| uint8_t * | output, | ||
| size_t | outlen, | ||
| size_t * | written ) |
DER-encode a raw r||s ECDSA signature.
| rs | [const uint8_t*] Raw r||s buffer, each component width bytes long. |
| componentsize | [size_t] Size of each component in bytes (32 for P-256, 48 for P-384, 66 for P-521). |
| output | [uint8_t*] Destination buffer for DER-encoded signature. |
| outlen | [size_t] Capacity of output. |
| written | [size_t*] On success, receives the DER length (variable, typically 70-72 for P-256). |