diff options
author | tb <> | 2024-12-10 08:40:30 +0000 |
---|---|---|
committer | tb <> | 2024-12-10 08:40:30 +0000 |
commit | b3d93b59d26fa80123892302071d566ee8f30930 (patch) | |
tree | 2542f39bf15e49eda926e59376de19e797b35c50 /src/lib/libtls/tls_internal.h | |
parent | c0f2dde01da58c00510ac95afabe0df82b7374ec (diff) | |
download | openbsd-b3d93b59d26fa80123892302071d566ee8f30930.tar.gz openbsd-b3d93b59d26fa80123892302071d566ee8f30930.tar.bz2 openbsd-b3d93b59d26fa80123892302071d566ee8f30930.zip |
Provide tls_peer_cert_common_name()
There is currently no sane way of getting your hands on the common name or
subject alternative name of the peer certificate from libtls. It is possible
to extract it from the peer cert's PEM by hand, but that way lies madness.
While the common name is close to being deprecated in the webpki, it is
still the de facto standard to identify client certs. It would be nice to
have a way to access the subject alternative names as well, but this is a
lot more difficult to expose in a clean and sane C interface due to its
multivaluedness.
Initial diff from henning, with input from beck, jsing and myself
henning and bluhm have plans of using this in syslogd.
ok beck
Diffstat (limited to 'src/lib/libtls/tls_internal.h')
-rw-r--r-- | src/lib/libtls/tls_internal.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_internal.h b/src/lib/libtls/tls_internal.h index 5ff48ed7c9..8e566a34e0 100644 --- a/src/lib/libtls/tls_internal.h +++ b/src/lib/libtls/tls_internal.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tls_internal.h,v 1.85 2024/03/26 06:24:52 joshua Exp $ */ | 1 | /* $OpenBSD: tls_internal.h,v 1.86 2024/12/10 08:40:30 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> | 3 | * Copyright (c) 2014 Jeremie Courreges-Anglas <jca@openbsd.org> |
4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
@@ -129,6 +129,7 @@ struct tls_conninfo { | |||
129 | int session_resumed; | 129 | int session_resumed; |
130 | char *version; | 130 | char *version; |
131 | 131 | ||
132 | char *common_name; | ||
132 | char *hash; | 133 | char *hash; |
133 | char *issuer; | 134 | char *issuer; |
134 | char *subject; | 135 | char *subject; |
@@ -238,6 +239,8 @@ struct tls_config *tls_config_new_internal(void); | |||
238 | struct tls *tls_new(void); | 239 | struct tls *tls_new(void); |
239 | struct tls *tls_server_conn(struct tls *ctx); | 240 | struct tls *tls_server_conn(struct tls *ctx); |
240 | 241 | ||
242 | int tls_get_common_name(struct tls *_ctx, X509 *_cert, const char *_in_name, | ||
243 | char **_out_common_name); | ||
241 | int tls_check_name(struct tls *ctx, X509 *cert, const char *servername, | 244 | int tls_check_name(struct tls *ctx, X509 *cert, const char *servername, |
242 | int *match); | 245 | int *match); |
243 | int tls_configure_server(struct tls *ctx); | 246 | int tls_configure_server(struct tls *ctx); |