# ECDH and ECDSA in PGP with known public key

How are used ECDH and ECDSA in combination with public key ? Usually these methods are used for establish a secret themselves, so why (and how) are used combined with public and private key couple in OpenPGP?

The proposed internet standard RFC-6637: Elliptic Curve Cryptography (ECC) in OpenPGP says in section 8:

The method is a combination of an ECC Diffie-Hellman method to establish a shared secret, a key derivation method to process the shared secret into a derived key, and a key wrapping method that uses the derived key to protect a session key used to encrypt a message. The One-Pass Diffie-Hellman method C(1, 1, ECC CDH) [NIST-SP800-56A] MUST be implemented with the following restrictions: the ECC CDH primitive employed by this method is modified to always assume the cofactor as 1, the KDF specified in Section 7 is used, and the KDF parameters specified below are used.

…but there is no word about public key receiver's use, it might be used to protect confidentiality.

Sounds like a description of ECIES to me. ECIES is a hybrid cryptosystem that builds upon ECDH.

Basically: the static public key of the receiver is used together with an ephemeral key pair generated at the sender. The public key of the receiver and ephemeral private key of the sender are used to generate a "shared secret" using ECDH. This shared secret is used with a KDF to generate a session key. This session key is used to encrypt the message. Then the ephemeral public key is attached to the ciphertext. The private key can be safely destroyed.

To decrypt the same secret is calculated at the receiver using the static private key and the public key attached to the ciphertext. The KDF is applied again to generate the session key. Then the resulting key is used to decrypt the ciphertext.

As you can see, after encryption the sender isn't needed anymore. So this scheme can be used to encrypt static data such as files. The only thing the sender needs is a trusted public key to the receiver. This public key is for instance embedded in the PGP certificate of the receiver.

• I found some ECIES-related papers, but I am looking for an RFC that specify it, any pointer to it? I didn't find any. Tnx – Alexander.It Sep 11 '15 at 15:37
• RFC-6637 section 10 part 2 specifies how the public key used for ECIES is stored. The derived session key is then used like any other (wrapped) session key in PGP. – Maarten - reinstate Monica Nov 19 '18 at 14:39