@Override public void close() throws IOException { Hessian2Input in = _in; _in = null; if (in != null) { _cipherIn.close(); _bodyIn.close(); int len = in.readInt(); if (len != 0) throw new IOException("Unexpected footer"); in.completeEnvelope(); in.close(); } } }
static void decrypt() throws IOException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException { FileInputStream fis = new FileInputStream("data/encrypted"); FileOutputStream fos = new FileOutputStream("data/decrypted"); SecretKeySpec sks = new SecretKeySpec("MyDifficultPassw".getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, sks); CipherInputStream cis = new CipherInputStream(fis, cipher); int b; byte[] d = new byte[8]; while((b = cis.read(d)) != -1) { fos.write(d, 0, b); } fos.flush(); fos.close(); cis.close(); }
cipherInputStream.close(); cipherInputStream = null;
cin.close(); fin.close (); fout.close();
cipherInputStream.close(); } catch ( Exception e ) { baseStep.logError( "Error closing input stream on socket connection to remote step", e );
@SuppressWarnings("PMD.UnusedPrivateMethod") // false positive private static <T> T parseEncryptedJsonFile(String fileName, CheckedFunction<JsonReader, T> parser) throws Exception { SecretKeySpec sks = new SecretKeySpec(StringHelper.hexStringToByteArray(Config.ENCRYPTION_KEY), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, sks); try (InputStream is = Files.newInputStream(Paths.get(fileName))) { CipherInputStream in = new CipherInputStream(is, cipher); JsonReader reader = new JsonReader(new InputStreamReader(in)); T result = parser.apply(reader); reader.close(); in.close(); return result; } }
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
@Override /** * <p>Closes this input stream and releases any system resources associated with the stream.</p> * * <p>This method calls close on its proxied CipherInputStream.</p> * @throws IOException */ public void close() throws IOException { cipherInputStream.close(); }
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
public void close() throws IOException { if (!closed) { super.close(); closed = true; } } };
FileInputStream inputStream = new FileInputStream(inputFile); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); int read; CipherInputStream cis = new CipherInputStream(inputStream, cipher); while ((read = cis.read()) != -1) { fileOutputStream.write(read); } fileOutputStream.close(); cis.close();
FileInputStream inputStream = new FileInputStream(inputFile); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); int read; byte[] buffer = new byte[4096]; CipherInputStream cis = new CipherInputStream(inputStream, cipher); while ((read = cis.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, read); } fileOutputStream.close(); cis.close();