| 1 | #cxx . . $ `<file>/mlspp/lib/hpke/src/dhkem.h`/pragma once |
| 2 | |
| 3 | #include <hpke/hpke.h>cxx . . $ `<file>/mlspp/lib/hpke/include/hpke/hpke.h`/ |
| 4 | |
| 5 | #include "group.h"cxx . . $ `<file>/mlspp/lib/hpke/src/group.h`/ |
| 6 | |
| 7 | namespace mlsppcxx . . $ mlspp/::hpkecxx . . $ mlspp/hpke/ { |
| 8 | |
| 9 | struct DHKEMcxx . . $ mlspp/hpke/DHKEM# : public KEMcxx . . $ mlspp/hpke/KEM# |
| 10 | { |
| 11 | struct PrivateKeycxx . . $ mlspp/hpke/DHKEM#PrivateKey# : public KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey# |
| 12 | { |
| 13 | PrivateKeycxx . . $ mlspp/hpke/DHKEM#PrivateKey#PrivateKey(a2bbe50630eaea02).(Groupcxx . . $ mlspp/hpke/Group#::PrivateKeycxx . . $ mlspp/hpke/Group#PrivateKey#* group_priv_in); |
| 14 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#> public_keycxx . . $ mlspp/hpke/DHKEM#PrivateKey#public_key(db950997dbdd512b).() const override; |
| 15 | |
| 16 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<Groupcxx . . $ mlspp/hpke/Group#::PrivateKeycxx . . $ mlspp/hpke/Group#PrivateKey#> group_privcxx . . $ mlspp/hpke/DHKEM#PrivateKey#group_priv.; |
| 17 | }; |
| 18 | |
| 19 | template<KEMcxx . . $ mlspp/hpke/KEM#::IDcxx . . $ mlspp/hpke/KEM#ID#> |
| 20 | static const DHKEMcxx . . $ mlspp/hpke/DHKEM#& getcxx . . $ mlspp/hpke/DHKEM#get(c298abef80e23fa6).(); |
| 21 | |
| 22 | ~cxx . . $ mlspp/hpke/DHKEM#`~DHKEM`(ced63f7c635d850d).DHKEMcxx . . $ mlspp/hpke/DHKEM#() override = default; |
| 23 | |
| 24 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#> generate_key_paircxx . . $ mlspp/hpke/DHKEM#generate_key_pair(cb2cb9028da54d79).() const override; |
| 25 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#> derive_key_paircxx . . $ mlspp/hpke/DHKEM#derive_key_pair(b1a67661546df615).( |
| 26 | const bytescxx . . $ mlspp/bytes_ns/bytes#& ikm) const override; |
| 27 | |
| 28 | bytescxx . . $ mlspp/bytes_ns/bytes# serializecxx . . $ mlspp/hpke/DHKEM#serialize(f76243b94cf1479f).(const KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#& pk) const override; |
| 29 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#> deserializecxx . . $ mlspp/hpke/DHKEM#deserialize(3971047ebd94cce).(const bytescxx . . $ mlspp/bytes_ns/bytes#& enc) const override; |
| 30 | |
| 31 | bytescxx . . $ mlspp/bytes_ns/bytes# serialize_privatecxx . . $ mlspp/hpke/DHKEM#serialize_private(659c63e46d9645fb).(const KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#& sk) const override; |
| 32 | stdcxx . . $ std/::unique_ptrcxx . . $ std/unique_ptr#<KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#> deserialize_privatecxx . . $ mlspp/hpke/DHKEM#deserialize_private(b1a67661546df615).( |
| 33 | const bytescxx . . $ mlspp/bytes_ns/bytes#& skm) const override; |
| 34 | |
| 35 | stdcxx . . $ std/::paircxx . . $ std/pair#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> encapcxx . . $ mlspp/hpke/DHKEM#encap(326a9ee7a29d5f25).(const KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#& pk) const override; |
| 36 | bytescxx . . $ mlspp/bytes_ns/bytes# decapcxx . . $ mlspp/hpke/DHKEM#decap(e80f053e4b107a3d).(const bytescxx . . $ mlspp/bytes_ns/bytes#& enc, const KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#& sk) const override; |
| 37 | |
| 38 | stdcxx . . $ std/::paircxx . . $ std/pair#<bytescxx . . $ mlspp/bytes_ns/bytes#, bytescxx . . $ mlspp/bytes_ns/bytes#> auth_encapcxx . . $ mlspp/hpke/DHKEM#auth_encap(70a5a9729afdc401).(const KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#& pkR, |
| 39 | const KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#& skS) const override; |
| 40 | bytescxx . . $ mlspp/bytes_ns/bytes# auth_decapcxx . . $ mlspp/hpke/DHKEM#auth_decap(ba74d0d94964aa1d).(const bytescxx . . $ mlspp/bytes_ns/bytes#& enc, |
| 41 | const KEMcxx . . $ mlspp/hpke/KEM#::PublicKeycxx . . $ mlspp/hpke/KEM#PublicKey#& pkS, |
| 42 | const KEMcxx . . $ mlspp/hpke/KEM#::PrivateKeycxx . . $ mlspp/hpke/KEM#PrivateKey#& skR) const override; |
| 43 | |
| 44 | private: |
| 45 | const Groupcxx . . $ mlspp/hpke/Group#& groupcxx . . $ mlspp/hpke/DHKEM#group.; |
| 46 | const KDFcxx . . $ mlspp/hpke/KDF#& kdfcxx . . $ mlspp/hpke/DHKEM#kdf.; |
| 47 | bytescxx . . $ mlspp/bytes_ns/bytes# suite_idcxx . . $ mlspp/hpke/DHKEM#suite_id.; |
| 48 | |
| 49 | bytescxx . . $ mlspp/bytes_ns/bytes# extract_and_expandcxx . . $ mlspp/hpke/DHKEM#extract_and_expand(802fe03ef4f7e693).(const bytescxx . . $ mlspp/bytes_ns/bytes#& dh, const bytescxx . . $ mlspp/bytes_ns/bytes#& kem_context) const; |
| 50 | |
| 51 | DHKEMcxx . . $ mlspp/hpke/DHKEM#DHKEM(3111de88e9615f4c).(KEMcxx . . $ mlspp/hpke/KEM#::IDcxx . . $ mlspp/hpke/KEM#ID# kem_id_in, const Groupcxx . . $ mlspp/hpke/Group#& group_in, const KDFcxx . . $ mlspp/hpke/KDF#& kdf_in); |
| 52 | friend DHKEMcxx . . $ mlspp/hpke/DHKEM# make_dhkemcxx . . $ mlspp/hpke/make_dhkem(62112254e1d2ef0c).(KEMcxx . . $ mlspp/hpke/KEM#::IDcxx . . $ mlspp/hpke/KEM#ID# kem_id_in, |
| 53 | const Groupcxx . . $ mlspp/hpke/Group#& group_in, |
| 54 | const KDFcxx . . $ mlspp/hpke/KDF#& kdf_in); |
| 55 | }; |
| 56 | |
| 57 | } // namespace mlspp::hpke |