encodeEcdsaSignature

fun encodeEcdsaSignature(algorithmName: String, derSignature: ByteArray): ByteArray(source)

Wrap an externally generated DER ECDSA signature in the SSH signature format.

Use for hardware signers from AuthHandler.onSignatureRequest. The input must be a DER SEQUENCE of two positive INTEGERs, not raw concatenated r and s. Supports ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, and ecdsa-sha2-nistp521. This encodes the signature; it does not hash data or verify the signature.

Return

Complete SSH signature blob, including the algorithm name

Parameters

algorithmName

SSH ECDSA signature algorithm matching the signing key

derSignature

DER signature returned by the external signer

Throws

if the algorithm or signature encoding is invalid