public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, int bufferSize, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, bufferSize, key, iv)); }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, key, iv)); } }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, key, iv)); } }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, int bufferSize, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, bufferSize, key, iv)); }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, int bufferSize, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, bufferSize, key, iv)); }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, key, iv)); } }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, key, iv)); } }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, key, iv)); } }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, int bufferSize, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, bufferSize, key, iv)); }
public CryptoFSDataInputStream(FSDataInputStream in, CryptoCodec codec, int bufferSize, byte[] key, byte[] iv) throws IOException { super(new CryptoInputStream(in, codec, bufferSize, key, iv)); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(buffer, 0, bufferLen); return new CryptoInputStream(in, codec, bufferSize, key, iv); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { ByteArrayInputStream in = new ByteArrayInputStream(buffer, 0, bufferLen); return new CryptoInputStream(in, codec, bufferSize, key, iv); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { return new CryptoInputStream(fileSys.open(file), codec, bufferSize, key, iv); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { return new CryptoInputStream(fileSys.open(file), codec, bufferSize, key, iv); }
public static CryptoInputStream createWrappedInputStream(InputStream is, KeyProvider keyProvider, FileEncryptionInfo fileEncryptionInfo, Configuration conf) throws IOException { // File is encrypted, wrap the stream in a crypto stream. // Currently only one version, so no special logic based on the version# HdfsKMSUtil.getCryptoProtocolVersion(fileEncryptionInfo); final CryptoCodec codec = HdfsKMSUtil.getCryptoCodec( conf, fileEncryptionInfo); final KeyVersion decrypted = decryptEncryptedDataEncryptionKey(fileEncryptionInfo, keyProvider); return new CryptoInputStream(is, codec, decrypted.getMaterial(), fileEncryptionInfo.getIV()); }
/** * Create IOStreamPair of {@link org.apache.hadoop.crypto.CryptoInputStream} * and {@link org.apache.hadoop.crypto.CryptoOutputStream} * * @param conf the configuration * @param cipherOption negotiated cipher option * @param out underlying output stream * @param in underlying input stream * @param isServer is server side * @return IOStreamPair the stream pair * @throws IOException for any error */ public static IOStreamPair createStreamPair(Configuration conf, CipherOption cipherOption, OutputStream out, InputStream in, boolean isServer) throws IOException { LOG.debug("Creating IOStreamPair of CryptoInputStream and " + "CryptoOutputStream."); CryptoCodec codec = CryptoCodec.getInstance(conf, cipherOption.getCipherSuite()); byte[] inKey = cipherOption.getInKey(); byte[] inIv = cipherOption.getInIv(); byte[] outKey = cipherOption.getOutKey(); byte[] outIv = cipherOption.getOutIv(); InputStream cIn = new CryptoInputStream(in, codec, isServer ? inKey : outKey, isServer ? inIv : outIv); OutputStream cOut = new CryptoOutputStream(out, codec, isServer ? outKey : inKey, isServer ? outIv : inIv); return new IOStreamPair(cIn, cOut); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { DataInputBuffer in = new DataInputBuffer(); in.reset(buf, 0, bufLen); return new CryptoInputStream(new FakeInputStream(in), codec, bufferSize, key, iv); }
@Override protected InputStream getInputStream(int bufferSize, byte[] key, byte[] iv) throws IOException { DataInputBuffer in = new DataInputBuffer(); in.reset(buf, 0, bufLen); return new CryptoInputStream(new FakeInputStream(in), codec, bufferSize, key, iv); }
/** * Wraps the stream in a CryptoInputStream if the underlying file is * encrypted. */ public HdfsDataInputStream createWrappedInputStream(DFSInputStream dfsis) throws IOException { final FileEncryptionInfo feInfo = dfsis.getFileEncryptionInfo(); if (feInfo != null) { // File is encrypted, wrap the stream in a crypto stream. // Currently only one version, so no special logic based on the version # getCryptoProtocolVersion(feInfo); final CryptoCodec codec = getCryptoCodec(conf, feInfo); final KeyVersion decrypted = decryptEncryptedDataEncryptionKey(feInfo); final CryptoInputStream cryptoIn = new CryptoInputStream(dfsis, codec, decrypted.getMaterial(), feInfo.getIV()); return new HdfsDataInputStream(cryptoIn); } else { // No FileEncryptionInfo so no encryption. return new HdfsDataInputStream(dfsis); } }
/** * Wraps the stream in a CryptoInputStream if the underlying file is * encrypted. */ public HdfsDataInputStream createWrappedInputStream(DFSInputStream dfsis) throws IOException { final FileEncryptionInfo feInfo = dfsis.getFileEncryptionInfo(); if (feInfo != null) { // File is encrypted, wrap the stream in a crypto stream. // Currently only one version, so no special logic based on the version # getCryptoProtocolVersion(feInfo); final CryptoCodec codec = getCryptoCodec(conf, feInfo); final KeyVersion decrypted = decryptEncryptedDataEncryptionKey(feInfo); final CryptoInputStream cryptoIn = new CryptoInputStream(dfsis, codec, decrypted.getMaterial(), feInfo.getIV()); return new HdfsDataInputStream(cryptoIn); } else { // No FileEncryptionInfo so no encryption. return new HdfsDataInputStream(dfsis); } }