lunarmodules / luasec

LuaSec
Other
364 stars 133 forks source link

ssl: Add :getlocalchain() + :getlocalcertificate() to mirror peer methods #192

Closed mwild1 closed 1 year ago

mwild1 commented 2 years ago

These methods mirror the existing methods that fetch the peer certificate and chain. Due to various factors (SNI, multiple key types, etc.) it is not always trivial for an application to determine what certificate was presented to the client. However there are various use-cases where this is needed, such as tls-server-end-point channel binding and OCSP stapling.

Requires OpenSSL 1.0.2+ (note: SSL_get_certificate() has existed for a very long time, but was lacking documentation until OpenSSL 3.0).

brunoos commented 2 years ago

I'm a little busy with personal stuffs, but I will review this PR as soon as possible.