Package org.opensaml.xmlsec.derivation

# Class KeyDerivationSupport

java.lang.Object
org.opensaml.xmlsec.derivation.KeyDerivationSupport

public final class KeyDerivationSupport extends Object
Support key derivation operations.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`KeyDerivationSupport()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`static int`
`getEffectiveKeyLength(String algorithmURI, Integer specifiedKeyLength)`
Get the effective key length based on the specified algorithm URI and the specified key length, if present.
`static String`
`getJCAKeyAlgorithm(String algorithmURI)`
Get the JCA key algorithm which corresponds to the specified algorithm URI.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### KeyDerivationSupport

private KeyDerivationSupport()
Constructor.

## Method Details

### getJCAKeyAlgorithm

@Nonnull public static String getJCAKeyAlgorithm(@Nonnull String algorithmURI) throws KeyDerivationException
Get the JCA key algorithm which corresponds to the specified algorithm URI.

Parameters:
  `algorithmURI` - the algorithm URI with which the derived key will be user
Returns:
  the JCA key algorithm
Throws:
  `KeyDerivationException` - if key algorithm could not be determined

### getEffectiveKeyLength

public static int getEffectiveKeyLength(@Nonnull String algorithmURI, @Nullable Integer specifiedKeyLength) throws KeyDerivationException
Get the effective key length based on the specified algorithm URI and the specified key length, if present.

If the algorithm URI implies a key length and the specified key length is non-null, the lengths must match or an exception will be thrown. If the algorithm URI does not imply a key length and the specified length is null, and exception will be thrown.

Parameters:
  `algorithmURI` - the algorithm URI with which the derived key will be used
  `specifiedKeyLength` - an explicitly specified key length
Returns:
  the effective key length
Throws:
  `KeyDerivationException` - if algorithm and specified key lengths are not consistent