Browse Source

Testing HMAC

pull/3392/head
Alexander Kulumbeg 4 years ago
committed by GitHub
parent
commit
dadc70630b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dnsapi/dns_websupport.sh

4
dnsapi/dns_websupport.sh

@ -156,11 +156,11 @@ _ws_rest() {
_debug2 api_key "$WS_ApiKey" _debug2 api_key "$WS_ApiKey"
_debug2 api_secret "$WS_ApiSecret" _debug2 api_secret "$WS_ApiSecret"
timestamp="$(date +%s)"
timestamp=$(_time)
datez=$(date -u -r "$timestamp" +%Y-%m-%dT%H:%M:%S%z 2>/dev/null || date -u -d@"$timestamp" +%Y-%m-%dT%H:%M:%S%z) datez=$(date -u -r "$timestamp" +%Y-%m-%dT%H:%M:%S%z 2>/dev/null || date -u -d@"$timestamp" +%Y-%m-%dT%H:%M:%S%z)
canonical_request="${me} ${pa} ${timestamp}" canonical_request="${me} ${pa} ${timestamp}"
alg="sha1" alg="sha1"
signature_hash=$( (printf "%s" "$canonical_request" | ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -mac HMAC -macopt "key:$WS_ApiSecret" 2>/dev/null || printf "%s" "$canonical_request" | ${ACME_OPENSSL_BIN:-openssl} dgst -"$alg" -hmac "$(printf "%s" "$WS_ApiSecret" | _h2b)") | cut -d = -f 2 | tr -d ' ')
signature_hash=$( (printf "%s" "$canonical_request" | _hmac "$alg" "$WS_ApiSecret" 2>/dev/null || printf "%s" "$canonical_request" | _hmac "$alg" "$WS_ApiSecret")
basicauth="$(printf "%s:%s" "$WS_ApiKey" "$signature_hash" | _base64)" basicauth="$(printf "%s:%s" "$WS_ApiKey" "$signature_hash" | _base64)"
_debug2 method "$me" _debug2 method "$me"

Loading…
Cancel
Save