Skip to main content
This document describes the steps required to encrypt sensitive payload data such as passwords before sending it to the FinCode API. The encryption ensures data confidentiality during transmission. We use RSA public key encryption with OAEP padding (SHA-256). You will be provided with a Base64-encoded public key from your dashboard. Using this key, you must encrypt sensitive fields before sending them in your payload.

Steps to Encrypt Payload

  1. Obtain the RSA public key from your dashboard (Base64 encoded)
  2. Convert the public key from Base64 into an RSA PublicKey object
  3. Initialize an RSA cipher using OAEP with SHA-256 padding
  4. Encrypt the plaintext payload (e.g., password) using UTF-8 encoding
  5. Base64-encode the encrypted output
  6. Send the encrypted value in your API request payload

Code Examples

Java

JavaScript (Node.js)

Python

Required package: pip install cryptography

C# (.NET)

API Request Example

Once you have the encrypted value, include it in your API request:
Using cURL:

Important Notes

  1. Payload Size Limit: RSA encryption has a maximum payload size based on key length. For a 2048-bit key, the maximum is approximately 190 bytes. Only encrypt individual sensitive fields, not entire request bodies.
  2. Public Key Only: Never share your private key. Only the public key should be used for encryption on your side.
  3. Key Rotation: When you rotate your keys on the dashboard, update your integration with the new public key immediately.
  4. Encoding: Always use UTF-8 encoding for the plaintext before encryption.
  5. Transport Security: While encryption protects the data in the payload, always use HTTPS for all API communications.

Troubleshooting


Need Help?

If you encounter any issues with payload encryption, please contact our support team or refer to the Authentication documentation for more details.