# hmacSHA512 verfügbar?

**URL:** <https://forum.synesty.com/t/hmacsha512-verfuegbar/1714>\
**Category:** Fragen und Antworten\
**Created:** [6. Juli 2020 um 08:52 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714 "2020-07-06T08:52:31Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [6. Juli 2020 um 08:52 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/1 "2020-07-06T08:52:31Z")

</div>

Hallo Synesty Team und Experten,

für einen API Call zum Payment Gateway benötigen wir einen hmacSHA512 Auth Header. Steht diese überhaupt zur Verfügung? Laut Transformy Doku gibt es nur hmacSHA256 [https://apps.synesty.com/transformy/de-de?action=showTemplateFunctionDocumentation#hmacSHA256](https://apps.synesty.com/transformy/de-de?action=showTemplateFunctionDocumentation#hmacSHA256)

---

<div class="post-metadata">

**Author:** ![synestysupport](https://forum.synesty.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@synestysupport](https://forum.synesty.com/u/synestysupport)\
**Post date:** [6. Juli 2020 um 10:09 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/2 "2020-07-06T10:09:10Z")

</div>

Hallo,

wir werden uns das anschauen und versuchen es einzubauen. Wir geben nochmal bescheid falls es nutzbar ist.

Viele Grüße,

Der Synesty Support

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [6. Juli 2020 um 13:11 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/3 "2020-07-06T13:11:04Z")

</div>

Hi Synesty Support,

es wäre extrem wichtig für uns, dieses Feature zu haben, andernfalls haben wir einen echten Showstopper für wichtige Teile des Projektes und müssten uns nach Alternativen zu Synesty umschauen.

---

<div class="post-metadata">

**Author:** ![synestysupport](https://forum.synesty.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@synestysupport](https://forum.synesty.com/u/synestysupport)\
**Post date:** [6. Juli 2020 um 13:52 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/4 "2020-07-06T13:52:46Z")

</div>

Hallo,

Sie können das Feature nun nutzen.

[https://apps.synesty.com/transformy?action=showTemplateFunctionDocumentation&target=functions#hmacSHA512](https://apps.synesty.com/transformy?action=showTemplateFunctionDocumentation&target=functions#hmacSHA512)

Viele Grüße,

Der Synesty-Support

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [6. Juli 2020 um 13:55 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/5 "2020-07-06T13:55:16Z")

</div>

Super! Dann werde ich das ASAP testen :-)

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [8. Juli 2020 um 09:21 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/6 "2020-07-08T09:21:18Z")

</div>

Hallo Synesty Team,

evtl. gibt es ein Problem mit dieser Funktion oder ich mache etwas falsch...

Hier ein Beispiel des Herstellers für PHP

```
$key = base64_decode("someBase64endcodedData=");
$timestamp = time(); //Unix Timestamp in Seconds
$hash_string = "1|26624|$timestamp|POST|/api/charge-attempt/search?spaceId=1234&id=9876543";
echo base64_encode(hash_hmac("sha512",$hash_string,$key, true));
```

In meinem Step verabeite ich die Daten wie folgt:

```
${hmacSHA512(result['hashstring']!, decodeBase64(meta.authkey!), "base64")!}
```

result['hashstring'] entspricht dem Format aus dem PHP Beispiel.

Wenn ich nun den in PHP und in Synesty erstellten bas64 Hash vergleiche, dann bekomme ich unterschiedliche Ergebnisse:

```
// PHP
Z94ujnH0JH/yBgvFH5j2Grf0XGRTJMO6leOGOSGp5/tBW25M2Gvf0UM8zujzSVfIfjBzGjUjajoPXWVbh6dTOQ==
// Synesty
bGFozDt9hrXyz+p8c39QG2pB2T2GuNnIMbsh8HWxusKl28oTfq2fG3M2kXI6pHabiQOhfTvCvJ/feTNUNq83zw==
```

Key, Timestamp und Hashstring sind in beiden Umgebungen identisch

---

<div class="post-metadata">

**Author:** ![synestysupport](https://forum.synesty.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@synestysupport](https://forum.synesty.com/u/synestysupport)\
**Post date:** [8. Juli 2020 um 10:38 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/7 "2020-07-08T10:38:59Z")

</div>

Hallo,

unter [https://www.freeformatter.com/hmac-generator.html](https://www.freeformatter.com/hmac-generator.html) können Sie einmal das ganze teste. Bei gleichem Hash sollte auch das selbe rauskommen. Eventuell hat sich in der Zeit zwischen den beiden Tests, der timestamp geändert.

Viele Grüße,

Der Synesty-Support

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [8. Juli 2020 um 11:19 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/8 "2020-07-08T11:19:19Z")

</div>

Hallo Support,

ich vermute, das Problem liegt in der Funktion decodeBase64()

Die Daten des Base64 Strings sind keine reinen Textdaten und können nicht in UTF-8 oder ISO-8859-1 dargestellt werden. Wenn ich in PHP einen MD5 Hash der decodierten Daten erstelle und in Synesty, dann ist eindeutig ein Unterschied erkennbar:

```
// PHP
md5(base64_decode($key)) => 41181cbd6cef51455df398eb13646895

// Synesty
${md5(decodeBase64(meta.wallee_authkey!))} => c41bad8f43db9ecd4bedefa50aa2dbeb
```

Mit dem in PHP dekodierten Key kann ich mich übrigens auch an der API anmelden, sprich der PHP-Referenzcode funktioniert.

---

<div class="post-metadata">

**Author:** ![synestysupport](https://forum.synesty.com/letter_avatar_proxy/v4/letter/s/2acd7d/32.png) [@synestysupport](https://forum.synesty.com/u/synestysupport)\
**Post date:** [8. Juli 2020 um 14:57 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/9 "2020-07-08T14:57:51Z")

</div>

Hi,

ist es Ihnen eventuell möglich uns einmal die Rohdaten zukommen zu lassen? Am besten per Ticket. Anhand von konkreten Beispielen gestaltet sich die Fehlersuche deutlich einfacher.

Viele Grüße,

Der Synesty Support

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [8. Juli 2020 um 15:15 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/10 "2020-07-08T15:15:46Z")

</div>

Siehe Ticket 20472

---

<div class="post-metadata">

**Author:** ![oceanus-nk](https://forum.synesty.com/letter_avatar_proxy/v4/letter/o/e99b99/32.png) [@oceanus-nk](https://forum.synesty.com/u/oceanus-nk)\
**Post date:** [5. Oktober 2021 um 16:35 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/11 "2021-10-05T16:35:22Z")

</div>

Hallo

Wir versuchen auch gerade die Wallee API abzurufen und sind an der gleichen Stelle gelandet. Habt Ihr damals eine Lösung gefunden, könntet Ihr diese eventuell hier ins Forum posten?

Danke

---

<div class="post-metadata">

**Author:** ![synesty-Torsten](https://forum.synesty.com/user_avatar/forum.synesty.com/synesty-torsten/32/114_2.png) [@synesty-Torsten](https://forum.synesty.com/u/synesty-Torsten)\
**Post date:** [6. Oktober 2021 um 07:01 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/12 "2021-10-06T07:01:22Z")

</div>

Hallo @oceanus-nk,

das Problem lag damals beim Zeichensatz des dekodierten Base64 Secrets.  
Man kann den Zeichensatz optional bei der Template Funktion [decodeBase64](https://apps.synesty.com/transformy?action=showTemplateFunctionDocumentation&target=functions#hmacSHA512) und [hmacSHA512](https://apps.synesty.com/transformy?action=showTemplateFunctionDocumentation&target=functions#hmacSHA512) angeben.

Ein Beispiel finden sie hier:

> **[Mapping - Transformy](https://apps.synesty.com/transformy?action=executeStep&mode=example&mappingDefinitionName=d44ad565bb72479cb3c07e8fb1e2b448)**

Ich hoffe das hilft weiter.

VG Torsten

---

<div class="post-metadata">

**Author:** ![davidadamswmhde](https://forum.synesty.com/letter_avatar_proxy/v4/letter/d/a5b964/32.png) [@davidadamswmhde](https://forum.synesty.com/u/davidadamswmhde)\
**Post date:** [6. Oktober 2021 um 08:51 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/13 "2021-10-06T08:51:02Z")

</div>

@oceanus-nk

Ich stelle hier mal das JSON der Steps rein, welche wir zur Abfrage der Transaktionsfos von der Wallee API nutzen, aber bitte daran denken, dass der API Endpoint und Request Body jeweils individuell anzupassen sind:

Spreadsheet Mapper um die Daten für den API Zugriff aufzubereiten

```auto
{
  "executorflowuniqename" : "",
  "description" : "",
  "condition" : "",
  "rank" : 530,
  "active" : true,
  "permaId" : 47,
  "stepprovider" : "SpreadsheetMapper@com.synesty.stepesty.plugin.transformycore",
  "stepproviderversion" : "1.0",
  "stepProperty" : [ {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "false",
    "key" : "cacheMode",
    "type" : "IN"
  }, {
    "datatype" : "STRINGLIST",
    "contextkey" : null,
    "value" : "",
    "key" : "disableWarnings",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "{\"groupByColumn\":\"\",\"groupMode\":\"\",\"sortByCol\":\"\",\"sortDir\":\"ASC\",\"colDefs\":[{\"colDef\":{\"name\":\"transaction_id\",\"sourceColName\":\"transaction_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"order_id\",\"sourceColName\":\"order_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"kind\",\"sourceColName\":\"kind\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"gateway\",\"sourceColName\":\"gateway\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"status\",\"sourceColName\":\"status\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"message\",\"sourceColName\":\"message\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"created_at\",\"sourceColName\":\"created_at\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"test\",\"sourceColName\":\"test\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"authorization\",\"sourceColName\":\"authorization\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"location_id\",\"sourceColName\":\"location_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"user_id\",\"sourceColName\":\"user_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"parent_id\",\"sourceColName\":\"parent_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"processed_at\",\"sourceColName\":\"processed_at\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"device_id\",\"sourceColName\":\"device_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"receipt\",\"sourceColName\":\"receipt\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"error_code\",\"sourceColName\":\"error_code\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"source_name\",\"sourceColName\":\"source_name\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"amount\",\"sourceColName\":\"amount\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"currency\",\"sourceColName\":\"currency\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"admin_graphql_api_id\",\"sourceColName\":\"admin_graphql_api_id\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"timestamp\",\"sourceColName\":\"\",\"value\":\"${(.now?long / 1000)?round}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"path\",\"sourceColName\":\"\",\"value\":\"/api/charge-attempt/search?spaceId=${meta.wallee_spaceid!}&id=${authorization!}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"hashstring\",\"sourceColName\":\"\",\"value\":\"${meta.xmacversion!}|${meta.wallee_accountid!}|${result['timestamp']!}|POST|${result['path']!}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"decoded_key_md5\",\"sourceColName\":\"\",\"value\":\"${md5(decodeBase64(meta.wallee_authkey!))}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"hmac512_alt\",\"sourceColName\":\"\",\"value\":\"${hmacSHA512(result['hashstring']!, decodeBase64(meta.wallee_authkey!), \\\"base64\\\")!}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"hmac512_neu\",\"sourceColName\":\"\",\"value\":\"${hmacSHA512(result['hashstring']!, decodeBase64(meta.wallee_authkey!,\\\"ISO-8859-1\\\"), \\\"base64\\\", \\\"\\\", \\\"ISO-8859-1\\\", \\\"\\\")!}\",\"commentField\":\"\",\"colFunctions\":[]}},{\"colDef\":{\"name\":\"api_auth_header\",\"sourceColName\":\"\",\"value\":\"x-mac-version=${meta.xmacversion!}\\nx-mac-userid=${meta.wallee_accountid!}\\nx-mac-timestamp=${result['timestamp']!}\\nx-mac-value=${result['hmac512_neu']!}\",\"commentField\":\"\",\"colFunctions\":[{\"stringColFunction\":{\"trimMode\":\"SBENL\"}}]}}]}",
    "key" : "mappingdefinition",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "mappingMode",
    "type" : "IN"
  }, {
    "datatype" : "SPREADSHEET",
    "contextkey" : "output@SpreadsheetFilter_48",
    "value" : "",
    "key" : "source",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "targetSchemaName",
    "type" : "IN"
  } ],
  "steptype" : "DEFAULT",
  "uiColor" : null,
  "name" : "Daten aggregieren für Wallee API"
}

```

SpreadsheetURLDownload Step (Auswertung dann mittels JSON Reader Step)

```auto
{
  "executorflowuniqename" : "",
  "description" : "",
  "condition" : "",
  "rank" : 540,
  "active" : true,
  "permaId" : 49,
  "stepprovider" : "SpreadsheetUrlDownload@com.asolida.delivor.plugin.steps.httpurldownloadimpl",
  "stepproviderversion" : "1.0",
  "stepProperty" : [ {
    "datatype" : "ACCOUNT",
    "contextkey" : null,
    "value" : "",
    "key" : "account",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "1",
    "key" : "batchSize",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "application/json; charset=UTF-8",
    "key" : "bodyContentType",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "UTF-8",
    "key" : "encoding",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "errorStatusCodes",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "filename",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "fileNameInList",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "fileParameterName",
    "type" : "IN"
  }, {
    "datatype" : "FILELIST",
    "contextkey" : null,
    "value" : "",
    "key" : "filesToUpload",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "application/json; charset=UTF-8",
    "key" : "headerContentType",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "${meta.wallee_api_host!}${path!}",
    "key" : "host",
    "type" : "IN"
  }, {
    "datatype" : "SPREADSHEET",
    "contextkey" : "spreadsheet@SpreadsheetMapper_47",
    "value" : "",
    "key" : "input",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "10000",
    "key" : "limit",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "POST",
    "key" : "method",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "10000",
    "key" : "numErrorsToStopFlow",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "addResponseContentColumn",
    "key" : "outputMode",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "transaction_id,order_id,kind,gateway,status,message,created_at,test,authorization,location_id,user_id,parent_id,processed_at,device_id,receipt,error_code,source_name,amount,currency,admin_graphql_api_id,timestamp,path,hashstring,hashstring_to_byte,hmac512,api_auth_header",
    "key" : "outputSourceColumns",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "password",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "4",
    "key" : "rateLimitPerSecond",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "{\r\n \"filter\": {\r\n \"children\": [\r\n {\r\n \"fieldName\": \"state\",\r\n \"operator\": \"EQUALS\",\r\n \"type\": \"LEAF\",\r\n \"value\": \"SUCCESSFUL\"\r\n },\r\n {\r\n \"fieldName\": \"charge.transaction.id\",\r\n \"operator\": \"EQUALS\",\r\n \"type\": \"LEAF\",\r\n \"value\": \"${authorization!}\"\r\n }\r\n],\r\n \"type\": \"AND\"\r\n }\r\n}",
    "key" : "requestBody",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "x-mac-version=${meta.xmacversion!}\r\nx-mac-userid=${meta.wallee_accountid!}\r\nx-mac-timestamp=${timestamp!}\r\nx-mac-value=${hmac512_neu!}",
    "key" : "requestHeaders",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "false",
    "key" : "sslCertificates",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "60",
    "key" : "timeoutInSeconds",
    "type" : "IN"
  }, {
    "datatype" : "STRING",
    "contextkey" : null,
    "value" : "",
    "key" : "username",
    "type" : "IN"
  } ],
  "steptype" : "BILLABLE",
  "uiColor" : null,
  "name" : "Transaktionsinfos aus Walle herunterladen"
}

```

---

<div class="post-metadata">

**Author:** ![oceanus-nk](https://forum.synesty.com/letter_avatar_proxy/v4/letter/o/e99b99/32.png) [@oceanus-nk](https://forum.synesty.com/u/oceanus-nk)\
**Post date:** [7. Oktober 2021 um 13:34 UTC](https://forum.synesty.com/t/hmacsha512-verfuegbar/1714/14 "2021-10-07T13:34:00Z")

</div>

Ich danke euch beiden sehr, mit den Infos konnten wir Daten über die API abrufen. Das eine war der Zeichensatz, den anderen Fehler konnten wir dank dem Spreadsheet Mapper ausfindig machen und zwar haben wir den Timestamp in Millisekunden statt Sekunden übergeben.

Grüsse
