Refine search
public BrokePBEWithMD5AndDES() { super(new CBCBlockCipher(new DESEngine()), PKCS5S1, MD5, 64, 64); } }
int noOfBlocks = WKCKS.length / engine.getBlockSize(); int extraBytes = WKCKS.length % engine.getBlockSize(); engine.init(true, paramPlusIV); int currentBytePos = i * engine.getBlockSize(); engine.processBlock(TEMP1, currentBytePos, TEMP1, currentBytePos); ParametersWithIV param2 = new ParametersWithIV(this.param, IV2); this.engine.init(true, param2); int currentBytePos = i * engine.getBlockSize(); engine.processBlock(TEMP3, currentBytePos, TEMP3, currentBytePos);
/** * Process one block of input from the array in and write it to * the out array. * * @param in the array containing the input data. * @param inOff offset into the in array the data starts at. * @param out the array the output data will be copied into. * @param outOff the offset into the out array the output will start at. * @exception DataLengthException if there isn't enough data in in, or * space in out. * @exception IllegalStateException if the cipher isn't initialised. * @return the number of bytes processed and produced. */ public int processBlock( byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { return (encrypting) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff); }
engine.init(true, param); int blockSize = engine.getBlockSize(); byte[] cekBlock; engine.processBlock(cekBlock, i, cekBlock, i); engine.processBlock(cekBlock, i, cekBlock, i);
/** Creates a new instance of AESCipher */ public AESCipher(boolean forEncryption, byte[] key, byte[] iv) { BlockCipher aes = new AESFastEngine(); BlockCipher cbc = new CBCBlockCipher(aes); bp = new PaddedBufferedBlockCipher(cbc); KeyParameter kp = new KeyParameter(key); ParametersWithIV piv = new ParametersWithIV(kp, iv); bp.init(forEncryption, piv); }
this.engine = new CBCBlockCipher(new RC2Engine()); this.iv = this.paramPlusIV.getIV(); this.param = this.paramPlusIV.getParameters(); this.paramPlusIV = new ParametersWithIV(this.param, this.iv);
private byte[] decryptWithLWCrypto(byte[] cipher, String password, byte[] salt, final int iterationCount) throws Exception { PKCS12ParametersGenerator pGen = new PKCS12ParametersGenerator(new SHA256Digest()); char[] passwordChars = password.toCharArray(); final byte[] pkcs12PasswordBytes = PBEParametersGenerator .PKCS12PasswordToBytes(passwordChars); pGen.init(pkcs12PasswordBytes, salt, iterationCount); CBCBlockCipher aesCBC = new CBCBlockCipher(new AESEngine()); ParametersWithIV aesCBCParams = (ParametersWithIV) pGen.generateDerivedParameters(256, 128); aesCBC.init(false, aesCBCParams); PaddedBufferedBlockCipher aesCipher = new PaddedBufferedBlockCipher(aesCBC, new PKCS7Padding()); byte[] plainTemp = new byte[aesCipher.getOutputSize(cipher.length)]; int offset = aesCipher.processBytes(cipher, 0, cipher.length, plainTemp, 0); int last = aesCipher.doFinal(plainTemp, offset); final byte[] plain = new byte[offset + last]; System.arraycopy(plainTemp, 0, plain, 0, plain.length); return plain; }
/** * 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); }
this.engine = new CBCBlockCipher(new RC2Engine()); this.iv = this.paramPlusIV.getIV(); this.param = this.paramPlusIV.getParameters(); this.paramPlusIV = new ParametersWithIV(this.param, this.iv);
engine.init(true, param); int blockSize = engine.getBlockSize(); byte[] cekBlock; engine.processBlock(cekBlock, i, cekBlock, i); engine.processBlock(cekBlock, i, cekBlock, i);
KeyParameter keyParameter = new KeyParameter(aesDecrypted); CBCBlockCipher cbcBlockCipher = new CBCBlockCipher(new AESEngine()); cbcBlockCipher.init(false, keyParameter); PaddedBufferedBlockCipher aesCipher = new PaddedBufferedBlockCipher(cbcBlockCipher, new PKCS7Padding()); return new CipherInputStream(in, aesCipher)
/** * 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); } }
public OldPBEWithSHAAndDES3Key() { super(new CBCBlockCipher(new DESedeEngine()), OLD_PKCS12, SHA1, 192, 64); } }
int blockSize = engine.getBlockSize(); engine.init(true, paramPlusIV); engine.processBlock(WKCKS, currentBytePos, TEMP1, currentBytePos); ParametersWithIV param2 = new ParametersWithIV(this.param, IV2); this.engine.init(true, param2); engine.processBlock(TEMP3, currentBytePos, TEMP3, currentBytePos);
this.engine = new CBCBlockCipher(new DESedeEngine()); sr.nextBytes(iv); this.paramPlusIV = new ParametersWithIV(this.param, this.iv); this.iv = this.paramPlusIV.getIV(); this.param = (KeyParameter)this.paramPlusIV.getParameters();
/** * Process one block of input from the array in and write it to * the out array. * * @param in the array containing the input data. * @param inOff offset into the in array the data starts at. * @param out the array the output data will be copied into. * @param outOff the offset into the out array the output will start at. * @exception DataLengthException if there isn't enough data in in, or * space in out. * @exception IllegalStateException if the cipher isn't initialised. * @return the number of bytes processed and produced. */ public int processBlock( byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException { return (encrypting) ? encryptBlock(in, inOff, out, outOff) : decryptBlock(in, inOff, out, outOff); }
/** * 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; }
public PBEWithSHAAnd128BitRC2() { super(new CBCBlockCipher(new RC2Engine()), PKCS12, SHA1, 128, 8); } }
int noOfBlocks = WKCKS.length / engine.getBlockSize(); int extraBytes = WKCKS.length % engine.getBlockSize(); engine.init(true, paramPlusIV); int currentBytePos = i * engine.getBlockSize(); engine.processBlock(TEMP1, currentBytePos, TEMP1, currentBytePos); ParametersWithIV param2 = new ParametersWithIV(this.param, IV2); this.engine.init(true, param2); int currentBytePos = i * engine.getBlockSize(); engine.processBlock(TEMP3, currentBytePos, TEMP3, currentBytePos);
this.engine = new CBCBlockCipher(new DESedeEngine()); sr.nextBytes(iv); this.paramPlusIV = new ParametersWithIV(this.param, this.iv); this.iv = this.paramPlusIV.getIV(); this.param = (KeyParameter)this.paramPlusIV.getParameters();