derToP1363

fun derToP1363(bytes: ByteArray, algorithm: Algorithm): ByteArray

Converts a DER-encoded ECDSA signature to P1363 (r || s), left-padding each component to the field size of algorithm.

Throws

if bytes is not valid DER, if algorithm is not an ECDSA algorithm, or if r/s do not fit in the curve's field size.


fun derToP1363(bytes: ByteArray, fieldSizeBytes: Int): ByteArray

Converts a DER-encoded ECDSA signature to P1363 (r || s), left-padding each component to fieldSizeBytes bytes (32 for P-256/secp256k1, 48 for P-384, 66 for P-521).

Throws

if bytes is not valid DER or r/s exceed fieldSizeBytes.