Class AesGcmTotpSecretCipher
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.keys.AesGcmTotpSecretCipher
- All Implemented Interfaces:
TotpSecretCipher
TotpSecretCipher that encrypts TOTP secrets with AES-256 in GCM mode. Its key is derived from the
key-encryption passphrase with a salt of its own (PurposeKeyDerivation, purpose "totp-secret"), so it
never shares the key that protects the signing keys. Each encryption uses a random initialisation vector, which is
stored in front of the cipher text.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAesGcmTotpSecretCipher(KeyEncryptionProperties properties, PurposeKeyDerivation derivation) Derives the encryption key. -
Method Summary
-
Field Details
-
PURPOSE
Label of the purpose the key is derived for.- See Also:
-
encryptor
private final org.springframework.security.crypto.encrypt.BytesEncryptor encryptorThe encryptor derived from the passphrase and the salt of this purpose.
-
-
Constructor Details
-
AesGcmTotpSecretCipher
Derives the encryption key.- Parameters:
properties- passphrase of the key-encryption secret.derivation- derives the salt of this purpose from the configured salt.
-
-
Method Details
-
encrypt
public byte[] encrypt(byte[] secret) - Specified by:
encryptin interfaceTotpSecretCipher
-
decrypt
public byte[] decrypt(byte[] encrypted) - Specified by:
decryptin interfaceTotpSecretCipher
-