libgit2

git_commit_extract_signature

Version:

Extract the signature from a commit

If the id is not for a commit, the error class will be GIT_ERROR_INVALID. If the commit does not have a signature, the error class will be GIT_ERROR_OBJECT.

Signature

int git_commit_extract_signature(git_buf *signature, git_buf *signed_data, git_repository *repo, git_oid *commit_id, const char *field);

Parameters

In
signature

the signature block; existing content will be overwritten

In
signed_data

signed data; this is the commit contents minus the signature block; existing content will be overwritten

In
repo

the repository in which the commit exists

In
commit_id

the commit from which to extract the data

const char *
In
field

the name of the header field containing the signature block; pass NULL to extract the default 'gpgsig'

Returns

int

0 on success, GIT_ENOTFOUND if the id is not for a commit or the commit does not have a signature.

Versions