Created
November 13, 2016 16:15
-
-
Save mhoran/78f72c50f0e649fdf27cceabe00a3ab3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
keyauth="string-from-acme-client" | |
_sed() { | |
if [[ "${OSTYPE}" = "Linux" ]]; then | |
sed -r "${@}" | |
else | |
sed -E "${@}" | |
fi | |
} | |
urlbase64() { | |
# urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_' | |
openssl base64 -e | tr -d '\n\r' | _sed -e 's:=*$::g' -e 'y:+/:-_:' | |
} | |
keyauth_hook="$(printf '%s' "${keyauth}" | openssl dgst -sha256 -binary | urlbase64)" | |
echo $keyauth_hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment