List of usage examples for javax.crypto Cipher getMaxAllowedParameterSpec
public static final AlgorithmParameterSpec getMaxAllowedParameterSpec(String transformation) throws NoSuchAlgorithmException
From source file:org.jumpmind.security.SecurityService.java
protected void initializeCipher(Cipher cipher, int mode) throws Exception { AlgorithmParameterSpec paramSpec = Cipher.getMaxAllowedParameterSpec(cipher.getAlgorithm()); if (paramSpec instanceof PBEParameterSpec || (paramSpec == null && cipher.getAlgorithm().startsWith("PBE"))) { paramSpec = new PBEParameterSpec(SecurityConstants.SALT, SecurityConstants.ITERATION_COUNT); cipher.init(mode, secretKey, paramSpec); } else if (paramSpec instanceof IvParameterSpec) { paramSpec = new IvParameterSpec(SecurityConstants.SALT); cipher.init(mode, secretKey, paramSpec); } else {/* w w w .j av a 2s . c om*/ cipher.init(mode, secretKey, (AlgorithmParameterSpec) null); } }