diff options
author | Jack Lloyd <[email protected]> | 2018-08-10 12:44:55 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-08-10 12:44:55 -0400 |
commit | 87e4cd8c71511837b38406802f6e92e32b1890e9 (patch) | |
tree | 000aed5da6cfabd3009937a88cafb959f3988ea1 /src/tests/test_pubkey.cpp | |
parent | 256cfa3be098fb45d5c2de047f88786e88051e73 (diff) |
Add functions to get size of PK ciphertext,plaintext
Needed for https://github.com/strongswan/strongswan/pull/109
Diffstat (limited to 'src/tests/test_pubkey.cpp')
-rw-r--r-- | src/tests/test_pubkey.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp index 6b40e8d3c..bc2d19bb7 100644 --- a/src/tests/test_pubkey.cpp +++ b/src/tests/test_pubkey.cpp @@ -310,6 +310,10 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const Va try { decrypted = decryptor->decrypt(ciphertext); + + result.test_lte("Plaintext within length", + decrypted.size(), + decryptor->plaintext_length(ciphertext.size())); } catch(Botan::Exception& e) { @@ -358,6 +362,10 @@ PK_Encryption_Decryption_Test::run_one_test(const std::string& pad_hdr, const Va const std::vector<uint8_t> generated_ciphertext = encryptor->encrypt(plaintext, kat_rng ? *kat_rng : Test::rng()); + result.test_lte("Ciphertext within length", + generated_ciphertext.size(), + encryptor->ciphertext_length(plaintext.size())); + if(enc_provider == "base") { result.test_eq(enc_provider, "generated ciphertext matches KAT", |