Documentation Index
Fetch the complete documentation index at: https://mintlify.com/theresasogunle/Fintech-flutterwave-Java-Library/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheEncryption class provides methods to securely encrypt payment parameters before sending them to Flutterwave’s API. This ensures that sensitive payment information is protected during transmission.
Class: Encryption
Methods
encryptParameters()
Encrypts payment parameters using your configured API keys.A JSON object containing the payment parameters to encrypt
String - The encrypted payload as a Base64-encoded string
Description: This method takes a JSON object containing payment parameters, adds the public key, and encrypts the entire payload using Triple DES encryption. The encrypted string can then be safely transmitted to Flutterwave’s API.
Example
encryptParametersPreAuth()
Encrypts parameters using hardcoded test credentials for pre-authorization testing.A JSON object containing the parameters to encrypt
String - The encrypted payload using test credentials
Description: This method is similar to encryptParameters() but uses hardcoded test credentials. It’s primarily used for development and testing purposes.
Static Utility Methods
The following static methods are used internally but can also be called directly for custom encryption needs.getKey()
Generates an encryption key from your secret key.Your Flutterwave secret key (e.g., “FLWSECK-xxxxx”)
String - A 24-character encryption key derived from the secret key
Description: This method generates a Triple DES encryption key by hashing your secret key using MD5 and combining it with portions of the original key. The resulting key is used for encrypting payment data.
Example
encryptData()
Encrypts a message using Triple DES encryption.The plaintext message to encrypt
The 24-character encryption key
String - The encrypted message as a Base64-encoded string
Description: This method encrypts a string using the Triple DES (3DES) algorithm in ECB mode with PKCS5 padding. The encrypted output is Base64-encoded for safe transmission.
Example
toHexStr()
Converts a byte array to a hexadecimal string.The byte array to convert
String - Hexadecimal representation of the byte array
Description: This utility method converts a byte array to its hexadecimal string representation. It’s used internally during the key generation process.
Example
Encryption Algorithm Details
The encryption uses:
- Algorithm: Triple DES (3DES)
- Mode: ECB (Electronic Codebook)
- Padding: PKCS5
- Key Length: 24 bytes
- Output Encoding: Base64