Key Pairs & Signature
Learn how CakeAuth securely working with a ton of tokens
Overview
By default, CakeAuth implements a robust security model using asymmetric cryptography with primarily RS256
(RSA Signature with SHA-256
) algorithm for signing and verifying each tokens.
This documentation explains the key management system and signature process that ensures secure token handling across different environments.
Environment-Specific Keys
Yes, you read it correctly. CakeAuth issues a unique keys for each of your environment. Each user environment in CakeAuth is provisioned with its own dedicated set of cryptographic key-pairs.
-
Private Signing Key
- Used for signing new tokens
- Never exposed outside the CakeAuth system
- Stored in secure, encrypted storage (even we can't read the actual values)
- Critical for maintaining token authenticity
-
Public Verification Key
- Used by client applications to verify token signatures
- Safely shareable with client applications
- Available through the JWKS endpoint
- Enables decentralized token verification
Reading my Public Keys
You can geread keys for your environment on your environment host. For example:
It will returns in the JSON Web Key Sets (JWKS) json format. For example:
Please note that the endpoint will only returns the public key!
Convert it back to Public Key value
There are a ton of ways you can convert the JWKS object to its public key value. For example, in js environment, you can use jwk-to-pem
library:
How we generate & manage keys
Key Generation
For every enviornment, we generate sets of key-pairs dedicated for each environment (both Development Environment
or Production Environment
).
We are using AWS KMS to securely generate and encrypt every keys that each environment needs. We use root-keys mechanism to encrypt your encryption keys, which in turn sign your tokens securely too.
So in short, we don't even know the actual key values of each private keys. Achieving upmost security at our stage possible.
Key Storage
Keys are stored securely with the following procedures:
- Encrypted at rest and transit
- Keys and other secrets are securely managed with Key Management Services
- Access controlled through fine-grained permissions
- Regular backup procedures
- Internal audit logging for all key operations
Last updated on