From f574e5813f3e2996dd9532910da0f12106b2b3d4 Mon Sep 17 00:00:00 2001 From: neil Date: Tue, 2 Aug 2016 10:56:40 +0800 Subject: [PATCH] add the new reg hash --- acme.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/acme.sh b/acme.sh index 5e9e38c2..c0cdbd54 100755 --- a/acme.sh +++ b/acme.sh @@ -1401,19 +1401,19 @@ issue() { accountkey_json=$(echo -n "$jwk" | tr -d ' ' ) thumbprint=$(echo -n "$accountkey_json" | _digest "sha256" | _urlencode) - accountkeyhash="$(cat "$ACCOUNT_KEY_PATH" | _digest "sha256" )" - accountkeyhash="$(echo $accountkeyhash$API | _digest "sha256" )" - if [ "$accountkeyhash" != "$ACCOUNT_KEY_HASH" ] ; then - _info "Registering account" - regjson='{"resource": "new-reg", "agreement": "'$AGREEMENT'"}' - if [ "$ACCOUNT_EMAIL" ] ; then - regjson='{"resource": "new-reg", "contact": ["mailto: '$ACCOUNT_EMAIL'"], "agreement": "'$AGREEMENT'"}' - fi - _send_signed_request "$API/acme/new-reg" "$regjson" + regjson='{"resource": "new-reg", "agreement": "'$AGREEMENT'"}' + if [ "$ACCOUNT_EMAIL" ] ; then + regjson='{"resource": "new-reg", "contact": ["mailto: '$ACCOUNT_EMAIL'"], "agreement": "'$AGREEMENT'"}' + fi + accountkeyhash="$(cat "$ACCOUNT_KEY_PATH" | _digest "sha256" )" + accountkeyhash="$(echo $accountkeyhash$API$regjson | _digest "sha256" )" + if [ "$accountkeyhash" != "$ACCOUNT_KEY_HASH" ] ; then + _info "Registering account" + _send_signed_request "$API/acme/new-reg" "$regjson" if [ "$code" = "" ] || [ "$code" = '201' ] ; then _info "Registered" - echo $response > $LE_WORKING_DIR/account.json + echo "$response" > $LE_WORKING_DIR/account.json elif [ "$code" = '409' ] ; then _info "Already registered" else