Steve Weis created SPARK-43286:
----------------------------------

             Summary: Update CBC mode in aes_encrypt()/aes_decrypt() to not use 
KDF
                 Key: SPARK-43286
                 URL: https://issues.apache.org/jira/browse/SPARK-43286
             Project: Spark
          Issue Type: Improvement
          Components: SQL
    Affects Versions: 3.5.0
            Reporter: Steve Weis


The current implementation of AES-CBC mode called via `{{{}aes_encrypt{}}}` and 
`{{{}aes_decrypt{}}}` uses a key derivation function (KDF) based on OpenSSL's 
[EVP_BytesToKey|https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html]. 
This is intended for generating keys based on passwords and OpenSSL's documents 
discourage its use: _"Newer applications should use a more modern algorithm"._

`{{{}aes_encrypt{}}}` and `{{{}aes_decrypt{}}}` should use the key directly in 
CBC mode, as it does for both GCM and ECB mode. The output should then be the 
initialization vector (IV) prepended to the ciphertext – as is done with GCM 
mode:
{{(16-byte randomly generated IV | AES-CBC encrypted ciphertext)}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to