Package org.opensaml.xmlsec.derivation
Class KeyDerivationSupport
java.lang.Object
org.opensaml.xmlsec.derivation.KeyDerivationSupport
Support key derivation operations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetEffectiveKeyLength(String algorithmURI, Integer specifiedKeyLength) Get the effective key length based on the specified algorithm URI and the specified key length, if present.static StringgetJCAKeyAlgorithm(String algorithmURI) Get the JCA key algorithm which corresponds to the specified algorithm URI.
-
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 usedspecifiedKeyLength- an explicitly specified key length- Returns:
- the effective key length
- Throws:
KeyDerivationException- if algorithm and specified key lengths are not consistent
-