# Can libsodium's X25519 encryption construction be generalized?

It is my understanding that libsodium's sealed_box is based on X25519, a Diffie-Hellman function: By combining the X25519 key agreement with a symmetric cipher and having a recipient derive the symmetric key, a message can be constructed that can only be decrypted by making use of the X25519 private key.

Can this construction be generalized to other Diffie-Hellman functions (ECDH with other curves, or the ordinary non-EC Diffie-Hellman)?

• Note that both the crypto_box and sealed_box use authenticated encryption. – kelalaka Jun 18 at 16:05

I don't know if libsodium's crypto_box conforms exactly to an official ECIES standard (there are many) in terms of how it formats the data. ECIES standards have a lot of options in terms of the group (DH group or EC curve), on what data is included in the derivations, and on the freshness of parameters (e.g. ephemeral vs multiple-use keys). Depending on these options, the resulting constructions may have different properties in terms of nonce-misuse-resistance, resistance to a compromise of the private key, resistance to side channels, etc. But the basic principle of hybrid encryption constructed on top of a key agreement is the same.