crypto/src/main/java/org/springframework/security/crypto/encrypt/CipherUtils.java
public static SecretKey newSecretKey(String algorithm, PBEKeySpec keySpec) {
		try {
			SecretKeyFactory factory = SecretKeyFactory.getInstance(algorithm);
			return factory.generateSecret(keySpec);
		}
		catch (NoSuchAlgorithmException e) {
			throw new IllegalArgumentException("Not a valid encryption algorithm", e);
		}
		catch (InvalidKeySpecException e) {
			throw new IllegalArgumentException("Not a valid secret key", e);
		}
	}
public static SecretKey newSecretKey(String algorithm, PBEKeySpec keySpec) {
		try {
			SecretKeyFactory factory = SecretKeyFactory.getInstance(algorithm);
			return factory.generateSecret(keySpec);
		}
		catch (NoSuchAlgorithmException e) {
			throw new IllegalArgumentException("Not a valid encryption algorithm", e);
		}
		catch (InvalidKeySpecException e) {
			throw new IllegalArgumentException("Not a valid secret key", e);
		}
	}
public static SecretKey newSecretKey ( String algorithm , PBEKeySpec keySpec ) { try { SecretKeyFactory factory = SecretKeyFactory . getInstance ( algorithm ) ; return factory . generateSecret ( keySpec ) ; } catch ( NoSuchAlgorithmException e ) { throw new IllegalArgumentException ( "Not a valid encryption algorithm" , e ) ; } catch ( InvalidKeySpecException e ) { throw new IllegalArgumentException ( "Not a valid secret key" , e ) ; } }
Generates a SecretKey.
Generates a SecretKey .