HBASE-27089 Add “commons.crypto.stream.buffer.size” configuration (#4491)

Co-authored-by: wenwj0 <wenweijian2@huawei.com>
Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit 7ff927dbd8)
This commit is contained in:
wenwj0 2022-08-21 22:21:32 +08:00 committed by Duo Zhang
parent f705e3e7d8
commit f509e43eaa
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,7 @@ import java.security.SecureRandom;
import java.util.Properties;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.crypto.cipher.CryptoCipherFactory;
import org.apache.commons.crypto.stream.CryptoInputStream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.io.crypto.Cipher;
import org.apache.hadoop.hbase.io.crypto.CipherProvider;
@ -48,6 +49,8 @@ public class CommonsCryptoAES extends Cipher {
public static final String CIPHER_MODE_KEY = "hbase.crypto.commons.mode";
public static final String CIPHER_CLASSES_KEY = "hbase.crypto.commons.cipher.classes";
public static final String CIPHER_JCE_PROVIDER_KEY = "hbase.crypto.commons.cipher.jce.provider";
public static final String CRYPTOSTREAM_BUFFERSIZE_KEY =
"hbase.crypto.commons.cryptoStream.bufferSize";
private final String cipherMode;
private Properties props;
@ -81,6 +84,8 @@ public class CommonsCryptoAES extends Cipher {
props.setProperty(CryptoCipherFactory.CLASSES_KEY, conf.get(CIPHER_CLASSES_KEY, ""));
props.setProperty(CryptoCipherFactory.JCE_PROVIDER_KEY, conf.get(CIPHER_JCE_PROVIDER_KEY, ""));
props.setProperty(CryptoInputStream.STREAM_BUFFER_SIZE_KEY,
conf.get(CRYPTOSTREAM_BUFFERSIZE_KEY, ""));
return props;
}