pub struct DhRef<T>(/* private fields */);
Implementations§
source§impl<T> DhRef<T>where
T: HasParams,
impl<T> DhRef<T>where T: HasParams,
sourcepub fn params_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
pub fn params_to_pem(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the parameters into a PEM-encoded PKCS#3 DHparameter structure.
The output will have a header of -----BEGIN DH PARAMETERS-----
.
This corresponds to PEM_write_bio_DHparams
.
sourcepub fn params_to_der(&self) -> Result<Vec<u8>, ErrorStack>
pub fn params_to_der(&self) -> Result<Vec<u8>, ErrorStack>
Serializes the parameters into a DER-encoded PKCS#3 DHparameter structure.
This corresponds to i2d_DHparams
.
sourcepub fn check_key(&self) -> Result<bool, ErrorStack>
pub fn check_key(&self) -> Result<bool, ErrorStack>
Validates DH parameters for correctness
This corresponds to DH_check_key
.
source§impl<T> DhRef<T>where
T: HasPublic,
impl<T> DhRef<T>where T: HasPublic,
sourcepub fn public_key(&self) -> &BigNumRef
pub fn public_key(&self) -> &BigNumRef
Returns the public key from the DH instance.
This corresponds to DH_get0_key
.
source§impl<T> DhRef<T>where
T: HasPrivate,
impl<T> DhRef<T>where T: HasPrivate,
sourcepub fn compute_key(&self, public_key: &BigNumRef) -> Result<Vec<u8>, ErrorStack>
pub fn compute_key(&self, public_key: &BigNumRef) -> Result<Vec<u8>, ErrorStack>
Computes a shared secret from the own private key and the given public_key
.
This corresponds to DH_compute_key
.
sourcepub fn private_key(&self) -> &BigNumRef
pub fn private_key(&self) -> &BigNumRef
Returns the private key from the DH instance.
This corresponds to DH_get0_key
.
Trait Implementations§
source§impl<T> ForeignTypeRef for DhRef<T>
impl<T> ForeignTypeRef for DhRef<T>
impl<T> Send for DhRef<T>
impl<T> Sync for DhRef<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for DhRef<T>
impl<T> Unpin for DhRef<T>where T: Unpin,
impl<T> UnwindSafe for DhRef<T>where T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more