aboutsummaryrefslogtreecommitdiff
path: root/src/core/stream.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/core/stream.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/core/stream.c')
-rw-r--r--src/core/stream.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/core/stream.c b/src/core/stream.c
index e0da3582..61a8a3ba 100644
--- a/src/core/stream.c
+++ b/src/core/stream.c
@@ -12,12 +12,13 @@
#include <string.h>
-#include "core/nng_impl.h"
+#include "nng_impl.h"
-#include "core/sockfd.h"
-#include "core/tcp.h"
-#include "supplemental/tls/tls_api.h"
-#include "supplemental/websocket/websocket.h"
+#include "sockfd.h"
+#include "tcp.h"
+
+#include "../supplemental/tls/tls_api.h"
+#include "../supplemental/websocket/websocket.h"
static struct {
const char *scheme;
@@ -385,6 +386,15 @@ nng_stream_get_addr(nng_stream *s, const char *n, nng_sockaddr *v)
}
nng_err
+nng_stream_peer_cert(nng_stream *s, nng_tls_cert **certp)
+{
+ if (s->s_peer_cert == NULL) {
+ return (NNG_ENOTSUP);
+ }
+ return (s->s_peer_cert(s, certp));
+}
+
+nng_err
nng_stream_dialer_get_int(nng_stream_dialer *d, const char *n, int *v)
{
return (nni_stream_dialer_get(d, n, v, NULL, NNI_TYPE_INT32));