protected byte[] doDecrypt(byte[] cryptedData, int offset, int length, byte[] decryptionKey, byte[] iv) { byte[] decryptedData = null; try { Cipher alg = cipherPool.reuseCipher(); if (alg == null) { alg = Cipher.getInstance(protocolId); } SecretKeySpec key = new SecretKeySpec(decryptionKey, 0, keyBytes, protocolClass); IvParameterSpec ivSpec = new IvParameterSpec(iv); alg.init(Cipher.DECRYPT_MODE, key, ivSpec); decryptedData = alg.doFinal(cryptedData, offset, length); cipherPool.offerCipher(alg); } catch (Exception e) { logger.error(e); if (logger.isDebugEnabled()) { e.printStackTrace(); } } return decryptedData; }
protected byte[] doDecrypt(byte[] cryptedData, int offset, int length, byte[] decryptionKey, byte[] iv) { byte[] decryptedData = null; try { Cipher alg = cipherPool.reuseCipher(); if (alg == null) { alg = Cipher.getInstance(protocolId); } SecretKeySpec key = new SecretKeySpec(decryptionKey, 0, keyBytes, protocolClass); IvParameterSpec ivSpec = new IvParameterSpec(iv); alg.init(Cipher.DECRYPT_MODE, key, ivSpec); decryptedData = alg.doFinal(cryptedData, offset, length); cipherPool.offerCipher(alg); } catch (Exception e) { logger.error(e); if (logger.isDebugEnabled()) { e.printStackTrace(); } } return decryptedData; }
cipherPool.offerCipher(alg);
cipherPool.offerCipher(alg);
Cipher alg = doInit(encryptionKey, initVect); encryptedData = alg.doFinal(unencryptedData, offset, length); cipherPool.offerCipher(alg);
cipherPool.offerCipher(alg);
cipherPool.offerCipher(alg);
Cipher alg = doInit(encryptionKey, initVect); encryptedData = alg.doFinal(unencryptedData, offset, length); cipherPool.offerCipher(alg);