fn key_agreement<B: AsRef<[u8]>>(
    context: &[u8],
    private_key: EphemeralPrivateKey,
    public_key: &UnparsedPublicKey<B>,
) -> Result<UnboundKey, error::Unspecified> {
    let context = &[context];
    agree_ephemeral(
        private_key,
        public_key,
        error::Unspecified,
        |shared_secret| {
            Ok(UnboundKey::from(
                Salt::new(HKDF_SHA512, SALT_ENCRYPTION)
                    .extract(shared_secret)
                    .expand(context, &CHACHA20_POLY1305)?,
            ))
        },
    )
}
/// Compute the shared key material from a private and public key.
Compute the shared key material from a private and public key.
Compute the shared key material from a private and public key .
fn key_agreement<B: AsRef<[u8]>>(
    context: &[u8],
    private_key: EphemeralPrivateKey,
    public_key: &UnparsedPublicKey<B>,
) -> Result<UnboundKey, error::Unspecified> {
    let context = &[context];
    agree_ephemeral(
        private_key,
        public_key,
        error::Unspecified,
        |shared_secret| {
            Ok(UnboundKey::from(
                Salt::new(HKDF_SHA512, SALT_ENCRYPTION)
                    .extract(shared_secret)
                    .expand(context, &CHACHA20_POLY1305)?,
            ))
        },
    )
}
fn key_agreement < B : AsRef < [ u8 ] > > ( context : & [ u8 ] , private_key : EphemeralPrivateKey , public_key : & UnparsedPublicKey < B > , ) -> Result < UnboundKey , error :: Unspecified > { let context = & [ context ] ; agree_ephemeral ( private_key , public_key , error :: Unspecified , | shared_secret | { Ok ( UnboundKey :: from ( Salt :: new ( HKDF_SHA512 , SALT_ENCRYPTION ) . extract ( shared_secret ) . expand ( context , & CHACHA20_POLY1305 ) ? , ) ) } , ) }
Compute the shared key material from a private and public key.
Compute the shared key material from a private and public key .
context
&[u8]
private_key
EphemeralPrivateKey
public_key
&UnparsedPublicKey<B>
context
&[u8]
private_key
EphemeralPrivateKey
public_key
&UnparsedPublicKey<B>