]> git.street.me.uk Git - andy/dehydrated.git/commitdiff
Merge pull request #59 from erdgeist/master
authorLukas Schauer <lukas2511@users.noreply.github.com>
Sat, 19 Dec 2015 22:34:08 +0000 (23:34 +0100)
committerLukas Schauer <lukas2511@users.noreply.github.com>
Sat, 19 Dec 2015 22:34:08 +0000 (23:34 +0100)
when using printf, we do not need inline expansion of variables

1  2 
letsencrypt.sh

diff --cc letsencrypt.sh
index 44ba55641acc1697f5f6a7b5c5f3c99cb40d8904,7164db33397136de922e259eec7d40a77f34f4a4..bad985ffee446ba94ef854ec257d923324cf1961
@@@ -127,10 -127,10 +127,10 @@@ init_system() 
    fi
  
    # Get public components from private key and calculate thumbprint
 -  pubExponent64="$(printf "%06x" "$(openssl rsa -in "${PRIVATE_KEY}" -noout -text | grep publicExponent | head -1 | cut -d' ' -f2)" | hex2bin | urlbase64)"
 -  pubMod64="$(printf '%s' "$(openssl rsa -in "${PRIVATE_KEY}" -noout -modulus | cut -d'=' -f2)" | hex2bin | urlbase64)"
 +  pubExponent64="$(openssl rsa -in "${PRIVATE_KEY}" -noout -text | grep publicExponent | grep -oE "0x[a-f0-9]+" | cut -d'x' -f2 | hex2bin | urlbase64)"
 +  pubMod64="$(openssl rsa -in "${PRIVATE_KEY}" -noout -modulus | cut -d'=' -f2 | hex2bin | urlbase64)"
  
-   thumbprint="$(printf '%s' '{"e":"'"${pubExponent64}"'","kty":"RSA","n":"'"${pubMod64}"'"}' | openssl sha -sha256 -binary | urlbase64)"
+   thumbprint="$(printf '{"e":"%s","kty":"RSA","n":"%s"}' "${pubExponent64}" "${pubMod64}" | openssl sha -sha256 -binary | urlbase64)"
  
    # If we generated a new private key in the step above we have to register it with the acme-server
    if [[ "${register}" = "1" ]]; then