Key generation
RSA key pairs are fundamental to the Phoenix authentication system. The public key is shared with Phoenix during registration, while the private key is kept secure and used to decrypt sensitive data.How it works
The middleware generates 2048-bit RSA key pairs using Java’s standard cryptography libraries:Generate keys
CryptoUtils implementation
The key generation is implemented in theCryptoUtils class:
Key usage
Once generated, the keys are used throughout the authentication process:Public key
- Sent to Phoenix during client registration
- Used by Phoenix to encrypt data sent to your application
- Safe to share
Private key
- Decrypts session keys from Phoenix
- Signs authentication headers
- Decrypts client secret during registration
- Must be kept secure
Rotating keys
To rotate your keys:Key rotation should be performed periodically as part of your security maintenance schedule.
Using existing keys
If you already have RSA keys from another system, you can use them instead of generating new ones:- Convert your keys to Base64-encoded DER format
- Update
application.propertieswith the Base64 strings - Ensure the keys are 2048-bit RSA
Security considerations
Key security best practices:
- Store private keys in secure key management systems (e.g., AWS KMS, HashiCorp Vault)
- Use environment variables or secrets management in production
- Never log or display private keys
- Restrict file system permissions on
application.properties - Rotate keys every 90 days or per your security policy
Next steps
Register client
Use your keys to register with Phoenix
Configuration
Learn about all configuration options