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.

gpg.sh 1.1KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # Copyright (c) 2014-2016 The Bitcoin Core developers
  3. # Distributed under the MIT software license, see the accompanying
  4. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
  5. INPUT=$(cat /dev/stdin)
  6. VALID=false
  7. REVSIG=false
  8. IFS='
  9. '
  10. for LINE in $(echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null); do
  11. case "$LINE" in
  12. "[GNUPG:] VALIDSIG "*)
  13. while read KEY; do
  14. case "$LINE" in "[GNUPG:] VALIDSIG $KEY "*) VALID=true;; esac
  15. done < ./contrib/verify-commits/trusted-keys
  16. ;;
  17. "[GNUPG:] REVKEYSIG "*)
  18. [ "$BITCOIN_VERIFY_COMMITS_ALLOW_REVSIG" != 1 ] && exit 1
  19. while read KEY; do
  20. case "$LINE" in "[GNUPG:] REVKEYSIG ${KEY#????????????????????????} "*)
  21. REVSIG=true
  22. GOODREVSIG="[GNUPG:] GOODSIG ${KEY#????????????????????????} "
  23. esac
  24. done < ./contrib/verify-commits/trusted-keys
  25. ;;
  26. esac
  27. done
  28. if ! $VALID; then
  29. exit 1
  30. fi
  31. if $VALID && $REVSIG; then
  32. echo "$INPUT" | gpg --trust-model always "$@" | grep "^\[GNUPG:\] \(NEWSIG\|SIG_ID\|VALIDSIG\)" 2>/dev/null
  33. echo "$GOODREVSIG"
  34. else
  35. echo "$INPUT" | gpg --trust-model always "$@" 2>/dev/null
  36. fi