pub struct DhPrivateKey { /* private fields */ }Expand description
Private key for DH.
Implementations§
Source§impl DhPrivateKey
impl DhPrivateKey
pub fn modulus(&self) -> &BigUint
pub fn subgroup_order(&self) -> &BigUint
pub fn generator(&self) -> &BigUint
Sourcepub fn to_public_key(&self) -> DhPublicKey
pub fn to_public_key(&self) -> DhPublicKey
Derive the matching public key.
pub fn params(&self) -> DhParams
Sourcepub fn agree_element(&self, peer: &DhPublicKey) -> Option<BigUint>
pub fn agree_element(&self, peer: &DhPublicKey) -> Option<BigUint>
Compute the shared secret with a peer’s public key.
Returns s = y_peer^x mod p, or None if
the peer key uses different domain parameters or fails subgroup validation.
Subgroup validation: checks that 1 < y_peer < p and that
y_peer^q ≡ 1 mod p, rejecting low-order and small-subgroup inputs.
Sourcepub fn to_key_blob(&self) -> Vec<u8> ⓘ
pub fn to_key_blob(&self) -> Vec<u8> ⓘ
Encode in binary format: [p, q, g, x].
Sourcepub fn from_key_blob(blob: &[u8]) -> Option<Self>
pub fn from_key_blob(blob: &[u8]) -> Option<Self>
Decode from binary format.
pub fn to_pem(&self) -> String
Sourcepub fn from_pem(pem: &str) -> Option<Self>
pub fn from_pem(pem: &str) -> Option<Self>
Returns None if the PEM label does not match or the payload is malformed.
pub fn to_xml(&self) -> String
Trait Implementations§
Source§impl Clone for DhPrivateKey
impl Clone for DhPrivateKey
Source§fn clone(&self) -> DhPrivateKey
fn clone(&self) -> DhPrivateKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DhPrivateKey
impl Debug for DhPrivateKey
Source§impl PartialEq for DhPrivateKey
impl PartialEq for DhPrivateKey
Source§fn eq(&self, other: &DhPrivateKey) -> bool
fn eq(&self, other: &DhPrivateKey) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Eq for DhPrivateKey
impl StructuralPartialEq for DhPrivateKey
Auto Trait Implementations§
impl Freeze for DhPrivateKey
impl RefUnwindSafe for DhPrivateKey
impl Send for DhPrivateKey
impl Sync for DhPrivateKey
impl Unpin for DhPrivateKey
impl UnsafeUnpin for DhPrivateKey
impl UnwindSafe for DhPrivateKey
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