Authentication overview
The Phoenix Java Middleware implements a secure multi-step authentication process using RSA and elliptic curve cryptography to establish secure sessions with the Interswitch Phoenix API.Authentication flow
The complete authentication process consists of three main steps:Generate RSA keys
Create an RSA public-private key pair that will be used for encrypting sensitive data during communication.
Register client
Register your application with the Phoenix API using your credentials and public key. This process issues a new client secret.
Security architecture
The middleware uses a multi-layered security approach:RSA encryption (2048-bit)
Used for:- Client registration
- Encrypting session keys
- Protecting sensitive credentials
CryptoUtils.java using Java’s standard crypto libraries
Elliptic Curve Diffie-Hellman (ECDH)
Used for:- Session key exchange
- Deriving shared secrets
- Securing transaction-level encryption
EllipticCurveUtils.java with Bouncy Castle provider
Signature-based authentication
Every API request includes:- Client ID signature
- Request timestamp
- Request hash
- Authorization headers
AuthUtils.java (AuthController.java:20-24)
Authentication components
AuthController
Exposes three REST endpoints:RegistrationService
Handles key generation and client registration:KeyExchangeService
Manages secure session establishment:Automatic key exchange
The middleware automatically handles key exchange before payment operations. ThePaymentsService checks for valid session keys and performs key exchange when needed.
You don’t need to manually call key exchange before each payment—the middleware handles this automatically.
Response codes
Authentication operations return standard Phoenix response codes:| Code | Meaning | Action |
|---|---|---|
00 | Approved | Authentication successful |
06 | Error | Check credentials and retry |
96 | System error | Contact support |
Best practices
Secure key storage
Store private keys securely and never commit them to version control
Rotate credentials
Update client secret after registration and rotate keys periodically
Daily key exchange
Perform key exchange at application startup or daily
Monitor sessions
Track session expiry and re-authenticate when needed
Next steps
Generate keys
Create your RSA key pair
Register client
Complete the registration process
Key exchange
Establish secure sessions
API reference
View authentication endpoints