| 1 | #pragma once |
| 2 | |
| 3 | #include <hpke/hpke.h> |
| 4 | |
| 5 | namespace mlspp::hpke { |
| 6 | |
| 7 | struct ExportOnlyCipher : public AEAD |
| 8 | { |
| 9 | ExportOnlyCipher(); |
| 10 | ~ExportOnlyCipher() override = default; |
| 11 | |
| 12 | bytes seal(const bytes& key, |
| 13 | const bytes& nonce, |
| 14 | const bytes& aad, |
| 15 | const bytes& pt) const override; |
| 16 | std::optional<bytes> open(const bytes& key, |
| 17 | const bytes& nonce, |
| 18 | const bytes& aad, |
| 19 | const bytes& ct) const override; |
| 20 | }; |
| 21 | |
| 22 | struct AEADCipher : public AEAD |
| 23 | { |
| 24 | template<AEAD::ID id> |
| 25 | static const AEADCipher& get(); |
| 26 | |
| 27 | ~AEADCipher() override = default; |
| 28 | |
| 29 | bytes seal(const bytes& key, |
| 30 | const bytes& nonce, |
| 31 | const bytes& aad, |
| 32 | const bytes& pt) const override; |
| 33 | std::optional<bytes> open(const bytes& key, |
| 34 | const bytes& nonce, |
| 35 | const bytes& aad, |
| 36 | const bytes& ct) const override; |
| 37 | |
| 38 | private: |
| 39 | const size_t tag_size; |
| 40 | |
| 41 | AEADCipher(AEAD::ID id_in); |
| 42 | friend AEADCipher make_aead(AEAD::ID cipher_in); |
| 43 | }; |
| 44 | |
| 45 | } // namespace mlspp::hpke |