sweisdb commented on code in PR #40969:
URL: https://github.com/apache/spark/pull/40969#discussion_r1183127684
##########
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionImplUtils.java:
##########
@@ -26,27 +26,59 @@
import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.security.GeneralSecurityException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-import java.util.Arrays;
+import java.security.spec.AlgorithmParameterSpec;
-import static java.nio.charset.StandardCharsets.US_ASCII;
/**
* An utility class for constructing expressions.
*/
public class ExpressionImplUtils {
- private static final SecureRandom secureRandom = new SecureRandom();
+ private static final ThreadLocal<SecureRandom> threadLocalSecureRandom =
+ new ThreadLocal<SecureRandom>() {
+ @Override
+ public SecureRandom initialValue() {
+ return new SecureRandom();
+ }
+ };
+
private static final int GCM_IV_LEN = 12;
private static final int GCM_TAG_LEN = 128;
-
private static final int CBC_IV_LEN = 16;
- private static final int CBC_SALT_LEN = 8;
- /** OpenSSL's magic initial bytes. */
- private static final String SALTED_STR = "Salted__";
- private static final byte[] SALTED_MAGIC = SALTED_STR.getBytes(US_ASCII);
+ enum CipherMode {
+ ECB("ECB", 0, 0, "AES/ECB/PKCS5Padding", false),
+ CBC("CBC", CBC_IV_LEN, 0, "AES/CBC/PKCS5Padding", true),
+ GCM("GCM", GCM_IV_LEN, GCM_TAG_LEN, "AES/GCM/NoPadding", true);
+
+ private final String name;
Review Comment:
I updated the switch statement below to use these values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]