/** * {@inheritDoc} */ public void init(byte[] key) { if (key.length != 16 && key.length != 24 && key.length != 32) throw new IllegalArgumentException("Not an AES key length"); cipher.init(true, new KeyParameter(key)); }
public void init( CipherParameters params) { reset(); cipher.init(true, params); }
public void init( CipherParameters params) { reset(); cipher.init(true, params); }
XTSCore init(boolean forEncryption, KeyParameter key1, KeyParameter key2) throws IllegalArgumentException { cipher.init(forEncryption, key1); tweak.init(key2); this.forEncryption = forEncryption; return this; }
public void init( CipherParameters params) { reset(); cipher.init(true, params); }
private void E(byte[] key, byte[] s, int sOff, byte[] in, int inOff) { cipher.init(true, new KeyParameter(key)); cipher.processBlock(in, inOff, s, sOff); }
private void E(byte[] key, byte[] s, int sOff, byte[] in, int inOff) { cipher.init(true, new KeyParameter(key)); cipher.processBlock(in, inOff, s, sOff); }
@Override public void init( boolean forEncryption, // not used for CTR mode CipherParameters params) { ParametersWithIV ivParams = (ParametersWithIV) params; byte[] iv = ivParams.getIV(); System.arraycopy(iv, 0, IV, 0, IV.length); reset(); this.cipher.init(true, ivParams.getParameters()); }
String decrypt(byte[] cryptoBytes, byte[] key, byte[] iv) { BlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine())); cipher.init(false, new ParametersWithIV(new KeyParameter(key), iv)); byte[] out = new byte[cipher.getOutputSize(cryptoBytes.length)]; int offset = cipher.processBytes(cryptoBytes, 0, cryptoBytes.length, out, 0); cipher.doFinal(out, offset); return new String(out); }
/** * Creates a new instance of AESCipher */ public AESCipherCBCnoPad(boolean forEncryption, byte[] key) { BlockCipher aes = new AESFastEngine(); cbc = new CBCBlockCipher(aes); KeyParameter kp = new KeyParameter(key); cbc.init(forEncryption, kp); }
/** * Constructor to allow use of a particular sbox with GOST28147 * @see GOST28147Engine#getSBox(String) */ public GOST3411Digest(byte[] sBoxParam) { sBox = Arrays.clone(sBoxParam); cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); }
/** Creates a new instance of AESCipher */ public AESCipherCBCnoPad(boolean forEncryption, byte[] key) { BlockCipher aes = new AESFastEngine(); cbc = new CBCBlockCipher(aes); KeyParameter kp = new KeyParameter(key); cbc.init(forEncryption, kp); }
/** * Standard constructor */ public GOST3411Digest() { sBox = GOST28147Engine.getSBox("D-A"); cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); }
/** * Standard constructor */ public GOST3411Digest() { sBox = GOST28147Engine.getSBox("D-A"); cipher.init(true, new ParametersWithSBox(null, sBox)); reset(); }
private void initCipher(boolean forEncryption, BlockCipher cipher, byte[] key_block, int key_size, int key_offset, int iv_offset) { KeyParameter key_parameter = new KeyParameter(key_block, key_offset, key_size); ParametersWithIV parameters_with_iv = new ParametersWithIV(key_parameter, key_block, iv_offset, cipher.getBlockSize()); cipher.init(forEncryption, parameters_with_iv); }
private void initCipher(boolean forEncryption, BlockCipher cipher, byte[] key_block, int key_size, int key_offset, int iv_offset) { KeyParameter key_parameter = new KeyParameter(key_block, key_offset, key_size); ParametersWithIV parameters_with_iv = new ParametersWithIV(key_parameter, key_block, iv_offset, cipher.getBlockSize()); cipher.init(forEncryption, parameters_with_iv); }
public AESCipherCBCnoPad(boolean forEncryption, byte[] key, byte[] initVector) { BlockCipher aes = new AESFastEngine(); cbc = new CBCBlockCipher(aes); KeyParameter kp = new KeyParameter(key); ParametersWithIV piv = new ParametersWithIV(kp, initVector); cbc.init(forEncryption, piv); }
static InputStream decryptStream(InputStream in, XFileKey keyCipher) { BlockCipher cipher = keyCipher.ciphers().get(); cipher.init(false, new KeyParameter(keyCipher.key())); return new CipherInputStream(in, new BufferedBlockCipher(cipher)); }
public void init(CipherParameters params) { validate(params); cipher.init(true, params); //initializes the L, Lu, Lu2 numbers byte[] L = new byte[ZEROES.length]; cipher.processBlock(ZEROES, 0, L, 0); Lu = doubleLu(L); Lu2 = doubleLu(Lu); reset(); }
public void init(CipherParameters params) { validate(params); cipher.init(true, params); //initializes the L, Lu, Lu2 numbers L = new byte[ZEROES.length]; cipher.processBlock(ZEROES, 0, L, 0); Lu = doubleLu(L); Lu2 = doubleLu(Lu); reset(); }