Struct rustls_ffi::cipher::rustls_certified_key [−][src]
pub struct rustls_certified_key { /* fields omitted */ }
Expand description
The complete chain of certificates to send during a TLS handshake,
plus a private key that matches the end-entity (leaf) certificate.
Corresponds to CertifiedKey
in the Rust API.
https://docs.rs/rustls/0.20.0/rustls/sign/struct.CertifiedKey.html
Implementations
#[no_mangle]pub extern "C" fn rustls_certified_key_build(
cert_chain: *const u8,
cert_chain_len: size_t,
private_key: *const u8,
private_key_len: size_t,
certified_key_out: *mut *const rustls_certified_key
) -> rustls_result
#[no_mangle]pub extern "C" fn rustls_certified_key_build(
cert_chain: *const u8,
cert_chain_len: size_t,
private_key: *const u8,
private_key_len: size_t,
certified_key_out: *mut *const rustls_certified_key
) -> rustls_result
Build a rustls_certified_key
from a certificate chain and a private key.
cert_chain
must point to a buffer of cert_chain_len
bytes, containing
a series of PEM-encoded certificates, with the end-entity (leaf)
certificate first.
private_key
must point to a buffer of private_key_len
bytes, containing
a PEM-encoded private key in either PKCS#1 or PKCS#8 format.
On success, this writes a pointer to the newly created
rustls_certified_key
in certified_key_out
. That pointer must later
be freed with rustls_certified_key_free
to avoid memory leaks. Note that
internally, this is an atomically reference-counted pointer, so even after
the original caller has called rustls_certified_key_free
, other objects
may retain a pointer to the object. The memory will be freed when all
references are gone.
#[no_mangle]pub extern "C" fn rustls_certified_key_get_certificate(
certified_key: *const rustls_certified_key,
i: size_t
) -> *const rustls_certificate
#[no_mangle]pub extern "C" fn rustls_certified_key_get_certificate(
certified_key: *const rustls_certified_key,
i: size_t
) -> *const rustls_certificate
Return the i-th rustls_certificate in the rustls_certified_key. 0 gives the end-entity certificate. 1 and higher give certificates from the chain. Indexes higher than the last available certificate return NULL.
The returned certificate is valid until the rustls_certified_key is freed.
#[no_mangle]pub extern "C" fn rustls_certified_key_clone_with_ocsp(
certified_key: *const rustls_certified_key,
ocsp_response: *const rustls_slice_bytes<'_>,
cloned_key_out: *mut *const rustls_certified_key
) -> rustls_result
#[no_mangle]pub extern "C" fn rustls_certified_key_clone_with_ocsp(
certified_key: *const rustls_certified_key,
ocsp_response: *const rustls_slice_bytes<'_>,
cloned_key_out: *mut *const rustls_certified_key
) -> rustls_result
Create a copy of the rustls_certified_key with the given OCSP response data as DER encoded bytes. The OCSP response may be given as NULL to clear any possibly present OCSP data from the cloned key. The cloned key is independent from its original and needs to be freed by the application.
“Free” a certified_key previously returned from rustls_certified_key_build. Since certified_key is actually an atomically reference-counted pointer, extant certified_key may still hold an internal reference to the Rust object. However, C code must consider this pointer unusable after “free“ing it. Calling with NULL is fine. Must not be called twice with the same value.