THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Git Source Code Mirror - This is a publish-only repository and all pull requests are ignored. Please follow Documentation/SubmittingPatches procedure for any of your improvements.
git
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9KB

  1. #ifndef GPG_INTERFACE_H
  2. #define GPG_INTERFACE_H
  3. struct strbuf;
  4. #define GPG_VERIFY_VERBOSE 1
  5. #define GPG_VERIFY_RAW 2
  6. #define GPG_VERIFY_OMIT_STATUS 4
  7. struct signature_check {
  8. char *payload;
  9. char *gpg_output;
  10. char *gpg_status;
  11. /*
  12. * possible "result":
  13. * 0 (not checked)
  14. * N (checked but no further result)
  15. * U (untrusted good)
  16. * G (good)
  17. * B (bad)
  18. */
  19. char result;
  20. char *signer;
  21. char *key;
  22. char *fingerprint;
  23. char *primary_key_fingerprint;
  24. };
  25. void signature_check_clear(struct signature_check *sigc);
  26. /*
  27. * Look at GPG signed content (e.g. a signed tag object), whose
  28. * payload is followed by a detached signature on it. Return the
  29. * offset where the embedded detached signature begins, or the end of
  30. * the data when there is no such signature.
  31. */
  32. size_t parse_signature(const char *buf, size_t size);
  33. /*
  34. * Create a detached signature for the contents of "buffer" and append
  35. * it after "signature"; "buffer" and "signature" can be the same
  36. * strbuf instance, which would cause the detached signature appended
  37. * at the end.
  38. */
  39. int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
  40. const char *signing_key);
  41. /*
  42. * Run "gpg" to see if the payload matches the detached signature.
  43. * gpg_output, when set, receives the diagnostic output from GPG.
  44. * gpg_status, when set, receives the status output from GPG.
  45. */
  46. int verify_signed_buffer(const char *payload, size_t payload_size,
  47. const char *signature, size_t signature_size,
  48. struct strbuf *gpg_output, struct strbuf *gpg_status);
  49. int git_gpg_config(const char *, const char *, void *);
  50. void set_signing_key(const char *);
  51. const char *get_signing_key(void);
  52. int check_signature(const char *payload, size_t plen,
  53. const char *signature, size_t slen,
  54. struct signature_check *sigc);
  55. void print_signature_buffer(const struct signature_check *sigc,
  56. unsigned flags);
  57. #endif