gtpc1m5o | Transmission Control Protocol/Internet Protocol |
The SSL_CTX_use_certificate_chain_file function loads the chain
of certificates for use with a Secure Sockets Layer (SSL) session using a
specific context (CTX) structure.
Format
#include <openssl/ssl.h>
int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file)
- ctx
- A pointer to a token returned on the SSL_CTX_new call or the
SSL_CTX_new_shared call.
- file
- A pointer to the name of the file that contains the chain of
certificates. The file that contains the certificate chain must be in
PEM (base64 encoded) format. The maximum length is 255
characters.
Normal Return
Return code 1 indicates that the function was successful.
Error Return
A return code equal to 0 indicates an error. The following are the
most likely causes of errors:
- The certificate file does not exist or you do not have permission to read
that file.
- The certificate file that contains the certificate chain is not in PEM
(base64 encoded) format.
- If you loaded a private key file before issuing this function, the private
key in that file does not match the corresponding public key in the
certificate.
Programming Considerations
- The first certificate in the file must be the certificate for your
application. The next certificate in the file must be the certificate
for the certificate authority (CA) that signed the certificate for your
application. Subsequent certificates, if any exist, are for the CAs in
the signing sequence.
- The entire list of certificates is passed to the remote node during the
SSL handshake.
- Each SSL structure that is created from this CTX structure (by issuing the
SSL_new function) inherits the certificates of that CTX
structure.
- If you need only one certificate rather than a chain of certificates, you
can use either the SSL_CTX_use_certificate_file or
SSL_use_certificate_file function.
Examples
For sample SSL applications, go to http://www.ibm.com/tpf/pubs/tpfpubs.htm,
click SSL for the TPF 4.1 System: An Online User's
Guide, and click Examples from the left navigation
bar.
Related Information