Package org.opensaml.xmlsec.derivation

# Interface KeyDerivation

All Superinterfaces:
  `KeyAgreementParameter`

All Known Implementing Classes:
  `ConcatKDF`, `PBKDF2`

public interface KeyDerivation extends KeyAgreementParameter
Component which represents a specific key derivation algorithm, and supports deriving a new `SecretKey` via that algorithm.

Sub-types will usually contain additional configurable property inputs to the derivation operation.

## Method Summary

Modifier and Type
Method
Description
`SecretKey`
`derive(byte[] secret, String keyAlgorithm, Integer keyLength)`
Derive a `SecretKey` from the specified secret.
`String`
`getAlgorithm()`
The key derivation algorithm URI.

## Method Details

### getAlgorithm

@Nonnull String getAlgorithm()
The key derivation algorithm URI.

Returns:
  the algorithm

### derive

@Nonnull SecretKey derive(@Nonnull byte[] secret, @Nonnull String keyAlgorithm, @Nullable Integer keyLength) throws KeyDerivationException
Derive a `SecretKey` from the specified secret.

Parameters:
  `secret` - the input secret from which to derive the key.
  `keyAlgorithm` - the algorithm URI for which the derived key will be used
  `keyLength` - the length of the derived key. This may be null if the keyAlgorithm URI implies a key length, for example if the URI represents a `KeyLengthSpecifiedAlgorithm`. However if the URI implies a key length and this parameter value does not match that length, that is an error and and exception will be thrown
Returns:
  the derived key
Throws:
  `KeyDerivationException` - if the key derivation operation is not completed successfully