Skip to content

Commit

Permalink
fix(pkey) fix compose of ecx key not effective
Browse files Browse the repository at this point in the history
Fix #187
  • Loading branch information
fffonion committed Dec 3, 2024
1 parent 9d414c9 commit 54db43b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/resty/openssl/pkey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,7 @@ local function compose_key(config)
key_type == evp_macro.EVP_PKEY_X25519 or
key_type == evp_macro.EVP_PKEY_ED448 or
key_type == evp_macro.EVP_PKEY_X448 then
key_free = function() end
key, err = ecx_lib.set_parameters(key_type, nil, config.params)
return ecx_lib.set_parameters(key_type, nil, config.params)
end

if err then
Expand Down
19 changes: 19 additions & 0 deletions t/openssl/pkey.t
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,31 @@ nil
}))
local out2 = myassert(newp_384:to_PEM('private'))
ngx.say(out == out2)
local p_ecx = myassert(require("resty.openssl.pkey").new({
type = "Ed25519",
}))
local out = myassert(p_ecx:to_PEM('private'))
local params = p_ecx:get_parameters()
local newp_ecx, err = myassert(require("resty.openssl.pkey").new({
type = "Ed25519",
params = {
private = params.private,
public = params.public,
}
}))
local out2 = myassert(newp_ecx:to_PEM('private'))
ngx.say(out == out2)
}
}
--- request
GET /t
--- response_body
true
true
--- no_error_log
[error]

Expand Down

0 comments on commit 54db43b

Please sign in to comment.