Versioned Crypto Provider
class VersionedCryptoProvider(context: Context, baseAlias: String = "kioskops_versioned", rotationPolicy: KeyRotationPolicy = KeyRotationPolicy.default(), clock: () -> Long = { System.currentTimeMillis() }) : CryptoProvider
Crypto provider with key versioning and rotation support.
Manages multiple key versions to support:
Key rotation without data loss
Backward-compatible decryption of old data
Gradual migration to new keys
Blob format (backward compatible):
[version:1 byte] - Key version (1-255)
[ivLen:1 byte] - IV length (12-32)
[iv:N bytes] - Initialization vector
[ciphertext] - Encrypted data with GCM tagContent copied to clipboard
Constructors
Link copied to clipboard
constructor(context: Context, baseAlias: String = "kioskops_versioned", rotationPolicy: KeyRotationPolicy = KeyRotationPolicy.default(), clock: () -> Long = { System.currentTimeMillis() })
Functions
Link copied to clipboard
Get the current key version.
Link copied to clipboard
Get metadata for all key versions.
Link copied to clipboard
Get metadata for the current key.
Link copied to clipboard
Re-encrypt data with the current key version.
Link copied to clipboard
Rotate to a new key version.
Link copied to clipboard
Check if the current key should be rotated based on policy.