SSL_SET1_PARAM(3)
π SSL_SET1_PARAM(3) β get & set verification parameters π
okay so bestie, this one's from the Library Functions Manual and it's literally all about the little knob-board that controls how TLS verification behaves. let's get into it β¨
π NAME π
SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param β get and set verification parameters, that's the whole vibe π«Ά
β¨ SYNOPSIS β¨
she lives in library βlibsslβ libcrypto, so you're gonna want:
#include <openssl/ssl.h>
then the four little icons themselves:
X509_VERIFY_PARAM *
SSL_CTX_get0_param(SSL_CTX *ctx);
X509_VERIFY_PARAM *
SSL_get0_param(SSL *ssl);
int
SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);
int
SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);
πΈ DESCRIPTION πΈ
the getters π
SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer to the verification parameters for ctx or ssl, respectively. like, an internal pointer, okay? π
β οΈ the returned pointer must not be freed by the calling application β not yours to yeet, bestie. but the application can modify the parameters pointed to, to suit its needs: for example to add a hostname check. so you get to redecorate, you just can't demolish the building π β¨
the setters π¦
SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters to vpm for ctx or ssl. straightforward, no notes, ate π
β RETURN VALUES β
SSL_CTX_get0_param()andSSL_get0_param()return a pointer to anX509_VERIFY_PARAMstructure. cute little handoff πSSL_CTX_set1_param()andSSL_set1_param()return1for success or0for failure. classic 1-or-0 energy, no cap π«Ά
π EXAMPLES π
say you wanna check that the hostname matches www.foo.com in the peer certificate β iconique behavior, honestly:
X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);
X509_VERIFY_PARAM_set1_host(vpm, "www.foo.com", 0);
see how we grabbed the internal pointer and just... used it? main character energy fr fr π
π₯ SEE ALSO π₯
go read those too, iykyk πΈ
π HISTORY π
SSL_CTX_set1_param()andSSL_set1_param()first appeared in OpenSSL1.0.0and have been available since OpenBSD4.9. old money πSSL_CTX_get0_param()andSSL_get0_param()first appeared in OpenSSL1.0.2and have been available since OpenBSD6.3. late bloomer but slayed π¦
k that's the page!! brought to you by Debian, dated June 8, 2025 β go forth and verify those params, bestie, ily, mwah ππβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2015 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms