You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/19 04:14:54 UTC
[GitHub] [apisix] tzssangglass commented on a diff in pull request #7925: feat: support ssl key-encrypt-salt rotation
tzssangglass commented on code in PR #7925:
URL: https://github.com/apache/apisix/pull/7925#discussion_r973850799
##########
apisix/ssl.lua:
##########
@@ -55,23 +56,32 @@ function _M.server_name()
end
-local _aes_128_cbc_with_iv = false
+local _aes_128_cbc_with_iv_tbl = false
local function get_aes_128_cbc_with_iv()
- if _aes_128_cbc_with_iv == false then
+ if _aes_128_cbc_with_iv_tbl == false then
+ _aes_128_cbc_with_iv_tbl = core.table.new(2, 0)
local local_conf = core.config.local_conf()
- local iv = core.table.try_read_attr(local_conf, "apisix", "ssl", "key_encrypt_salt")
- if type(iv) =="string" and #iv == 16 then
- _aes_128_cbc_with_iv = assert(aes:new(iv, nil, aes.cipher(128, "cbc"), {iv = iv}))
- else
- _aes_128_cbc_with_iv = nil
+ local ivs = core.table.try_read_attr(local_conf, "apisix", "ssl", "key_encrypt_salt")
+ local type_ivs = type(ivs)
+
+ if type_ivs == "table" then
+ for _, iv in ipairs(ivs) do
+ local aes_with_iv = assert(aes:new(iv, nil, aes.cipher(128, "cbc"), {iv = iv}))
+ core.table.insert(_aes_128_cbc_with_iv_tbl, aes_with_iv)
+ end
+ elseif type_ivs == "string" then
+ local aes_with_iv = assert(aes:new(ivs, nil, aes.cipher(128, "cbc"), {iv = ivs}))
+ core.table.insert(_aes_128_cbc_with_iv_tbl, aes_with_iv)
Review Comment:
how about `type_ivs` is not `table` or `string`?
--
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: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org