Using certificates and keys from a list

Doug Hardie <[email protected]> Fri, 3 Apr 2026 21:17:41 -0700
Newsgroups gmane.comp.encryption.openssl.user
Message-ID <[email protected]>
I have an application that needs to dynamically select the certificates and=
 keys.  Currently I have it using SSL_use_certificate_file(ssl, file, SSL_F=
ILETYPE_PEM) to read the certificate from a file and SSL_use_PrivateKey_fil=
e(ssl, file, SSL_FILETYPE_PEM) to access the keys from a table of  file nam=
es of the certificates and keys.  This works if the key files are world rea=
dable.  However, the application starts as root, and they switches to user =
nobody.  Hence it is then unable to access the keys if they are properly pr=
otected.

The solution is to read the certificates and keys into memory while still r=
unning as root.  However, it is not obvious which SSL calls should be used.=
  Should I get the sizes of each, allocate memory and then read them into t=
hat memory and use a table of those addresses.  Then use SSL_use_certificat=
e(SSL *ssl, X509 *x) to load the certificate into the SSL and then SSL_use_=
PrivateKey(SSL *ssl, EVP_PKEY *pkey) to load the key?  It seems like I am m=
issing something.

-- Doug

--=20
You received this message because you are subscribed to the Google Groups "=
openssl-users" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to openssl-users+unsubscribe-MCmKBN63+Bmbup2nOX2J7Q@public.gmane.org
To view this discussion visit https://groups.google.com/a/openssl.org/d/msg=
id/openssl-users/51A06B09-EA63-4AB6-9447-71703025DDD2%40lafn.org.