mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-07-16 01:52:42 +02:00
removed anti_newline helper
This commit is contained in:
+3
-6
@@ -129,13 +129,10 @@ _exiterr() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
anti_newline() {
|
# Encode data as url-safe formatted base64
|
||||||
tr -d '\n\r'
|
|
||||||
}
|
|
||||||
|
|
||||||
urlbase64() {
|
urlbase64() {
|
||||||
# urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_'
|
# urlbase64: base64 encoded string with '+' replaced with '-' and '/' replaced with '_'
|
||||||
openssl base64 -e | anti_newline | sed 's/=*$//g' | tr '+/' '-_'
|
openssl base64 -e | tr -d '\n\r' | sed 's/=*$//g' | tr '+/' '-_'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Convert hex string to binary data
|
# Convert hex string to binary data
|
||||||
@@ -208,7 +205,7 @@ signed_request() {
|
|||||||
payload64="$(printf '%s' "${2}" | urlbase64)"
|
payload64="$(printf '%s' "${2}" | urlbase64)"
|
||||||
|
|
||||||
# Retrieve nonce from acme-server
|
# Retrieve nonce from acme-server
|
||||||
nonce="$(http_request head "${CA}" | grep Replay-Nonce: | awk -F ': ' '{print $2}' | anti_newline)"
|
nonce="$(http_request head "${CA}" | grep Replay-Nonce: | awk -F ': ' '{print $2}' | tr -d '\n\r')"
|
||||||
|
|
||||||
# Build header with just our public key and algorithm information
|
# Build header with just our public key and algorithm information
|
||||||
header='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}}'
|
header='{"alg": "RS256", "jwk": {"e": "'"${pubExponent64}"'", "kty": "RSA", "n": "'"${pubMod64}"'"}}'
|
||||||
|
|||||||
Reference in New Issue
Block a user