Signature Algorithm
The Signature Algorithm page provides developers with the necessary information to securely sign their API requests to the UCanPay system. This ensures that the data integrity is maintained, and each request is verified to be from an authenticated source.
Purpose
Signing API requests ensures that the payload has not been altered in transit, and it confirms the identity of the requester. It is a critical component of secure communication with UCanPay APIs.
Algorithm Used
UCanPay uses RSA encryption for signing requests. Below are the steps to generate a signature with the RSA algorithm.
Steps to Generate a Signature
Collect the Parameters: Gather all the required parameters for the API call.
Sort Parameters: Sort all the parameters alphabetically by their keys.
Concatenate Parameters: Create a concatenated string of the sorted parameters in the form of
key=valuepairs separated by&.Create String to Sign: Append the API endpoint URI to the concatenated parameters string.
Generate Signature: Sign the string using your private RSA key.
Example
Replace privateKeyStr with your actual private key string.
Troubleshooting
Invalid Signature: Ensure the string to sign is correctly constructed and all parameters are included.
Signature Mismatch: Verify that the private key corresponds to the public key registered with UCanPay.
Algorithm Error: Confirm that SHA256withRSA is the algorithm being used, as this is what UCanPay expects.
For any further issues with the signature algorithm, contact UCanPay support.