Authentication.

Algorithm.

Authentication is done by supplying your public API key, a request token and a request signature.

"

Example.

On the test environment, you can test the hash algorithm on: https://dev.lecredit.nl/clientapi/dev1/api/v1/MyHashCheck (this function is not accessible on production because it's intended for helping you check your authentication during development.).

This is a [POST] call. You supply your private key in the body. No headers need to be supplied. An example of a data body:
        {
            "privateKey": "B141C66128F7818CC1DE5E6BF88378031F8792AFBD27C344B4ECFDE5A63FFE5"
        }
    

The result shows the hash key (result.sha256) and how it’s constructed (result.description):

        {
          "description": "SHA256(/api/v1/MyHashCheck20230707viBjiJ0R9IY8y5AfB1FYaAXRiENahPKaDFgF7rGa+vs=B141C66128F7818CC1DE5E6BF88378031F8792AFBD27C344B4ECFDE5A63FFE5) Note: use ASCII encoding.",
          "path": "/api/v1/MyHashCheck",
          "token": "20230707viBjiJ0R9IY8y5AfB1FYaAXRiENahPKaDFgF7rGa+vs=",
          "privatekey": "B141C66128F7818CC1DE5E6BF88378031F8792AFBD27C344B4ECFDE5A63FFE5",
          "sha256": "9E5B47DBD31F8DF8CDA9A143CC6C33755C4660EFC924C938DDA880AEFED900B0"
        }
    

For ease of use, it's note required to supply a random token in the call; in this case, the token is generated randomly by the hash-check. Note that the token starts with the current date (yyyyMMdd), followed by random characters. Note that the resulting sha256 is always returned in hex.

An example of how to construct the sha256 hex code:

    string SHA256(string input) {"
        System.Security.Cryptography.SHA256 sha = System.Security.Cryptography.SHA256.Create();"
        var ae = new System.Text.ASCIIEncoding()"
        byte[] hash = sha.ComputeHash(ae.GetBytes(p_strInput));"
        var sb = new System.Text.StringBuilder(hash.Length * 2);"
        int ndx;"
        for (ndx = 0; ndx < hash.Length; ndx++) {"
            sb.Append(hash[ndx].ToString(\"X2\"));"
        }"
        return sb.ToString().ToUpper();"
    }"