Skip to main content

parse_signed_buffer

Function parse_signed_buffer 

Source
pub fn parse_signed_buffer(buf: &[u8]) -> Option<(Vec<u8>, Vec<u8>)>
Expand description

Split a signed buffer (e.g. a tag object) into (payload, signature).

Port of Git’s gpg-interface.c:parse_signed_buffer/parse_signature: scans the buffer line by line and records the offset of the last line that begins a recognized signature armor (GpgFormat::from_signature). The payload is everything before that offset and the signature is everything from it to the end. Unlike commits, a signed tag appends the armored signature directly after the tag body with no gpgsig header and no per-line indentation.

Returns None when no armor line is found (the buffer is unsigned).