]> git.ipfire.org Git - thirdparty/git.git/blame - gpg-interface.h
Merge branch 'jt/t5500-unflake'
[thirdparty/git.git] / gpg-interface.h
CommitLineData
2f47eae2
JH
1#ifndef GPG_INTERFACE_H
2#define GPG_INTERFACE_H
3
ef3ca954
EN
4struct strbuf;
5
94240b91
LP
6#define GPG_VERIFY_VERBOSE 1
7#define GPG_VERIFY_RAW 2
8#define GPG_VERIFY_OMIT_STATUS 4
ca194d50 9
54887b46
HJI
10enum signature_trust_level {
11 TRUST_UNDEFINED,
12 TRUST_NEVER,
13 TRUST_MARGINAL,
14 TRUST_FULLY,
15 TRUST_ULTIMATE,
16};
17
ffb6d7d5 18struct signature_check {
71c214c8 19 char *payload;
ffb6d7d5
SG
20 char *gpg_output;
21 char *gpg_status;
a50e7ca3
JH
22
23 /*
24 * possible "result":
25 * 0 (not checked)
26 * N (checked but no further result)
a50e7ca3
JH
27 * G (good)
28 * B (bad)
29 */
30 char result;
ffb6d7d5
SG
31 char *signer;
32 char *key;
3daaaabe 33 char *fingerprint;
4de9394d 34 char *primary_key_fingerprint;
54887b46 35 enum signature_trust_level trust_level;
ffb6d7d5
SG
36};
37
f80bee27
JK
38void signature_check_clear(struct signature_check *sigc);
39
40/*
41 * Look at GPG signed content (e.g. a signed tag object), whose
42 * payload is followed by a detached signature on it. Return the
43 * offset where the embedded detached signature begins, or the end of
44 * the data when there is no such signature.
45 */
e6fa6cde 46size_t parse_signature(const char *buf, size_t size);
f80bee27 47
f80bee27
JK
48/*
49 * Create a detached signature for the contents of "buffer" and append
50 * it after "signature"; "buffer" and "signature" can be the same
51 * strbuf instance, which would cause the detached signature appended
52 * at the end.
53 */
54int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
55 const char *signing_key);
56
f80bee27
JK
57int git_gpg_config(const char *, const char *, void *);
58void set_signing_key(const char *);
59const char *get_signing_key(void);
60int check_signature(const char *payload, size_t plen,
61 const char *signature, size_t slen,
62 struct signature_check *sigc);
63void print_signature_buffer(const struct signature_check *sigc,
64 unsigned flags);
2f47eae2
JH
65
66#endif