List of usage examples for javax.crypto.spec RC5ParameterSpec RC5ParameterSpec
public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)
From source file:it.scoppelletti.programmerpower.security.spi.RC5ParameterSpecFactory.java
public AlgorithmParameterSpec newInstance(Properties props, String prefix) { int rounds, version, wordSize; String name, value;/*from w w w .jav a 2 s . co m*/ byte[] iv; AlgorithmParameterSpec param; name = Strings.concat(prefix, RC5ParameterSpecFactory.PROP_VERSION); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { throw new ArgumentNullException(name); } version = Integer.parseInt(value); name = Strings.concat(prefix, RC5ParameterSpecFactory.PROP_ROUNDS); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { throw new ArgumentNullException(name); } rounds = Integer.parseInt(value); name = Strings.concat(prefix, RC5ParameterSpecFactory.PROP_WORDSIZE); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { throw new ArgumentNullException(name); } wordSize = Integer.parseInt(value); name = Strings.concat(prefix, RC5ParameterSpecFactory.PROP_IV); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { iv = null; } else { try { iv = Hex.decodeHex(value.toCharArray()); } catch (DecoderException ex) { throw SecurityUtils.toSecurityException(ex); } } if (iv != null) { param = new RC5ParameterSpec(version, rounds, wordSize, iv); } else { param = new RC5ParameterSpec(version, rounds, wordSize); } return param; }