Class KeyDerivationSupport


  • public final class KeyDerivationSupport
    extends Object
    Support key derivation operations.
    • Constructor Detail

      • KeyDerivationSupport

        private KeyDerivationSupport()
        Constructor.
    • Method Detail

      • 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

        @Nonnull
        public static Integer 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