Sitemap
Press enter or click to view image in full size

Member-only story

The Beauty of Public Key Encryption with Key Encapsulation: HPKE

3 min readJun 28, 2025

--

We can, of course, encrypt data with RSA OAEP, but the keys are fairly large, and it is fairly process intensive. Our saviour has been the usage of elliptic curve cryptography (ECC). But, we can actually directly encrypt data with ECC, and so we use a key encapsulation method (KEM), and which is also used in PQC methods. With this, we use a Diffie-Hellman (DH) key exchange method — but do it in an offline way.

Let’s say that Bob wants to encrypt data for Alice. For this, Bob will have a private key of b, and a public key of b.G, and Alice will have a private key of a, and a public key of a.G. The base point on the elliptic curve is then G, and where a.G, is the point G added to itself for a times. Bob initially gets Alice’s public key (a.G) in a trusted way. He will then take his private key (b), and perform a Diffie-Hellman operation to give a resultant point of a.B.G. Next, he feeds this into the HKDF method to expand and extract into an AES key, along with some context data. This will derive a secret key (SecretKey), and which will be used to encrypt some plaintext:

Press enter or click to view image in full size

--

--

Prof Bill Buchanan OBE FRSE
Prof Bill Buchanan OBE FRSE

Written by Prof Bill Buchanan OBE FRSE

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.