Skip to main content

Params

Struct Params 

Source
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<'_>

Source

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<'_>

Source

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.

Source

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.

Source

pub fn has_param(&self, key: &CStr) -> bool

Return true if a parameter with the given name exists in this array.

Source

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.

Source

pub fn get_uint(&self, key: &CStr) -> Result<u32, ErrorStack>

Locate key and read its value as a u32.

§Errors
Source

pub fn get_size_t(&self, key: &CStr) -> Result<usize, ErrorStack>

Locate key and read its value as a usize.

§Errors
Source

pub fn get_i64(&self, key: &CStr) -> Result<i64, ErrorStack>

Locate key and read its value as an i64.

§Errors
Source

pub fn get_u64(&self, key: &CStr) -> Result<u64, ErrorStack>

Locate key and read its value as a u64.

§Errors
Source

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.

Source

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
Source

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.

§Errors

Trait Implementations§

Source§

impl Drop for Params<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for Params<'_>

Source§

impl Sync for Params<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for Params<'a>

§

impl<'a> RefUnwindSafe for Params<'a>

§

impl<'a> Unpin for Params<'a>

§

impl<'a> UnsafeUnpin for Params<'a>

§

impl<'a> UnwindSafe for Params<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.