TlsCertificate.from_files


Description:

[ CCode ( has_construct_function = false ) ]
public TlsCertificate.from_files (string cert_file, string key_file) throws Error

Creates a TlsCertificate from the PEM-encoded data in cert_file and key_file.

The returned certificate will be the first certificate found in cert_file. As of GLib 2.44, if cert_file contains more certificates it will try to load a certificate chain. All certificates will be verified in the order found (top-level certificate should be the last one in the file) and the issuer property of each certificate will be set accordingly if the verification succeeds. If any certificate in the chain cannot be verified, the first certificate in the file will still be returned.

If either file cannot be read or parsed, the function will return null and set throws. Otherwise, this behaves like TlsCertificate.from_pem.

Parameters:

cert_file

file containing one or more PEM-encoded certificates to import

key_file

file containing a PEM-encoded private key to import

Returns:

the new certificate, or null on error