pub struct Params<'a> { /* private fields */ }Expand description
An owned, finalized OSSL_PARAM array.
Created by ParamBuilder::build(). The lifetime 'a covers any borrowed
byte or string slices stored by pointer (zero-copy push calls).
Implementations§
Source§impl Params<'_>
impl Params<'_>
Sourcepub fn as_ptr(&self) -> *const OSSL_PARAM
pub fn as_ptr(&self) -> *const OSSL_PARAM
Return a const pointer to the first OSSL_PARAM in the array.
Pass this pointer to OpenSSL functions that take const OSSL_PARAM[].
The pointer is valid for the lifetime of self.
Source§impl Params<'_>
impl Params<'_>
Sourcepub unsafe fn from_owned_ptr(ptr: *mut OSSL_PARAM) -> Params<'static>
pub unsafe fn from_owned_ptr(ptr: *mut OSSL_PARAM) -> Params<'static>
Adopt an OpenSSL-allocated OSSL_PARAM array, taking ownership.
The array will be freed with OSSL_PARAM_free on drop. Use this to
wrap arrays returned by functions such as EVP_PKEY_todata.
§Safety
ptr must be a valid, OSSL_PARAM_END-terminated array allocated by
OpenSSL. After this call the caller must not use or free ptr.
Sourcepub fn as_mut_ptr(&mut self) -> *mut OSSL_PARAM
pub fn as_mut_ptr(&mut self) -> *mut OSSL_PARAM
Return a mutable pointer to the first OSSL_PARAM element.
Pass to functions such as EVP_PKEY_get_params that fill a
pre-prepared query array.
Sourcepub fn has_param(&self, key: &CStr) -> bool
pub fn has_param(&self, key: &CStr) -> bool
Return true if a parameter with the given name exists in this array.
Sourcepub fn get_int(&self, key: &CStr) -> Result<i32, ErrorStack>
pub fn get_int(&self, key: &CStr) -> Result<i32, ErrorStack>
Locate key and read its value as an i32.
§Errors
Returns Err if the key is not found or the value cannot be converted.
Sourcepub fn get_uint(&self, key: &CStr) -> Result<u32, ErrorStack>
pub fn get_uint(&self, key: &CStr) -> Result<u32, ErrorStack>
Locate key and read its value as a u32.
§Errors
Sourcepub fn get_size_t(&self, key: &CStr) -> Result<usize, ErrorStack>
pub fn get_size_t(&self, key: &CStr) -> Result<usize, ErrorStack>
Locate key and read its value as a usize.
§Errors
Sourcepub fn get_i64(&self, key: &CStr) -> Result<i64, ErrorStack>
pub fn get_i64(&self, key: &CStr) -> Result<i64, ErrorStack>
Locate key and read its value as an i64.
§Errors
Sourcepub fn get_u64(&self, key: &CStr) -> Result<u64, ErrorStack>
pub fn get_u64(&self, key: &CStr) -> Result<u64, ErrorStack>
Locate key and read its value as a u64.
§Errors
Sourcepub fn get_bn(&self, key: &CStr) -> Result<Vec<u8>, ErrorStack>
pub fn get_bn(&self, key: &CStr) -> Result<Vec<u8>, ErrorStack>
Locate key and read it as BIGNUM, returning big-endian bytes.
§Errors
Returns Err if the key is not found or is not a BIGNUM parameter.
Sourcepub fn get_octet_string(&self, key: &CStr) -> Result<&[u8], ErrorStack>
pub fn get_octet_string(&self, key: &CStr) -> Result<&[u8], ErrorStack>
Locate key and return a borrowed slice of its octet-string data.
The returned slice is valid for the lifetime of self.
§Errors
Sourcepub fn get_utf8_string(&self, key: &CStr) -> Result<&CStr, ErrorStack>
pub fn get_utf8_string(&self, key: &CStr) -> Result<&CStr, ErrorStack>
Locate key and return a borrowed CStr of its UTF-8 string data.
The returned reference is valid for the lifetime of self.