Class AesGcmTotpSecretCipher

java.lang.Object
com.irurueta.authserver.authorization.infrastructure.keys.AesGcmTotpSecretCipher
All Implemented Interfaces:
TotpSecretCipher

@Component public class AesGcmTotpSecretCipher extends Object implements 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 Details

    • PURPOSE

      public static final String PURPOSE
      Label of the purpose the key is derived for.
      See Also:
    • encryptor

      private final org.springframework.security.crypto.encrypt.BytesEncryptor encryptor
      The encryptor derived from the passphrase and the salt of this purpose.
  • Constructor Details

    • AesGcmTotpSecretCipher

      public AesGcmTotpSecretCipher(KeyEncryptionProperties properties, PurposeKeyDerivation derivation)
      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