pub struct PrivateKey { /* private fields */ }Expand description
A sealed-box recipient’s P-384 private key, held once, as an ecdh::StaticKey.
Implementations§
Source§impl PrivateKey
impl PrivateKey
Sourcepub fn generate(a: &Admitted) -> Result<Self, CryptoError>
pub fn generate(a: &Admitted) -> Result<Self, CryptoError>
Generates a fresh key in the FIPS module. Refuses outside FIPS mode, and under a profile that does not admit ECDH on P-384, HKDF-SHA384 and AES-256-GCM.
Sourcepub fn from_pkcs8_der(a: &Admitted, der: &[u8]) -> Result<Self, CryptoError>
pub fn from_pkcs8_der(a: &Admitted, der: &[u8]) -> Result<Self, CryptoError>
Imports a P-384 private key in a form crate::ecdh::StaticKey::from_pkcs8_der takes.
Refuses outside FIPS mode, under a profile that does not admit ECDH on P-384, HKDF-SHA384
and AES-256-GCM, and any key that function refuses on P-384 (CryptoError::SealPrivateKey).
Sourcepub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, CryptoError>
pub fn to_pkcs8_der(&self) -> Result<Zeroizing<Vec<u8>>, CryptoError>
The key’s PKCS#8 encoding, encoded by the module on each call into a buffer the caller owns and that is wiped on drop.
Sourcepub fn public_key(&self) -> &[u8] ⓘ
pub fn public_key(&self) -> &[u8] ⓘ
The raw public key: the uncompressed P-384 point.
Trait Implementations§
Auto Trait Implementations§
impl Forget for PrivateKey
impl Freeze for PrivateKey
impl Move for PrivateKey
impl RefUnwindSafe for PrivateKey
impl Send for PrivateKey
impl Sync for PrivateKey
impl Unpin for PrivateKey
impl UnsafeUnpin for PrivateKey
impl UnwindSafe for PrivateKey
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