Skip to main content

sign_buffer

Function sign_buffer 

Source
pub fn sign_buffer(
    cfg: &GpgConfig,
    payload: &[u8],
    signing_key: &str,
) -> Result<Vec<u8>>
Expand description

Sign payload with signing_key using the configured program.

Spawns <program> --status-fd=2 -bsau <signing_key>, writes payload to stdin, and returns the armored detached signature from stdout. Fails if the child exits non-zero or does not emit a [GNUPG:] SIG_CREATED status line — in either case the program’s stderr is surfaced in the error (the LET_GPG_PROGRAM_FAIL/zOMG path of subtest 28).

§Errors

Returns Error::Signing when the program cannot be spawned, exits non-zero, or fails to produce a signature.