aboutsummaryrefslogtreecommitdiff
path: root/src/nng.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-10-05 16:51:15 -0700
committerGarrett D'Amore <garrett@damore.org>2025-10-05 20:56:39 -0700
commit06d6d80f8c92ef1d3bd7c00c919e10a411183cb3 (patch)
treeedf8d4cff9b2f595ccd9e3cb4db3cf31eb13bc02 /src/nng.c
parentd1bd64c8251171ac8e1d4e71ab8726c2a64fd55a (diff)
downloadnng-06d6d80f8c92ef1d3bd7c00c919e10a411183cb3.tar.gz
nng-06d6d80f8c92ef1d3bd7c00c919e10a411183cb3.tar.bz2
nng-06d6d80f8c92ef1d3bd7c00c919e10a411183cb3.zip
fixes #2173 New TLS cert API - replaces the properties for CN and ALTNAMES.
This will replace the NNG_OPT_TLS_PEER_ALTNAMES and NNG_OPT_TLS_PEER_CN properties, and gives a bit more access to the certificate, as well as direct access to the raw DER form, which should allow use in other APIs.
Diffstat (limited to 'src/nng.c')
-rw-r--r--src/nng.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/nng.c b/src/nng.c
index 9b155599..39da87d4 100644
--- a/src/nng.c
+++ b/src/nng.c
@@ -670,7 +670,7 @@ void
nng_dialer_start_aio(nng_dialer did, int flags, nng_aio *aio)
{
nni_dialer *d;
- int rv;
+ int rv;
if (aio != NULL) {
nni_aio_reset(aio);
@@ -1375,6 +1375,20 @@ nng_pipe_get_addr(nng_pipe id, const char *n, nng_sockaddr *v)
return (pipe_get(id, n, v, NULL, NNI_TYPE_SOCKADDR));
}
+nng_err
+nng_pipe_peer_cert(nng_pipe p, nng_tls_cert **certp)
+{
+ nng_err rv;
+ nni_pipe *pipe;
+
+ if ((rv = nni_pipe_find(&pipe, p.id)) != 0) {
+ return (rv);
+ }
+ rv = nni_pipe_peer_cert(pipe, certp);
+ nni_pipe_rele(pipe);
+ return (rv);
+}
+
nng_socket
nng_pipe_socket(nng_pipe p)
{