5. Create the Signature

Signature is the signed String created at the previous step

Sign with RSA (rsa-sha256) algorithm the previously created String with your private key, using Base64 as output.

(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: SHA-256=ZML76UQPYzw5yDTmhySnU1S8nmqGde/jhqOG5rpfVSI=
signature="C5yynRxJQG2VNdsH8yuGwgribKt1yzym8lYvTAwxFmjEf7akYgLeIGOkdZo5vE/oB7O7+kNgqHxPp9OKrs0XxGTBNNAOBPd0ELsptjuscWtF5dq/S4e8RjQvUcStJ6YOpwV/KyHwE1ovA1otrLpbxuUfqmNES65lRtYq6uuGinCJ+4mYnwrg9c6vuIJ/1b8VKi27PNpcJl4mwPg3hJ071T7Z2iolQRxDPN1ujQdKtUgudOIVLXiqQCPQKEaQQRvXkmh9fBH71fOsTPjvOP3q0XJp7tDPQF1K6MbF0RA6RehbuJ5nyBAOMWrk9r/+XrgC5zN3QmOtvrwmH2ko3du64A=="

🚧

Do not encrypt but sign

Please note that the String must be signed, not encrypted

Code sample 3/4

# In this example private key is storend in "private.pem" file

BODY="{\n  \"flow\": \"MATCH_CODE\",\n  \"amount_unit\": 100,\n  \"currency\": \"EUR\"\n}"

DIGEST="SHA-256="$(echo -e "$BODY\c" | openssl dgst -sha256 -binary | base64)

STRING="(request-target): post /wally-services/protocol/tests/signature\nhost: staging.authservices.satispay.com\ndate: Mon, 18 Mar 2019 15:10:24 +0000\ndigest: $DIGEST"

SIGNATURE=$(echo -e "$STRING\c" | openssl dgst -sign private.pem -sha256 -binary | base64)
$privateKey = "Your RSA Private Key";

$body = "{
  \"flow\": \"MATCH_CODE\",
  \"amount_unit\": 100,
  \"currency\": \"EUR\"
}";

$digest = "SHA-256=".base64_encode(hash("sha256", $body, true));

$string = "(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: $digest";

openssl_sign($string, $signatureRaw, $privateKey, OPENSSL_ALGO_SHA256);
$signature = base64_encode($signatureRaw);
const crypto = require('crypto')

const privateKey = 'Your RSA Private Key'

const body = `{
  "flow": "MATCH_CODE",
  "amount_unit": 100,
  "currency": "EUR"
}`

const digest = `SHA-256=`.concat(crypto.createHash('sha256').update(body).digest('base64'))

const string = `(request-target): post /wally-services/protocol/tests/signature
host: staging.authservices.satispay.com
date: Mon, 18 Mar 2019 15:10:24 +0000
digest: ${digest}`

const signature = crypto.createSign('RSA-SHA256').update(string).sign(privateKey, 'base64')

Signature checker

Tool that allow to check the Signature created. Output must be the same.