@Override public InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException { Preconditions.checkNotNull(decryptor); return decryptor.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException { Preconditions.checkNotNull(d); return d.createDecryptionStream(in); }
/** * Decrypt a stream of ciphertext given a decryptor * @param out * @param in * @param outLen * @param d * @throws IOException */ public static void decrypt(OutputStream out, InputStream in, int outLen, Decryptor d) throws IOException { InputStream cin = d.createDecryptionStream(in); byte buf[] = new byte[8*1024]; long remaining = outLen; try { while (remaining > 0) { int toRead = (int)(remaining < buf.length ? remaining : buf.length); int read = cin.read(buf, 0, toRead); if (read < 0) { break; } out.write(buf, 0, read); remaining -= read; } } finally { cin.close(); } }
/** * Decrypt a block of ciphertext read in from a stream with the given * cipher and context * <p> * The decryptor's state will be finalized. It should be reinitialized or * returned to the pool. * @param dest * @param destOffset * @param in * @param destSize * @param d * @throws IOException */ public static void decrypt(byte[] dest, int destOffset, InputStream in, int destSize, Decryptor d) throws IOException { InputStream cin = d.createDecryptionStream(in); try { IOUtils.readFully(cin, dest, destOffset, destSize); } finally { cin.close(); } }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
dataInputStream = decryptor.createDecryptionStream(dataInputStream);
decryptor.reset(); InputStream cin = decryptor.createDecryptionStream(new ByteArrayInputStream(codedBytes));
@Override public InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException { Preconditions.checkNotNull(decryptor); return decryptor.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException { Preconditions.checkNotNull(d); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException { Preconditions.checkNotNull(d); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Decryptor d) throws IOException { Preconditions.checkNotNull(d); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Decryptor decryptor) throws IOException { Preconditions.checkNotNull(decryptor); return decryptor.createDecryptionStream(in); }
/** * Decrypt a block of ciphertext read in from a stream with the given * cipher and context * <p> * The decryptor's state will be finalized. It should be reinitialized or * returned to the pool. * @param dest * @param destOffset * @param in * @param destSize * @param d * @throws IOException */ public static void decrypt(byte[] dest, int destOffset, InputStream in, int destSize, Decryptor d) throws IOException { InputStream cin = d.createDecryptionStream(in); try { IOUtils.readFully(cin, dest, destOffset, destSize); } finally { cin.close(); } }
/** * Decrypt a block of ciphertext read in from a stream with the given * cipher and context * <p> * The decryptor's state will be finalized. It should be reinitialized or * returned to the pool. * @param dest * @param destOffset * @param in * @param destSize * @param d * @throws IOException */ public static void decrypt(byte[] dest, int destOffset, InputStream in, int destSize, Decryptor d) throws IOException { InputStream cin = d.createDecryptionStream(in); try { IOUtils.readFully(cin, dest, destOffset, destSize); } finally { cin.close(); } }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }
@Override public InputStream createDecryptionStream(InputStream in, Context context, byte[] iv) throws IOException { Preconditions.checkNotNull(context); Preconditions.checkState(context.getKey() != null, "Context does not have a key"); Preconditions.checkNotNull(iv); Decryptor d = getDecryptor(); d.setKey(context.getKey()); d.setIv(iv); return d.createDecryptionStream(in); }