pub fn key_encryption_key<
    PK1: Into<EphemeralPublicKeyBytes>,
    PK2: Into<EphemeralPublicKeyBytes>,
    PK3: Into<EphemeralPublicKeyBytes>,
>(
    dkg_id: IDkgId,
    dealer_public_key: PK1,
    receiver_public_key: PK2,
    diffie_hellman: PK3,
) -> KeyEncryptionKey {
    let dealer_public_key: EphemeralPublicKeyBytes = dealer_public_key.into();
    let receiver_public_key: EphemeralPublicKeyBytes = receiver_public_key.into();
    let diffie_hellman: EphemeralPublicKeyBytes = diffie_hellman.into();
    let mut hash = Sha256::new();
    hash.write(DomainSeparationContext::new(DOMAIN_SEPERATOR_DH_ENCRYPT).as_bytes());
    hash.write(&serde_cbor::to_vec(&dkg_id).expect("Failed to serialize to CBOR"));
    hash.write(&dealer_public_key.0);
    hash.write(&receiver_public_key.0);
    hash.write(&diffie_hellman.0);
    hash_to_fr(hash)
}
/// Computes the key encryption key added/subtracted to shares during
/// encryption/decryption.
///
/// One node (the dealer) generates a secret key (the share) for another (the
/// receiver).  In order to transfer this key securely, it is encrypted and
/// subsequently decrypted with a key encryption key derived here.
///
/// # Arguments
/// * `dkg_id` - the DKG this Diffie Hellman is to be used for.
/// * `dealer_public_key` - the public key of the node issuing the key share.
/// * `receiver_public_key` - the public key of the node receiving the key
///   share.
/// * `diffie_hellman` - the output of the Diffie Hellman; as this is computed
///   in various ways it is up to the caller to provide it.
/// # Panics
/// This method is not expected to panic.
Computes the key encryption key added/subtracted to shares during
encryption/decryption.

One node (the dealer) generates a secret key (the share) for another (the
receiver).  In order to transfer this key securely, it is encrypted and
subsequently decrypted with a key encryption key derived here.
Computes the key encryption key added / subtracted to shares during encryption / decryption . One node ( the dealer ) generates a secret key ( the share ) for another ( the receiver ) . In order to transfer this key securely it is encrypted and subsequently decrypted with a key encryption key derived here .
pub fn key_encryption_key<
    PK1: Into<EphemeralPublicKeyBytes>,
    PK2: Into<EphemeralPublicKeyBytes>,
    PK3: Into<EphemeralPublicKeyBytes>,
>(
    dkg_id: IDkgId,
    dealer_public_key: PK1,
    receiver_public_key: PK2,
    diffie_hellman: PK3,
) -> KeyEncryptionKey {
    let dealer_public_key: EphemeralPublicKeyBytes = dealer_public_key.into();
    let receiver_public_key: EphemeralPublicKeyBytes = receiver_public_key.into();
    let diffie_hellman: EphemeralPublicKeyBytes = diffie_hellman.into();
    let mut hash = Sha256::new();
    hash.write(DomainSeparationContext::new(DOMAIN_SEPERATOR_DH_ENCRYPT).as_bytes());
    hash.write(&serde_cbor::to_vec(&dkg_id).expect("Failed to serialize to CBOR"));
    hash.write(&dealer_public_key.0);
    hash.write(&receiver_public_key.0);
    hash.write(&diffie_hellman.0);
    hash_to_fr(hash)
}
pub fn key_encryption_key < PK1 : Into < EphemeralPublicKeyBytes > , PK2 : Into < EphemeralPublicKeyBytes > , PK3 : Into < EphemeralPublicKeyBytes > , > ( dkg_id : IDkgId , dealer_public_key : PK1 , receiver_public_key : PK2 , diffie_hellman : PK3 , ) -> KeyEncryptionKey { let dealer_public_key : EphemeralPublicKeyBytes = dealer_public_key . into ( ) ; let receiver_public_key : EphemeralPublicKeyBytes = receiver_public_key . into ( ) ; let diffie_hellman : EphemeralPublicKeyBytes = diffie_hellman . into ( ) ; let mut hash = Sha256 :: new ( ) ; hash . write ( DomainSeparationContext :: new ( DOMAIN_SEPERATOR_DH_ENCRYPT ) . as_bytes ( ) ) ; hash . write ( & serde_cbor :: to_vec ( & dkg_id ) . expect ( " " ) ) ; hash . write ( & dealer_public_key . 0 ) ; hash . write ( & receiver_public_key . 0 ) ; hash . write ( & diffie_hellman . 0 ) ; hash_to_fr ( hash ) }
Computes the key encryption key added/subtracted to shares during
encryption/decryption.
Computes the key encryption key added / subtracted to shares during encryption / decryption .
dkg_id
IDkgId
dealer_public_key
PK1
receiver_public_key
PK2
diffie_hellman
PK3
dkg_id
IDkgId
dealer_public_key
PK1
receiver_public_key
PK2
diffie_hellman
PK3
panics
This method is not expected to panic.
This method is not expected to panic .