aboutsummaryrefslogtreecommitdiff
path: root/gpg-interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'gpg-interface.h')
-rw-r--r--gpg-interface.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/gpg-interface.h b/gpg-interface.h
index 789d1ffac4..a365586ce1 100644
--- a/gpg-interface.h
+++ b/gpg-interface.h
@@ -74,6 +74,15 @@ int parse_signature(const char *buf, size_t size, struct strbuf *payload, struct
*/
size_t parse_signed_buffer(const char *buf, size_t size);
+/* Flags for sign_buffer(). */
+enum sign_buffer_flags {
+ /*
+ * Use the default configured signing key as returned by `get_signing_key()`
+ * when the provided "signing_key" is NULL or empty.
+ */
+ SIGN_BUFFER_USE_DEFAULT_KEY = (1 << 0),
+};
+
/*
* Create a detached signature for the contents of "buffer" and append
* it after "signature"; "buffer" and "signature" can be the same
@@ -81,8 +90,7 @@ size_t parse_signed_buffer(const char *buf, size_t size);
* at the end. Returns 0 on success, non-zero on failure.
*/
int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
- const char *signing_key);
-
+ const char *signing_key, enum sign_buffer_flags flags);
/*
* Returns corresponding string in lowercase for a given member of
@@ -112,12 +120,15 @@ enum sign_mode {
SIGN_WARN_STRIP,
SIGN_STRIP,
SIGN_STRIP_IF_INVALID,
+ SIGN_SIGN_IF_INVALID,
};
/*
* Return 0 if `arg` can be parsed into an `enum sign_mode`. Return -1
- * otherwise.
+ * otherwise. If the parsed mode is SIGN_SIGN_IF_INVALID and GPG key provided in
+ * the arguments in the form `sign-if-invalid=<keyid>`, the key-ID is parsed
+ * into `char **keyid`.
*/
-int parse_sign_mode(const char *arg, enum sign_mode *mode);
+int parse_sign_mode(const char *arg, enum sign_mode *mode, const char **keyid);
#endif