Class CipherUtils

    • Method Detail

      • generateKey

        public static SecretKey generateKey​(String algorithm,
                                            int keyLength,
                                            SecureRandom secureRandom)
        Generate a new SecretKey based on the given algorithm and with the given length.
        Parameters:
        algorithm - the algorithm that will be used to build the key.
        keyLength - the key length
        Returns:
        a new SecretKey
      • generatePBEKey

        public static SecretKey generatePBEKey​(String password,
                                               String pbeAlgorithm,
                                               String keyAlgorithm,
                                               byte[] salt,
                                               int iterationCount,
                                               int keyLength)
        Parameters:
        password - the password that will be used to build the key.
        pbeAlgorithm - the password-based algorithm that will be used to build the key.
        keyAlgorithm - the algorithm that will be used to build the key.
        salt - salt for encryption.
        iterationCount - iteration count.
        keyLength - the key length.
        Returns:
        a new SecretKey