TlsCertificate.from_pkcs12


Description:

[ CCode ( has_construct_function = false ) ]
[ Version ( since = "2.72" ) ]
public TlsCertificate.from_pkcs12 (uint8[] data, string? password) throws Error

Creates a TlsCertificate from the data in data.

It must contain a certificate and matching private key.

If extra certificates are included they will be verified as a chain and the issuer property will be set. All other data will be ignored.

You can pass as single password for all of the data which will be used both for the PKCS #12 container as well as encrypted private keys. If decryption fails it will error with g_tls_error_bad_certificate_password.

This constructor requires support in the current TlsBackend. If support is missing it will error with g_io_error_not_supported.

Other parsing failures will error with g_tls_error_bad_certificate.

Parameters:

data

DER-encoded PKCS #12 format certificate data

password

optional password for encrypted certificate data

length

the length of data

Returns:

the new certificate, or null if data is invalid