Skip to content

Commit f4bdbf8

Browse files
librootorgplowsof
authored andcommitted
Verify GPG key fingerprint before importing
1 parent 35f51c0 commit f4bdbf8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

create_monero_torrent.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ OUTPUT_DIR="${OUTPUT_DIR:-downloads}"
1414
TORRENT_DIR="${TORRENT_DIR:-watch}"
1515
HASHES_URL="${HASHES_URL:-https://www.getmonero.org/downloads/hashes.txt}"
1616
BF_KEY_URL="${BF_KEY_URL:-https://raw.githubusercontent.com/monero-project/monero/master/utils/gpg_keys/binaryfate.asc}"
17+
BF_EXPECTED_FP="81AC591FE9C4B65C5806AFC3F0AF4D462A0BDF92" # binaryFate's fingerprint
1718

1819
# afaict the only important thing for hash determinism is piece size
1920
PIECE_SIZE=21
@@ -51,6 +52,19 @@ for tuple in "$HASHES_URL:hashes.txt" "$BF_KEY_URL:binaryfate.asc"; do
5152
fi
5253
done
5354

55+
# get fingerprint from the binaryfate.asc file
56+
# fingerprint (fpr) is on 10th column https://github.com/gpg/gnupg/blob/master/doc/DETAILS
57+
actual_fp=$(gpg --with-colons --show-keys "$OUTPUT_DIR/binaryfate.asc" 2>/dev/null | awk -F: '/^fpr:/ {print $10; exit}')
58+
59+
if [ "$actual_fp" != "$BF_EXPECTED_FP" ]; then
60+
echo "ERROR: Key fingerprint mismatch!"
61+
echo "Got: $actual_fp"
62+
echo "Expected: $BF_EXPECTED_FP"
63+
exit 1
64+
fi
65+
66+
echo "GPG key fingerprint verified: $BF_EXPECTED_FP"
67+
5468
gpg --import "$OUTPUT_DIR/binaryfate.asc"
5569
gpg --verify "$OUTPUT_DIR/hashes.txt"
5670

0 commit comments

Comments
 (0)