public ECB() { super(new AESFastEngine()); } }
unpackBlock(in, inOff); encryptBlock(WorkingKey); packBlock(out, outOff); unpackBlock(in, inOff); decryptBlock(WorkingKey); packBlock(out, outOff);
AESFastEngine engine = new AESFastEngine(); SICBlockCipher ctrEngine = new SICBlockCipher(engine); while (i < cipher.length) { ctrEngine.processBlock(cipher, i, out, i); i += engine.getBlockSize(); if (cipher.length - i < engine.getBlockSize()) break;
AESFastEngine engine = new AESFastEngine(); SICBlockCipher ctrEngine = new SICBlockCipher(engine); while(i < cipher.length){ ctrEngine.processBlock(cipher, i, out, i); i += engine.getBlockSize(); if (cipher.length - i < engine.getBlockSize()) break;
/** * Constructor. */ public AES256() { aesEngine = new AESFastEngine(); }
AESFastEngine engine = new AESFastEngine(); SICBlockCipher ctrEngine = new SICBlockCipher(engine); while (i < cipher.length) { ctrEngine.processBlock(cipher, i, out, i); i += engine.getBlockSize(); if (cipher.length - i < engine.getBlockSize()) { break;
public int processBlock( byte[] in, int inOff, byte[] out, int outOff) { if (WorkingKey == null) { throw new IllegalStateException("AES engine not initialised"); } if ((inOff + (32 / 2)) > in.length) { throw new DataLengthException("input buffer too short"); } if ((outOff + (32 / 2)) > out.length) { throw new OutputLengthException("output buffer too short"); } unpackBlock(in, inOff); if (forEncryption) { encryptBlock(WorkingKey); } else { decryptBlock(WorkingKey); } packBlock(out, outOff); return BLOCK_SIZE; }
public RFC3211Wrap() { super(new RFC3211WrapEngine(new AESFastEngine()), 16); } }
public PBEWithAESCBC() { super(new CBCBlockCipher(new AESFastEngine())); } }
public CBC() { super(new CBCBlockCipher(new AESFastEngine()), 128); } }
public AESCMAC() { super(new CMac(new AESFastEngine())); } }
protected BlockCipher createAESBlockCipher() { return new CBCBlockCipher(new AESFastEngine()); }
public CFB() { super(new BufferedBlockCipher(new CFBBlockCipher(new AESFastEngine(), 128)), 128); } }
public OFB() { super(new BufferedBlockCipher(new OFBBlockCipher(new AESFastEngine(), 128)), 128); } }
/** * Create an encrypted output stream from an unencrypted output stream */ public static OutputStream getEncryptedOutputStream (OutputStream decryptedOutputStream, byte[] keyData, byte[] ivData) { final ParametersWithIV keyAndIV = new ParametersWithIV(new KeyParameter(keyData), ivData); PaddedBufferedBlockCipher pbbc = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine())); pbbc.init(true, keyAndIV); return new CipherOutputStream(decryptedOutputStream, pbbc); } }
/** * Create a decrypted input stream from an encrypted one */ public static InputStream getDecryptedInputStream (InputStream encryptedInputStream, byte[] keyData, byte[] ivData) { final ParametersWithIV keyAndIV = new ParametersWithIV(new KeyParameter(keyData), ivData); PaddedBufferedBlockCipher pbbc = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine())); pbbc.init(false, keyAndIV); return new CipherInputStream(encryptedInputStream, pbbc); }
/** 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); }
/** * Get a cipher * * @param mode encryption or decryption * @param iv a 16 byte iv * @return an initialised Cipher */ PaddedBufferedBlockCipher getCipher(CMode mode, byte[] iv) { PaddedBufferedBlockCipher result = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine())); result.init(mode.getEncrypt(), new ParametersWithIV(new KeyParameter(getKey()), iv)); return result; }