pub struct KeygenCtx { /* private fields */ }Expand description
Context for generating asymmetric key pairs (EVP_PKEY_CTX in keygen mode).
Implementations§
Source§impl KeygenCtx
impl KeygenCtx
Sourcepub fn new(name: &CStr) -> Result<Self, ErrorStack>
pub fn new(name: &CStr) -> Result<Self, ErrorStack>
Create a keygen context for the named algorithm.
Common names: c"RSA", c"EC", c"ED25519", c"X25519".
§Errors
Sourcepub fn set_params(&mut self, params: &Params<'_>) -> Result<(), ErrorStack>
pub fn set_params(&mut self, params: &Params<'_>) -> Result<(), ErrorStack>
Configure parameters before calling generate.
§Errors
Sourcepub fn get_params(&self, params: &mut Params<'_>) -> Result<(), ErrorStack>
pub fn get_params(&self, params: &mut Params<'_>) -> Result<(), ErrorStack>
Retrieve parameter values from this keygen context.
Build a Params with placeholder values for the
keys you want, call this method, then read back with params.get_*.
Useful for reading algorithm-negotiated parameters after keygen initialisation (e.g. security strength, EC group name, RSA modulus size).
§Errors
Returns Err if EVP_PKEY_CTX_get_params fails.
Sourcepub fn security_bits(&self) -> Result<u32, ErrorStack>
pub fn security_bits(&self) -> Result<u32, ErrorStack>
Return the security strength of the key operation in bits.
Available after keygen initialisation; reads OSSL_PKEY_PARAM_SECURITY_BITS
("security-bits").
§Errors
Returns Err if the context does not support this parameter or is not
sufficiently initialised.