/** * Sets the algorithm to use. See * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory">SecretKeyFactory Algorithms</a> * @param secretKeyFactoryAlgorithm the algorithm to use (i.e. * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA1}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA512}) * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); try { SecretKeyFactory.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); } this.algorithm = algorithmName; }
/** * Sets the algorithm to use. See * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory">SecretKeyFactory Algorithms</a> * @param secretKeyFactoryAlgorithm the algorithm to use (i.e. * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA1}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA512}) * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); try { SecretKeyFactory.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); } this.algorithm = algorithmName; }
/** * Sets the algorithm to use. See * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory">SecretKeyFactory Algorithms</a> * @param secretKeyFactoryAlgorithm the algorithm to use (i.e. * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA1}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA512}) * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); try { SecretKeyFactory.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); } this.algorithm = algorithmName; }
/** * Sets the algorithm to use. See * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory">SecretKeyFactory Algorithms</a> * @param secretKeyFactoryAlgorithm the algorithm to use (i.e. * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA1}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA512}) * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); try { SecretKeyFactory.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); } this.algorithm = algorithmName; }
/** * Sets the algorithm to use. See * <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory">SecretKeyFactory Algorithms</a> * @param secretKeyFactoryAlgorithm the algorithm to use (i.e. * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA1}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256}, * {@code SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA512}) * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); try { SecretKeyFactory.getInstance(algorithmName); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException("Invalid algorithm '" + algorithmName + "'.", e); } this.algorithm = algorithmName; }