Class KeyDerivationUtils

java.lang.Object
io.getlime.security.powerauth.crypto.lib.util.KeyDerivationUtils

public class KeyDerivationUtils extends Object
The KeyDerivationUtils class provides additional key derivation functionality defined for PowerAuth protocol.
  • Constructor Details

    • KeyDerivationUtils

      public KeyDerivationUtils()
  • Method Details

    • deriveIvForStatusBlobEncryption

      public byte[] deriveIvForStatusBlobEncryption(byte[] challenge, byte[] nonce, SecretKey transportKey) throws GenericCryptoException, CryptoProviderException, InvalidKeyException
      Derive Initialization Vector for AES-CBC cipher used for an activation status blob encryption and decryption. The function also supports older protocol versions (V2, V3), where IV was hard-set to array of zero bytes. In this case, both challenge and nonce parameters must be null.

      Note that non-zero IV was introduced in the protocol version 3.1

      Parameters:
      challenge - Cryptographic challenge received from the client, or generated in the client.
      nonce - Cryptographic nonce received from the server, or generated in the server.
      transportKey - Transport key.
      Returns:
      Initialization vector, or zero filled IV when both, challenge and nonce parameters are null.
      Throws:
      GenericCryptoException - In case that key derivation fails or you provided invalid challenge or nonce.
      CryptoProviderException - In case cryptography provider is incorrectly initialized.
      InvalidKeyException - In case that transport key is not valid.