Skip to main content

construct_sshsig_signed_data

Function construct_sshsig_signed_data 

Source
pub fn construct_sshsig_signed_data(
    data: &[u8],
    namespace: &str,
) -> Result<Vec<u8>, CryptoError>
Expand description

Construct the data blob that SSHSIG signs (the “message to sign”).

Format per OpenSSH sshsig.c: literal “SSHSIG” – 6 raw bytes, NO length prefix string namespace – 4-byte length + data string reserved – 4-byte length + data (empty) string hash_alg – 4-byte length + data (“sha512”) string H(message) – 4-byte length + sha512(message)

Args:

  • data: The raw message bytes to hash.
  • namespace: The SSHSIG namespace (e.g., “git”).

Usage:

let blob = construct_sshsig_signed_data(b"commit data", "git")?;
let sig = agent_sign(&socket, &pubkey, &blob)?;