mirror of
https://github.com/brunoos/luasec.git
synced 2025-02-20 18:52:46 +01:00
Check if private key matches cert only if both key and cert are set
This commit is contained in:
parent
8e5bcefbb6
commit
55d45f0542
@ -60,11 +60,11 @@ function newcontext(cfg)
|
|||||||
if cfg.certificate then
|
if cfg.certificate then
|
||||||
succ, msg = context.loadcert(ctx, cfg.certificate)
|
succ, msg = context.loadcert(ctx, cfg.certificate)
|
||||||
if not succ then return nil, msg end
|
if not succ then return nil, msg end
|
||||||
end
|
if cfg.key and context.checkkey then
|
||||||
if context.checkkey then
|
|
||||||
succ = context.checkkey(ctx)
|
succ = context.checkkey(ctx)
|
||||||
if not succ then return nil, "private key does not match public key" end
|
if not succ then return nil, "private key does not match public key" end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
-- Load the CA certificates
|
-- Load the CA certificates
|
||||||
if cfg.cafile or cfg.capath then
|
if cfg.cafile or cfg.capath then
|
||||||
succ, msg = context.locations(ctx, cfg.cafile, cfg.capath)
|
succ, msg = context.locations(ctx, cfg.cafile, cfg.capath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user