Skip to main content

sign_serialized_commit

Function sign_serialized_commit 

Source
pub fn sign_serialized_commit(
    cfg: &GpgConfig,
    unsigned_bytes: &[u8],
    committer_ident: &str,
    signing_key_override: Option<&str>,
    hash_algo: HashAlgo,
) -> Result<Vec<u8>>
Expand description

Sign a serialized commit object (without gpgsig) and splice the signature header.

Uses sign_buffer on unsigned_bytes and add_header_signature with the header from commit_gpg_sig_header. The signing key comes from signing_key_override, else user.signingkey, else committer_signing_default applied to committer_ident.

ยงErrors

Returns Error::Signing when the signing program fails, and Error::Config when GpgConfig cannot be built from the repository config (callers typically construct GpgConfig first).