List of usage examples for javax.crypto.spec RC2ParameterSpec RC2ParameterSpec
public RC2ParameterSpec(int effectiveKeyBits, byte[] iv)
From source file:it.scoppelletti.programmerpower.security.spi.RC2ParameterSpecFactory.java
public AlgorithmParameterSpec newInstance(Properties props, String prefix) { int keySize;/*from w ww .j a v a 2 s. c om*/ String name, value; byte[] iv; AlgorithmParameterSpec param; name = Strings.concat(prefix, RC2ParameterSpecFactory.PROP_KEYSIZE); value = props.getProperty(name); if (Strings.isNullOrEmpty(value)) { throw new ArgumentNullException(name); } keySize = Integer.parseInt(value); name = Strings.concat(prefix, RC2ParameterSpecFactory.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 RC2ParameterSpec(keySize, iv); } else { param = new RC2ParameterSpec(keySize); } return param; }