aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pubkey/pubkey.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pubkey/pubkey.h')
-rw-r--r--src/lib/pubkey/pubkey.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lib/pubkey/pubkey.h b/src/lib/pubkey/pubkey.h
index 8328861fd..a1404135d 100644
--- a/src/lib/pubkey/pubkey.h
+++ b/src/lib/pubkey/pubkey.h
@@ -66,6 +66,11 @@ class BOTAN_PUBLIC_API(2,0) PK_Encryptor
*/
virtual size_t maximum_input_size() const = 0;
+ /**
+ * Return an upper bound on the ciphertext length
+ */
+ virtual size_t ciphertext_length(size_t ctext_len) const = 0;
+
PK_Encryptor() = default;
virtual ~PK_Encryptor() = default;
@@ -140,6 +145,12 @@ class BOTAN_PUBLIC_API(2,0) PK_Decryptor
const uint8_t required_content_offsets[],
size_t required_contents) const;
+ /**
+ * Return an upper bound on the plaintext length for a particular
+ * ciphertext input length
+ */
+ virtual size_t plaintext_length(size_t ctext_len) const = 0;
+
PK_Decryptor() = default;
virtual ~PK_Decryptor() = default;
@@ -547,6 +558,12 @@ class BOTAN_PUBLIC_API(2,0) PK_Encryptor_EME final : public PK_Encryptor
PK_Encryptor_EME& operator=(const PK_Encryptor_EME&) = delete;
PK_Encryptor_EME(const PK_Encryptor_EME&) = delete;
+
+ /**
+ * Return an upper bound on the ciphertext length for a particular
+ * plaintext input length
+ */
+ size_t ciphertext_length(size_t ptext_len) const override;
private:
std::vector<uint8_t> enc(const uint8_t[], size_t,
RandomNumberGenerator& rng) const override;
@@ -586,6 +603,8 @@ class BOTAN_PUBLIC_API(2,0) PK_Decryptor_EME final : public PK_Decryptor
PK_Decryptor_EME(key, system_rng(), eme, provider) {}
#endif
+ size_t plaintext_length(size_t ptext_len) const override;
+
~PK_Decryptor_EME();
PK_Decryptor_EME& operator=(const PK_Decryptor_EME&) = delete;
PK_Decryptor_EME(const PK_Decryptor_EME&) = delete;