Authentication Open API
To ensure secure and reliable communication between your system and DANA's Open API, you need to use of Asymmetric Signature Authentication. This method leverages cryptographic keys to verify the identity of the sender and protect data integrity during transactions.
Overview
In the asymmetric signature scheme:
- Private Key: Used by you (the merchant) to digitally sign API requests.
- Public Key: Shared with DANA to verify the authenticity of your requests.
By signing your request data with your private key, you provide a secure proof that the request originates from an authorized source. This process is critical to meeting the regulatory standards.
DANA Public Key
To obtain Production DANA Public Key, please contact the DANA integration team through our Discord channel .
Using the Credential
You will receive two credentials: a Private Key and a Public Key.
The Private Key is used to authenticate and communicate securely with DANA. Keep this key confidential and do not share it. The Public Key must be shared with DANA by uploading it through the Merchant Portal during form submission. After successful submission, you will receive other credentials, including Merchant ID, Client ID, and Client Secret.
Asymmetric Digital Signatures (signature)
DANA's Open APIs require a specific signature string to be generated for a field called signature. This signature will be validated by DANA using your public key to confirm the authenticity of the request.
Validating Signatures
Here's a guideline for validating a digital signature in API requests. Follow these steps to ensure the authenticity and integrity of the request.
The digital signature is included in the HTTP header under the key signature.
signature: iSkd8HPpdeeQSnq5lSRM46l8w/C4ZhNq7ordOv2dfDC0A0rGWxqz+9j864gcuVhu0tgTHJUuV9k5wsluig/sJ4W5Yy1EZPzbpeeUwFxSK0
Decrypt the signature using public key which is pair with private key that used to generate the signature.
- Use SHA-256 hashing combined with RSA-2048 encryption to verify the signature.
- Compare the signature from the
signatureheader with the signature generated from the composed string using the public key of the API sender.
- If the verification is successful (the signature matches), proceed with processing the request.
- If the verification fails, reject the request.
Code Example
Below are example codes that does all the authentication-related functions for each programming language:
| Programming Language | Sample Code |
|---|---|
| PHP | https://www.jdoodle.com/ga/RN7hZw97sGEjKgDy6wvXSQ%3D%3D |
| Java (jdk8) | https://www.jdoodle.com/ga/W7kM1d0IOg%2BtGlmHMegbRw%3D%3D |