Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove white space from gpg signature check #1440

Merged
merged 1 commit into from
Dec 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion sbin/prepareWorkspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,17 @@ checkFingerprint() {
echo $verify

# grep out and trim fingerprint from line of the form "Primary key fingerprint: 58E0 C111 E39F 5408 C5D3 EC76 C1A6 0EAC E707 FDA5"
local fingerprint=$(echo $verify | grep "Primary key fingerprint" | egrep -o "([0-9A-F]{4} ? ?){10}" | sed -e 's/[[:space:]]*$//')
local fingerprint=$(echo $verify | grep "Primary key fingerprint" | egrep -o "([0-9A-F]{4} ? ?){10}" | head -n 1)

# Remove whitespace from finger print as different versions of gpg may or may not add spaces to the fingerprint
# specifically gpg on Ubuntu 16.04 produces:
# `13AC 2213 964A BE1D 1C14 7C0E 1939 A252 0BAB 1D90`
# where as 18.04 produces:
# `13AC2213964ABE1D1C147C0E1939A2520BAB1D90`
fingerprint="${fingerprint// /}"

# remove spaces from expected fingerprint to match the format from the output of gpg
expectedFingerprint="${expectedFingerprint// /}"

if [ "$fingerprint" != "$expectedFingerprint" ]; then
echo "Failed to verify signature of $fileName"
Expand Down