pub struct AgreementSecretKey(/* private fields */);Expand description
A key-agreement.secret-key: the private half of an agreement keypair.
agree is one-shot on the immutable key; the derivation
state lives in the DeriveInput it returns.
Implementations§
Source§impl AgreementSecretKey
impl AgreementSecretKey
Sourcepub async fn agree(
&self,
peer: &AgreementPublicKey,
) -> Result<DeriveInput, Error>
pub async fn agree( &self, peer: &AgreementPublicKey, ) -> Result<DeriveInput, Error>
The shared secret with peer, as a DeriveInput whose grants
are copied from this key’s mint options.
The returned input has a natural output length — the agreement’s
full shared secret — so derive_bits(None) returns the whole
secret and hkdf_sha2::prepare_from accepts it as IKM.
Fails Error::InvalidKey if the shared secret is the all-zero
value (a small-order peer; the mandatory contributory check,
performed in constant time) or if peer is bound to a different
algorithm than this key.
Sourcepub fn algorithm_name(&self) -> String
pub fn algorithm_name(&self) -> String
Sourcepub fn can_derive_bits(&self) -> bool
pub fn can_derive_bits(&self) -> bool
Whether inputs agreed by this key may yield raw bits. See
DeriveOptions::derive_bits.
Sourcepub fn can_derive_key(&self) -> bool
pub fn can_derive_key(&self) -> bool
Whether inputs agreed by this key may mint keys. See
DeriveOptions::derive_key.
Sourcepub fn extractable(&self) -> bool
pub fn extractable(&self) -> bool
Whether the export functions may return this key’s material (see
Mac::extractable).
Sourcepub async fn export_key_jwk(&self) -> Result<String, Error>
pub async fn export_key_jwk(&self) -> Result<String, Error>
The secret key as a JWK (an RFC 8037 OKP private key for X25519);
fails Error::NotExtractable unless the key was minted
extractable.
Sourcepub async fn export_key_pkcs8(&self) -> Result<Vec<u8>, Error>
pub async fn export_key_pkcs8(&self) -> Result<Vec<u8>, Error>
The secret key as a PKCS#8 PrivateKeyInfo (DER), behind the same
extractability gate as export_key_jwk.