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> !Freeze for DhRef<T>
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