fix(release): 서명 진단이 비밀번호 모양을 알리고 Gradle 서명기로도 서명해 본다
pr / ci (pull_request) Successful in 3m34s

signing-check(run 13)에서 base64를 푼 키는 맞았다. armor·CRC24·tag 5가
정상이고, 가져온 키 지문이 릴리스 키 92646CEA…F791F8AB였다. 남은 실패는
「SIGNING_PASSWORD로 서명이 안 된다」 하나인데, 비밀번호가 틀렸는지,
붙여 넣을 때 줄바꿈·공백이 섞였는지, gpg 쪽 문제인지 가를 수 없었다.
gpg는 비밀번호의 첫 줄만 읽고 Gradle은 값 전체를 쓰므로, gpg 판정이
Gradle 판정과 다를 수도 있었다.

- check-signing-key.sh: 비밀번호의 모양(글자 수, 줄바꿈·CR 수, 앞뒤 공백,
  비ASCII 수)과 서명 실패 때의 gpg 상태 키워드만 출력한다. 값은 출력하지
  않는다.
- verifySigningKey: 스크립트 뒤에 Gradle의 in-memory 서명기
  (signing.signatory)로 몇 바이트를 서명해 본다. Sign 태스크와 같은 판정이다.
  실패 문구는 BouncyCastle 예외 문장뿐이다. 둘 중 하나라도 실패하면
  태스크가 실패한다.

검증(로컬 gpg, 버리는 키): 맞는 비밀번호 ok, 틀린 비밀번호 「gpg status:
BEGIN_SIGNING FAILURE KEY_CONSIDERED」. 끝에 줄바꿈이 붙은 비밀번호는 gpg로
ok이고 모양 줄이 「line breaks 1」을 알린다(Gradle 판정은 desktop과 runner).
This commit is contained in:
DongHyeonka
2026-11-08 15:21:16 +09:00
parent 97f7381aae
commit a892a45073
2 changed files with 41 additions and 4 deletions
+17 -4
View File
@@ -23,6 +23,15 @@ if [ -z "${SIGNING_KEY:-}" ]; then
exit 1
fi
[ -n "${SIGNING_PASSWORD:-}" ] || echo "check-signing-key: SIGNING_PASSWORD is empty (only right for a key without a passphrase)"
# The passphrase's shape only: a pasted value often carries a line break or spaces the key was not
# protected with, and Gradle uses the value as given.
python3 - <<'PY'
import os
p = os.environ.get("SIGNING_PASSWORD", "")
print(f"password shape: {len(p)} characters, line breaks {p.count(chr(10))}, CR {p.count(chr(13))},"
f" leading whitespace {'yes' if p[:1].isspace() else 'no'}, trailing whitespace {'yes' if p[-1:].isspace() else 'no'},"
f" non-ASCII characters {sum(1 for c in p if ord(c) > 127)}")
PY
home=$(mktemp -d)
trap 'rm -rf "$home"' EXIT
@@ -143,12 +152,16 @@ if [ -s "$home/key.asc" ] && GNUPGHOME="$home" gpg --batch --quiet --import "$ho
fail=1
fi
printf 'signing check\n' > "$home/message"
if printf '%s' "${SIGNING_PASSWORD:-}" | GNUPGHOME="$home" gpg --batch --pinentry-mode loopback \
--passphrase-fd 0 --local-user "${fingerprint:-none}" --detach-sign --output "$home/message.sig" \
"$home/message" >/dev/null 2>&1; then
# gpg reads only the first line of the file; the shape line above says whether there is more.
printf '%s' "${SIGNING_PASSWORD:-}" > "$home/passphrase"
if GNUPGHOME="$home" gpg --batch --pinentry-mode loopback --passphrase-file "$home/passphrase" \
--status-fd 3 --local-user "${fingerprint:-none}" --detach-sign --output "$home/message.sig" \
"$home/message" >/dev/null 2>&1 3>"$home/status"; then
echo "signing with SIGNING_PASSWORD: ok"
else
echo "PROBLEM: SIGNING_PASSWORD does not unlock the key for signing (wrong passphrase, or the key is not a signing key)"
# gpg's status keywords only (BAD_PASSPHRASE, MISSING_PASSPHRASE, ERROR …): no values.
status=$(awk '$1 == "[GNUPG:]" {print $2}' "$home/status" | sort -u | tr '\n' ' ')
echo "PROBLEM: SIGNING_PASSWORD does not unlock the key for signing (gpg status: ${status:-none})"
fail=1
fi
else