Merged in ENGINE-757 Release_2.1.0-RC2
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Mon, 22 Jun 2020 23:46:21 +0200
changeset 4757f5f8da7627e9
parent 4752 d86aedba2d52
parent 4756 453e3b936f2a
child 4759 559f6c60e99d
Merged in ENGINE-757
     1.1 --- a/src/message_api.c	Fri Jun 19 14:55:47 2020 +0200
     1.2 +++ b/src/message_api.c	Mon Jun 22 23:46:21 2020 +0200
     1.3 @@ -1120,7 +1120,7 @@
     1.4          status = encrypt_and_sign(session, keys, mimetext, strlen(mimetext),
     1.5              &ctext, &csize);
     1.6      free(mimetext);
     1.7 -    if (ctext == NULL)
     1.8 +    if (ctext == NULL || status)
     1.9          goto pEp_error;
    1.10  
    1.11      dst->longmsg = strdup("this message was encrypted with p≡p "
    1.12 @@ -2238,6 +2238,10 @@
    1.13          status = PEP_UNKNOWN_ERROR;
    1.14          goto pEp_free;
    1.15      }
    1.16 +    else if (status) {
    1.17 +        free(encrypted_key_text);
    1.18 +        goto pEp_free; // FIXME - we need an error return overall
    1.19 +    }
    1.20  
    1.21      // We will have to delete this before returning, as we allocated it.
    1.22      bloblist_t* created_bl = NULL;
     2.1 --- a/src/pEpEngine.c	Fri Jun 19 14:55:47 2020 +0200
     2.2 +++ b/src/pEpEngine.c	Mon Jun 22 23:46:21 2020 +0200
     2.3 @@ -2295,6 +2295,41 @@
     2.4          session->unencrypted_subject = enable;
     2.5  }
     2.6  
     2.7 +DYNAMIC_API PEP_STATUS config_passphrase(PEP_SESSION session, const char *passphrase) {
     2.8 +    if (!session)
     2.9 +        return PEP_ILLEGAL_VALUE;
    2.10 +        
    2.11 +    PEP_STATUS status = PEP_STATUS_OK;
    2.12 +    free(session->curr_passphrase);
    2.13 +    if (!passphrase)
    2.14 +        session->curr_passphrase = NULL;
    2.15 +    else {
    2.16 +        session->curr_passphrase = strdup(passphrase);
    2.17 +        if (!session->curr_passphrase)
    2.18 +            status = PEP_OUT_OF_MEMORY;
    2.19 +    }
    2.20 +    return status;
    2.21 +}
    2.22 +
    2.23 +DYNAMIC_API PEP_STATUS config_passphrase_for_new_keys(PEP_SESSION session, bool enable, const char *passphrase) {
    2.24 +    if (enable && EMPTYSTR(passphrase))
    2.25 +        return PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED;
    2.26 +        
    2.27 +    session->new_key_pass_enable = enable;
    2.28 +    PEP_STATUS status = PEP_STATUS_OK;
    2.29 +
    2.30 +    free(session->generation_passphrase);
    2.31 +    if (!passphrase)
    2.32 +        session->generation_passphrase = NULL;
    2.33 +    else {
    2.34 +        session->generation_passphrase = strdup(passphrase);
    2.35 +        if (!session->generation_passphrase)
    2.36 +            status = PEP_OUT_OF_MEMORY;
    2.37 +    }
    2.38 +    return status;    
    2.39 +}
    2.40 +
    2.41 +
    2.42  DYNAMIC_API void config_service_log(PEP_SESSION session, bool enable)
    2.43  {
    2.44      assert(session);
     3.1 --- a/src/pEpEngine.h	Fri Jun 19 14:55:47 2020 +0200
     3.2 +++ b/src/pEpEngine.h	Mon Jun 22 23:46:21 2020 +0200
     3.3 @@ -132,6 +132,10 @@
     3.4      PEP_STATEMACHINE_INHIBITED_EVENT                = 0x0986,
     3.5      PEP_STATEMACHINE_CANNOT_SEND                    = 0x0987,
     3.6  
     3.7 +    PEP_PASSPHRASE_REQUIRED                         = 0x0a00,
     3.8 +    PEP_WRONG_PASSPHRASE                            = 0x0a01,
     3.9 +    PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED            = 0x0a02,
    3.10 +
    3.11      PEP_DISTRIBUTION_ILLEGAL_MESSAGE                = 0x1002,
    3.12  
    3.13      PEP_COMMIT_FAILED                               = 0xff01,
    3.14 @@ -1389,6 +1393,63 @@
    3.15  
    3.16  DYNAMIC_API const char *per_machine_directory(void);
    3.17  
    3.18 +// FIXME: replace in canonical style
    3.19 +//
    3.20 +// config_passphrase() - configure a key passphrase for the current session.
    3.21 +//
    3.22 +// A passphrase can be configured into a p≡p session. Then it is used whenever a
    3.23 +// secret key is used which requires a passphrase.
    3.24 +// 
    3.25 +// A passphrase is a string between 1 and 1024 bytes and is only ever present in
    3.26 +// memory. Because strings in the p≡p engine are UTF-8 NFC, the string is
    3.27 +// restricted to 250 code points in UI.
    3.28 +// 
    3.29 +// This function copies the passphrase into the session. It may return
    3.30 +// PEP_OUT_OF_MEMORY. The behaviour of all functions which use secret keys may
    3.31 +// change after this is configured.  Error behaviour
    3.32 +// 
    3.33 +// For any function which may trigger the use of a secret key, if an attempt
    3.34 +// to use a secret key which requires a passphrase occurs and no passphrase
    3.35 +// is configured for the current session, PEP_PASSPHRASE_REQUIRED is
    3.36 +// returned by this function (and thus, all functions which could trigger
    3.37 +// such a usage must be prepared to return this value).  For any function
    3.38 +// which may trigger the use of a secret key, if a passphrase is configured
    3.39 +// and the configured passphrase is the wrong passphrase for the use of a
    3.40 +// given passphrase-protected secret key, PEP_WRONG_PASSPHRASE is returned
    3.41 +// by this function (and thus, all functions which could trigger such a
    3.42 +// usage must be prepared to return this value).
    3.43 +
    3.44 +DYNAMIC_API PEP_STATUS config_passphrase(PEP_SESSION session, const char *passphrase);
    3.45 +
    3.46 +// FIXME: replace in canonical style
    3.47 +//
    3.48 +// Passphrase enablement for newly-generated secret keys
    3.49 +// 
    3.50 +// If it is desired that new p≡p keys are passphrase-protected, the following
    3.51 +// API call is used to enable the addition of passphrases to new keys during key
    3.52 +// generation.
    3.53 +//
    3.54 +// If enabled and a passphrase for new keys has been configured
    3.55 +// through this function (NOT the one above - this is a separate passphrase!),
    3.56 +// then anytime a secret key is generated while enabled, the configured
    3.57 +// passphrase will be used as the passphrase for any newly-generated secret key.
    3.58 +//
    3.59 +// If enabled and a passphrase for new keys has not been configured, then any
    3.60 +// function which can attempt to generate a secret key will return
    3.61 +// PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED.  
    3.62 +//
    3.63 +// If disabled (i.e. not enabled) and a passphrase for new keys has been
    3.64 +// configured, no passphrases will be used for newly-generated keys.
    3.65 +//
    3.66 +// This function copies the passphrase for new keys into a special field that is
    3.67 +// specifically for key generation into the session. It may return
    3.68 +// PEP_OUT_OF_MEMORY. The behaviour of all functions which use secret keys may
    3.69 +// change after this is configured.
    3.70 +//
    3.71 +
    3.72 +DYNAMIC_API PEP_STATUS config_passphrase_for_new_keys(PEP_SESSION session, 
    3.73 +                                                bool enable, 
    3.74 +                                                const char *passphrase);
    3.75  
    3.76  PEP_STATUS _generate_keypair(PEP_SESSION session, 
    3.77                               pEp_identity *identity,
     4.1 --- a/src/pEp_internal.h	Fri Jun 19 14:55:47 2020 +0200
     4.2 +++ b/src/pEp_internal.h	Mon Jun 22 23:46:21 2020 +0200
     4.3 @@ -141,7 +141,11 @@
     4.4  
     4.5      PEP_cryptotech_t *cryptotech;
     4.6      PEP_CIPHER_SUITE cipher_suite;
     4.7 -
     4.8 +    
     4.9 +    char* curr_passphrase;
    4.10 +    bool new_key_pass_enable;
    4.11 +    char* generation_passphrase;
    4.12 +    
    4.13      PEP_transport_t *transports;
    4.14  
    4.15      sqlite3 *db;
     5.1 --- a/src/pgp_sequoia.c	Fri Jun 19 14:55:47 2020 +0200
     5.2 +++ b/src/pgp_sequoia.c	Mon Jun 22 23:46:21 2020 +0200
     5.3 @@ -1045,6 +1045,9 @@
     5.4      // Whether we decrypted anything.
     5.5      int decrypted;
     5.6  
     5.7 +    int missing_passphrase;
     5.8 +    int bad_passphrase;
     5.9 +
    5.10      // The filename stored in the literal data packet.  Note: this is
    5.11      // *not* protected by the signature and should not be trusted!!!
    5.12      char *filename;
    5.13 @@ -1097,6 +1100,7 @@
    5.14          // Prevent iterations, which isn't needed since we don't
    5.15          // support SKESKs.
    5.16          return PGP_STATUS_UNKNOWN_ERROR;
    5.17 +        
    5.18      cookie->get_secret_keys_called = 1;
    5.19  
    5.20      T("%zd PKESKs", pkesk_count);
    5.21 @@ -1138,7 +1142,7 @@
    5.22          assert(is_tsk == pgp_cert_is_tsk(cert));
    5.23          if (! is_tsk)
    5.24              goto eol;
    5.25 -
    5.26 +        
    5.27          key_iter = pgp_cert_key_iter(cert);
    5.28          while (key = NULL, (ka = pgp_cert_key_iter_next(key_iter))) {
    5.29              key = pgp_key_amalgamation_key (ka);
    5.30 @@ -1160,9 +1164,33 @@
    5.31              goto eol;
    5.32          }
    5.33  
    5.34 +        if (!pgp_key_has_unencrypted_secret(key)) {
    5.35 +            const char* pass = session->curr_passphrase;
    5.36 +            if (pass && pass[0]) {
    5.37 +                pgp_key_t decrypted_key = NULL;
    5.38 +                decrypted_key = pgp_key_decrypt_secret(&err, pgp_key_clone(key), (uint8_t*)session->curr_passphrase,
    5.39 +                                             strlen(session->curr_passphrase));                             
    5.40 +                if (!decrypted_key) {                               
    5.41 +                    DUMP_ERR(err, PEP_WRONG_PASSPHRASE, "pgp_key_decrypt_secret");
    5.42 +                    cookie->bad_passphrase = 1;
    5.43 +                    goto eol;
    5.44 +                }
    5.45 +                else {
    5.46 +                    pgp_key_free(key);
    5.47 +                    key = decrypted_key;
    5.48 +                }
    5.49 +            }
    5.50 +            else {
    5.51 +                DUMP_ERR(err, PEP_PASSPHRASE_REQUIRED, "pgp_key_decrypt_secret");
    5.52 +                cookie->missing_passphrase = 1;
    5.53 +                goto eol;
    5.54 +            }    
    5.55 +        }
    5.56 +
    5.57          uint8_t algo;
    5.58          uint8_t session_key[1024];
    5.59          size_t session_key_len = sizeof(session_key);
    5.60 +
    5.61          if (pgp_pkesk_decrypt(&err, pkesk, key, &algo,
    5.62                                session_key, &session_key_len) != 0) {
    5.63              DUMP_ERR(err, PEP_UNKNOWN_ERROR, "pgp_pkesk_decrypt");
    5.64 @@ -1215,7 +1243,29 @@
    5.65  
    5.66              while (key = NULL, (ka = pgp_cert_key_iter_next(key_iter))) {
    5.67                  key = pgp_key_amalgamation_key (ka);
    5.68 -
    5.69 +                
    5.70 +                if (!pgp_key_has_unencrypted_secret(key)) {
    5.71 +                    const char* pass = session->curr_passphrase;
    5.72 +                    if (pass && pass[0]) {
    5.73 +                        pgp_key_t decrypted_key = NULL;
    5.74 +                        decrypted_key = pgp_key_decrypt_secret(&err, pgp_key_clone(key), (uint8_t*)session->curr_passphrase,
    5.75 +                                                     strlen(session->curr_passphrase));                             
    5.76 +                        if (!decrypted_key) {                               
    5.77 +                            DUMP_ERR(err, PEP_WRONG_PASSPHRASE, "pgp_key_decrypt_secret");
    5.78 +                            cookie->bad_passphrase = 1;
    5.79 +                            continue;
    5.80 +                        }
    5.81 +                        else {
    5.82 +                            pgp_key_free(key);
    5.83 +                            key = decrypted_key;
    5.84 +                        }
    5.85 +                    }
    5.86 +                    else {
    5.87 +                        DUMP_ERR(err, PEP_PASSPHRASE_REQUIRED, "pgp_key_decrypt_secret");
    5.88 +                        cookie->missing_passphrase = 1;
    5.89 +                        continue;
    5.90 +                    }    
    5.91 +                }
    5.92                  // Note: for decryption to appear to succeed, we must
    5.93                  // get a valid algorithm (8 of 256 values) and a
    5.94                  // 16-bit checksum must match.  Thus, we have about a
    5.95 @@ -1525,7 +1575,7 @@
    5.96      char** filename_ptr)
    5.97  {
    5.98      PEP_STATUS status = PEP_STATUS_OK;
    5.99 -    struct decrypt_cookie cookie = { session, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL };
   5.100 +    struct decrypt_cookie cookie = { session, 0, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL };
   5.101      pgp_reader_t reader = NULL;
   5.102      pgp_writer_t writer = NULL;
   5.103      pgp_reader_t decryptor = NULL;
   5.104 @@ -1557,9 +1607,16 @@
   5.105                                    get_public_keys_cb, decrypt_cb,
   5.106                                    check_signatures_cb, inspect_cb,
   5.107                                    &cookie, 0);
   5.108 -    if (! decryptor)
   5.109 -        ERROR_OUT(err, PEP_DECRYPT_NO_KEY, "pgp_decryptor_new");
   5.110 -
   5.111 +    if (! decryptor) {
   5.112 +        if (cookie.bad_passphrase)
   5.113 +            status = PEP_WRONG_PASSPHRASE;
   5.114 +        else if (cookie.missing_passphrase)
   5.115 +            status = PEP_PASSPHRASE_REQUIRED;
   5.116 +        else 
   5.117 +            status = PEP_DECRYPT_NO_KEY;
   5.118 +        ERROR_OUT(err, status, "pgp_decryptor_new");
   5.119 +    }
   5.120 +    
   5.121      // Copy 128 MB at a time.
   5.122      ssize_t nread;
   5.123      while ((nread = pgp_reader_copy (&err, decryptor, writer,
   5.124 @@ -2015,23 +2072,70 @@
   5.125      // pgp_encrypt_new consumes the recipients (but not the keys).
   5.126      recipient_count = 0;
   5.127  
   5.128 -    if (sign) {
   5.129 +    bool bad_pass = false;
   5.130 +    bool missing_pass = false;                
   5.131 +
   5.132 +    if (sign) {            
   5.133 +        
   5.134          iter = pgp_cert_valid_key_iter(signer_cert, session->policy, 0);
   5.135          pgp_cert_valid_key_iter_alive(iter);
   5.136          pgp_cert_valid_key_iter_revoked(iter, false);
   5.137          pgp_cert_valid_key_iter_for_signing (iter);
   5.138 -        pgp_cert_valid_key_iter_unencrypted_secret (iter);
   5.139 -
   5.140 +//        pgp_cert_valid_key_iter_unencrypted_secret (iter);
   5.141 +
   5.142 +        
   5.143          // If there are multiple signing capable subkeys, we just take
   5.144 -        // the first one, whichever one that happens to be.
   5.145 +        // the first one, whichever one that happens to be.            
   5.146 +            
   5.147          ka = pgp_cert_valid_key_iter_next (iter, NULL, NULL);
   5.148          if (! ka)
   5.149              ERROR_OUT (err, PEP_UNKNOWN_ERROR,
   5.150                         "%s has no signing capable key", keylist->value);
   5.151  
   5.152 -        // pgp_key_into_key_pair needs to own the key, but here we
   5.153 -        // only get a reference (which we still need to free).
   5.154 -        pgp_key_t key = pgp_valid_key_amalgamation_key (ka);
   5.155 +        pgp_key_t key = NULL;
   5.156 +        for ( ; ka ; (ka = pgp_cert_valid_key_iter_next(iter, NULL, NULL))) {                       
   5.157 +            // pgp_key_into_key_pair needs to own the key, but here we
   5.158 +            // only get a reference (which we still need to free).
   5.159 +            key = pgp_valid_key_amalgamation_key (ka);
   5.160 +
   5.161 +            if (pgp_key_has_unencrypted_secret(key)) 
   5.162 +                break;
   5.163 +            else {
   5.164 +                const char* pass = session->curr_passphrase;
   5.165 +                if (pass && pass[0]) {
   5.166 +                    pgp_key_t decrypted_key = NULL;
   5.167 +                    decrypted_key = pgp_key_decrypt_secret(&err, pgp_key_clone(key), (uint8_t*)session->curr_passphrase,
   5.168 +                                                            strlen(session->curr_passphrase));                             
   5.169 +                    pgp_key_free(key);
   5.170 +                    key = NULL;
   5.171 +                    
   5.172 +                    if (!decrypted_key) {                               
   5.173 +                        bad_pass = true;
   5.174 +                        continue;
   5.175 +                    }    
   5.176 +                    else {
   5.177 +                        key = decrypted_key;
   5.178 +                        break;
   5.179 +                    }
   5.180 +                }
   5.181 +                else {
   5.182 +                    pgp_key_free(key);
   5.183 +                    key = NULL;
   5.184 +                    missing_pass = true;
   5.185 +                    continue;
   5.186 +                }
   5.187 +            }
   5.188 +        }
   5.189 +        if (!key) {
   5.190 +            if (bad_pass)
   5.191 +                ERROR_OUT(err, PEP_WRONG_PASSPHRASE, "pgp_key_decrypt_secret");
   5.192 +            else if (missing_pass)    
   5.193 +                ERROR_OUT(err, PEP_PASSPHRASE_REQUIRED, "pgp_key_decrypt_secret");
   5.194 +            else        
   5.195 +                ERROR_OUT(err, PEP_UNKNOWN_ERROR, "pgp_valid_key_amalgamation_key");            
   5.196 +        }
   5.197 +                
   5.198 +                    
   5.199          signing_keypair = pgp_key_into_key_pair (NULL, pgp_key_clone (key));
   5.200          pgp_key_free (key);
   5.201          if (! signing_keypair)
   5.202 @@ -2079,7 +2183,7 @@
   5.203      *ctext = t;
   5.204      (*ctext)[*csize] = 0;
   5.205  
   5.206 - out:
   5.207 + out:    
   5.208      pgp_signer_free (signer);
   5.209      // XXX: pgp_key_pair_as_signer is only supposed to reference
   5.210      // signing_keypair, but it consumes it.  If this is fixed, this
   5.211 @@ -2186,6 +2290,11 @@
   5.212      assert(identity->fpr == NULL || identity->fpr[0] == 0);
   5.213  //    assert(identity->username);
   5.214  
   5.215 +    const char* passphrase = session->generation_passphrase;
   5.216 +
   5.217 +    if (session->new_key_pass_enable && (!passphrase || passphrase[0] == '\0'))
   5.218 +        return PEP_PASSPHRASE_FOR_NEW_KEYS_REQUIRED;
   5.219 +
   5.220      char* cached_username = identity->username;
   5.221      
   5.222      if (identity->username && strcmp(identity->address, identity->username) == 0) {
   5.223 @@ -2236,6 +2345,9 @@
   5.224      pgp_cert_builder_t certb = pgp_cert_builder_general_purpose(
   5.225          cipher_suite(session->cipher_suite), userid);
   5.226  
   5.227 +    if (session->new_key_pass_enable)        
   5.228 +        pgp_cert_builder_set_password(&certb, (uint8_t*)passphrase, strlen(passphrase));        
   5.229 +
   5.230      pgp_cert_builder_set_creation_time(&certb, when);
   5.231  
   5.232      pgp_signature_t rev;
     6.1 --- a/test/src/EncryptForIdentityTest.cc	Fri Jun 19 14:55:47 2020 +0200
     6.2 +++ b/test/src/EncryptForIdentityTest.cc	Mon Jun 22 23:46:21 2020 +0200
     6.3 @@ -15,8 +15,6 @@
     6.4  #include "keymanagement.h"
     6.5  #include "test_util.h"
     6.6  
     6.7 -
     6.8 -
     6.9  #include "Engine.h"
    6.10  
    6.11  #include <gtest/gtest.h>
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/test/src/PassphraseTest.cc	Mon Jun 22 23:46:21 2020 +0200
     7.3 @@ -0,0 +1,1227 @@
     7.4 +#include <stdlib.h>
     7.5 +#include <string>
     7.6 +#include <cstring>
     7.7 +
     7.8 +#include "pEpEngine.h"
     7.9 +#include "test_util.h"
    7.10 +#include "TestConstants.h"
    7.11 +#include "Engine.h"
    7.12 +
    7.13 +#include <gtest/gtest.h>
    7.14 +
    7.15 +#define PPTEST_DUMP 1
    7.16 +
    7.17 +namespace {
    7.18 +
    7.19 +	//The fixture for PassphraseTest
    7.20 +    class PassphraseTest : public ::testing::Test {
    7.21 +        public:
    7.22 +            Engine* engine;
    7.23 +            PEP_SESSION session;
    7.24 +
    7.25 +        protected:
    7.26 +            // You can remove any or all of the following functions if its body
    7.27 +            // is empty.
    7.28 +            PassphraseTest() {
    7.29 +                // You can do set-up work for each test here.
    7.30 +                test_suite_name = ::testing::UnitTest::GetInstance()->current_test_info()->GTEST_SUITE_SYM();
    7.31 +                test_name = ::testing::UnitTest::GetInstance()->current_test_info()->name();
    7.32 +                test_path = get_main_test_home_dir() + "/" + test_suite_name + "/" + test_name;
    7.33 +            }
    7.34 +
    7.35 +            ~PassphraseTest() override {
    7.36 +                // You can do clean-up work that doesn't throw exceptions here.
    7.37 +            }
    7.38 +
    7.39 +            // If the constructor and destructor are not enough for setting up
    7.40 +            // and cleaning up each test, you can define the following methods:
    7.41 +
    7.42 +            void SetUp() override {
    7.43 +                // Code here will be called immediately after the constructor (right
    7.44 +                // before each test).
    7.45 +
    7.46 +                // Leave this empty if there are no files to copy to the home directory path
    7.47 +                std::vector<std::pair<std::string, std::string>> init_files = std::vector<std::pair<std::string, std::string>>();
    7.48 +
    7.49 +                // Get a new test Engine.
    7.50 +                engine = new Engine(test_path);
    7.51 +                ASSERT_NE(engine, nullptr);
    7.52 +
    7.53 +                // Ok, let's initialize test directories etc.
    7.54 +                engine->prep(NULL, NULL, init_files);
    7.55 +
    7.56 +                // Ok, try to start this bugger.
    7.57 +                engine->start();
    7.58 +                ASSERT_NE(engine->session, nullptr);
    7.59 +                session = engine->session;
    7.60 +
    7.61 +                // Engine is up. Keep on truckin'
    7.62 +            }
    7.63 +
    7.64 +            void TearDown() override {
    7.65 +                // Code here will be called immediately after each test (right
    7.66 +                // before the destructor).
    7.67 +                engine->shut_down();
    7.68 +                delete engine;
    7.69 +                engine = NULL;
    7.70 +                session = NULL;
    7.71 +            }
    7.72 +            
    7.73 +            const char* alice_filename = "test_keys/alice-no-passwords.pgp";
    7.74 +            const char* alice_pub_filename = "test_keys/pub/alice-0x2A649B9F_pub.asc";
    7.75 +            const char* bob_filename = "test_keys/bob-primary-with-password-bob-subkey-without.pgp";
    7.76 +            const char* carol_filename = "test_keys/carol-subkeys-password-carol.pgp";
    7.77 +            const char* david_filename = "test_keys/david-encryption-subkey-password-encrypt-signing-subkey-password-sign.pgp";
    7.78 +            const char* erwin_filename = "test_keys/erwin-primary-encrypted-erwin-subkey-unencrypted.pgp";
    7.79 +            const char* alice_fpr = "03AF88F728B8E9AADA7F370BD41801C62A649B9F";
    7.80 +            const char* bob_fpr = "5C76378A62B04CF3F41BEC8D4940FC9FA1878736";
    7.81 +            const char* carol_fpr = "A5B3473EA7CBB5DF7A4F595A8883DC4BCD8BAC06";
    7.82 +            const char* david_fpr = "7F72E4B27C6161455CD9C50FE7A05D7BF3FF4E19";
    7.83 +            const char* erwin_fpr = "A34048189F0067DF0006FB28CBD7CFBCC0FA7F97";
    7.84 +            
    7.85 +        private:
    7.86 +            const char* test_suite_name;
    7.87 +            const char* test_name;
    7.88 +            string test_path;
    7.89 +            // Objects declared here can be used by all tests in the PassphraseTest suite.
    7.90 +
    7.91 +    };
    7.92 +
    7.93 +}  // namespace
    7.94 +
    7.95 +
    7.96 +TEST_F(PassphraseTest, check_alice_no_passphrase_nopass_import) {
    7.97 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
    7.98 +    stringlist_t* found_key = NULL;
    7.99 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.100 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.101 +    ASSERT_NE(found_key, nullptr);
   7.102 +    ASSERT_NE(found_key->value, nullptr);
   7.103 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.104 +    ASSERT_EQ(found_key->next, nullptr);
   7.105 +    free_stringlist(found_key);
   7.106 +    
   7.107 +#if PPTEST_DUMP
   7.108 +    char* keytext = NULL;
   7.109 +    size_t size = 0;
   7.110 +    export_key(session, alice_fpr, &keytext, &size);
   7.111 +    dump_out("test_keys/pub/alice-0x2A649B9F_pub.asc", keytext);
   7.112 +    free(keytext);
   7.113 +#endif    
   7.114 +}
   7.115 +
   7.116 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_nopass_import) {
   7.117 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));
   7.118 +    stringlist_t* found_key = NULL;
   7.119 +    PEP_STATUS status = find_keys(session, bob_fpr, &found_key);
   7.120 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.121 +    ASSERT_NE(found_key, nullptr);
   7.122 +    ASSERT_NE(found_key->value, nullptr);
   7.123 +    ASSERT_STREQ(found_key->value, bob_fpr);
   7.124 +    ASSERT_EQ(found_key->next, nullptr);
   7.125 +    free_stringlist(found_key);
   7.126 +}
   7.127 +
   7.128 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_nopass_import) {
   7.129 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.130 +    stringlist_t* found_key = NULL;
   7.131 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.132 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.133 +    ASSERT_NE(found_key, nullptr);
   7.134 +    ASSERT_NE(found_key->value, nullptr);
   7.135 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.136 +    ASSERT_EQ(found_key->next, nullptr);
   7.137 +    free_stringlist(found_key);
   7.138 +
   7.139 +#if PPTEST_DUMP
   7.140 +    char* keytext = NULL;
   7.141 +    size_t size = 0;
   7.142 +    status = export_key(session, carol_fpr, &keytext, &size);
   7.143 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.144 +    dump_out("test_keys/pub/carol-0xCD8BAC06_pub.asc", keytext);
   7.145 +    free(keytext);
   7.146 +#endif    
   7.147 +    
   7.148 +}
   7.149 +
   7.150 +TEST_F(PassphraseTest, check_david_primary_unenc_sign_and_encrypt_diff_pass_two_sign_unencrypted_nopass_import) {
   7.151 +    ASSERT_TRUE(slurp_and_import_key(session, david_filename));
   7.152 +    stringlist_t* found_key = NULL;
   7.153 +    PEP_STATUS status = find_keys(session, david_fpr, &found_key);
   7.154 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.155 +    ASSERT_NE(found_key, nullptr);
   7.156 +    ASSERT_NE(found_key->value, nullptr);
   7.157 +    ASSERT_STREQ(found_key->value, david_fpr);
   7.158 +    ASSERT_EQ(found_key->next, nullptr);
   7.159 +    free_stringlist(found_key);
   7.160 +}
   7.161 +
   7.162 +TEST_F(PassphraseTest, check_erwin_primary_enc_subkey_encrypted_plus_unenc_sign_nopass_import) {
   7.163 +    ASSERT_TRUE(slurp_and_import_key(session, erwin_filename));
   7.164 +    stringlist_t* found_key = NULL;
   7.165 +    PEP_STATUS status = find_keys(session, erwin_fpr, &found_key);
   7.166 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.167 +    ASSERT_NE(found_key, nullptr);
   7.168 +    ASSERT_NE(found_key->value, nullptr);
   7.169 +    ASSERT_STREQ(found_key->value, erwin_fpr);
   7.170 +    ASSERT_EQ(found_key->next, nullptr);
   7.171 +    free_stringlist(found_key);
   7.172 +}
   7.173 +
   7.174 +TEST_F(PassphraseTest, check_alice_no_passphrase_nopass_sign_encrypt) {
   7.175 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.176 +    stringlist_t* found_key = NULL;
   7.177 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.178 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.179 +    ASSERT_NE(found_key, nullptr);
   7.180 +    ASSERT_NE(found_key->value, nullptr);
   7.181 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.182 +    ASSERT_EQ(found_key->next, nullptr);
   7.183 +    
   7.184 +    const char* my_fpr = alice_fpr;
   7.185 +    const char* my_name = "Alice Malice";
   7.186 +    const char* my_address = "alice_malice@darthmama.cool";
   7.187 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.188 +    status = set_own_key(session, my_ident, my_fpr);
   7.189 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.190 +    
   7.191 +    const char* to_fpr = alice_fpr;
   7.192 +    const char* to_name = "Alice Malice";
   7.193 +    const char* to_address = "alice_malice@darthmama.cool";
   7.194 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, PEP_OWN_USERID, to_name);
   7.195 +    status = set_identity(session, to_ident);
   7.196 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.197 +    
   7.198 +    message* msg = new_message(PEP_dir_outgoing);
   7.199 +    msg->from = my_ident;
   7.200 +    msg->to = new_identity_list(to_ident);
   7.201 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.202 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.203 +    
   7.204 +    message* enc_msg = NULL;
   7.205 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.206 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.207 +    ASSERT_NE(enc_msg, nullptr);
   7.208 +    
   7.209 +    free_message(msg);
   7.210 +    free_message(enc_msg);
   7.211 +    free_stringlist(found_key);
   7.212 +}
   7.213 +
   7.214 +TEST_F(PassphraseTest, check_alice_no_passphrase_nopass_sign_encrypt_to_carol) {
   7.215 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.216 +    stringlist_t* found_key = NULL;
   7.217 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.218 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.219 +    ASSERT_NE(found_key, nullptr);
   7.220 +    ASSERT_NE(found_key->value, nullptr);
   7.221 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.222 +    ASSERT_EQ(found_key->next, nullptr);
   7.223 +    
   7.224 +    const char* my_fpr = alice_fpr;
   7.225 +    const char* my_name = "Alice Malice";
   7.226 +    const char* my_address = "alice_malice@darthmama.cool";
   7.227 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.228 +    status = set_own_key(session, my_ident, my_fpr);
   7.229 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.230 +    
   7.231 +    ASSERT_TRUE(slurp_and_import_key(session, "test_keys/pub/carol-0xCD8BAC06_pub.asc"));
   7.232 +    const char* to_fpr = carol_fpr;
   7.233 +    const char* to_name = "Carol Peril";
   7.234 +    const char* to_address = "carol_peril@darthmama.cool";
   7.235 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "CAROL", to_name);
   7.236 +    status = set_identity(session, to_ident);
   7.237 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.238 +    
   7.239 +    message* msg = new_message(PEP_dir_outgoing);
   7.240 +    msg->from = my_ident;
   7.241 +    msg->to = new_identity_list(to_ident);
   7.242 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.243 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.244 +    
   7.245 +    message* enc_msg = NULL;
   7.246 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.247 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.248 +    ASSERT_NE(enc_msg, nullptr);
   7.249 +    
   7.250 +    free_message(msg);
   7.251 +    free_message(enc_msg);
   7.252 +    free_stringlist(found_key);
   7.253 +}
   7.254 +
   7.255 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_nopass_sign) {
   7.256 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));
   7.257 +    stringlist_t* found_key = NULL;
   7.258 +    PEP_STATUS status = find_keys(session, bob_fpr, &found_key);
   7.259 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.260 +    ASSERT_NE(found_key, nullptr);
   7.261 +    ASSERT_NE(found_key->value, nullptr);
   7.262 +    ASSERT_STREQ(found_key->value, bob_fpr);
   7.263 +    ASSERT_EQ(found_key->next, nullptr);
   7.264 +
   7.265 +    const char* my_fpr = bob_fpr;
   7.266 +    const char* my_name = "Bob Mob";
   7.267 +    const char* my_address = "bob_mob@darthmama.cool";
   7.268 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.269 +    status = set_own_key(session, my_ident, my_fpr);
   7.270 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.271 +    
   7.272 +    // Set up "to"
   7.273 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.274 +    const char* to_fpr = alice_fpr;
   7.275 +    const char* to_name = "Alice Malice";
   7.276 +    const char* to_address = "alice_malice@darthmama.cool";
   7.277 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.278 +    status = set_identity(session, to_ident);
   7.279 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.280 +    
   7.281 +    message* msg = new_message(PEP_dir_outgoing);   
   7.282 +    msg->from = my_ident;
   7.283 +    msg->to = new_identity_list(to_ident);
   7.284 +    msg->shortmsg = strdup("This is an exciting message from Bob!");
   7.285 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.286 +    
   7.287 +    message* enc_msg = NULL;
   7.288 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.289 +    ASSERT_EQ(status, PEP_PASSPHRASE_REQUIRED);
   7.290 +    ASSERT_EQ(enc_msg, nullptr);
   7.291 +    
   7.292 +    free_message(msg);
   7.293 +    free_message(enc_msg);
   7.294 +    free_stringlist(found_key);
   7.295 +}
   7.296 +
   7.297 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_nopass_sign) {
   7.298 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.299 +    stringlist_t* found_key = NULL;
   7.300 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.301 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.302 +    ASSERT_NE(found_key, nullptr);
   7.303 +    ASSERT_NE(found_key->value, nullptr);
   7.304 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.305 +    ASSERT_EQ(found_key->next, nullptr);
   7.306 +    
   7.307 +    const char* my_fpr = carol_fpr;
   7.308 +    const char* my_name = "Carol Peril";
   7.309 +    const char* my_address = "carol_peril@darthmama.cool";
   7.310 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.311 +    status = set_own_key(session, my_ident, my_fpr);
   7.312 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.313 +    
   7.314 +    // Set up "to"
   7.315 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.316 +    const char* to_fpr = alice_fpr;
   7.317 +    const char* to_name = "Alice Malice";
   7.318 +    const char* to_address = "alice_malice@darthmama.cool";
   7.319 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.320 +    status = set_identity(session, to_ident);
   7.321 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.322 +    
   7.323 +    message* msg = new_message(PEP_dir_outgoing);        
   7.324 +    msg->from = my_ident;
   7.325 +    msg->to = new_identity_list(to_ident);
   7.326 +    msg->shortmsg = strdup("This is an exciting message from Carol!");
   7.327 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.328 +    
   7.329 +    message* enc_msg = NULL;
   7.330 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.331 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.332 +    ASSERT_NE(enc_msg, nullptr);
   7.333 +    
   7.334 +    free_message(msg);
   7.335 +    free_message(enc_msg);    
   7.336 +    free_stringlist(found_key);
   7.337 +}
   7.338 +
   7.339 +TEST_F(PassphraseTest, check_david_primary_unenc_sign_and_encrypt_diff_pass_two_sign_unencrypted_nopass_sign) {
   7.340 +    ASSERT_TRUE(slurp_and_import_key(session, david_filename));
   7.341 +    stringlist_t* found_key = NULL;
   7.342 +    PEP_STATUS status = find_keys(session, david_fpr, &found_key);
   7.343 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.344 +    ASSERT_NE(found_key, nullptr);
   7.345 +    ASSERT_NE(found_key->value, nullptr);
   7.346 +    ASSERT_STREQ(found_key->value, david_fpr);
   7.347 +    ASSERT_EQ(found_key->next, nullptr);
   7.348 +    
   7.349 +    const char* my_fpr = david_fpr;
   7.350 +    const char* my_name = "Dave Rave";
   7.351 +    const char* my_address = "dave_rave@darthmama.cool";
   7.352 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.353 +    status = set_own_key(session, my_ident, my_fpr);
   7.354 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.355 +
   7.356 +    // Set up "to"
   7.357 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.358 +    const char* to_fpr = alice_fpr;
   7.359 +    const char* to_name = "Alice Malice";
   7.360 +    const char* to_address = "alice_malice@darthmama.cool";
   7.361 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.362 +    status = set_identity(session, to_ident);
   7.363 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.364 +    
   7.365 +    message* msg = new_message(PEP_dir_outgoing);        
   7.366 +    msg->from = my_ident;
   7.367 +    msg->to = new_identity_list(to_ident);
   7.368 +    msg->shortmsg = strdup("This is an exciting message from David!");
   7.369 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.370 +    
   7.371 +    message* enc_msg = NULL;
   7.372 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.373 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.374 +    ASSERT_NE(enc_msg, nullptr);
   7.375 +    
   7.376 +    free_message(msg);
   7.377 +    free_message(enc_msg);        
   7.378 +    free_stringlist(found_key);
   7.379 +}
   7.380 +
   7.381 +TEST_F(PassphraseTest, check_erwin_primary_enc_subkey_encrypted_plus_unenc_sign_nopass_sign) {
   7.382 +    ASSERT_TRUE(slurp_and_import_key(session, erwin_filename));
   7.383 +    stringlist_t* found_key = NULL;
   7.384 +    PEP_STATUS status = find_keys(session, erwin_fpr, &found_key);
   7.385 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.386 +    ASSERT_NE(found_key, nullptr);
   7.387 +    ASSERT_NE(found_key->value, nullptr);
   7.388 +    ASSERT_STREQ(found_key->value, erwin_fpr);
   7.389 +    ASSERT_EQ(found_key->next, nullptr);
   7.390 +    
   7.391 +    const char* my_fpr = erwin_fpr;
   7.392 +    const char* my_name = "Irv Nerve";
   7.393 +    const char* my_address = "irv_nerve@darthmama.cool";
   7.394 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.395 +    status = set_own_key(session, my_ident, my_fpr);
   7.396 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.397 +    
   7.398 +    // Set up "to"
   7.399 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.400 +    const char* to_fpr = alice_fpr;
   7.401 +    const char* to_name = "Alice Malice";
   7.402 +    const char* to_address = "alice_malice@darthmama.cool";
   7.403 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.404 +    status = set_identity(session, to_ident);
   7.405 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.406 +    
   7.407 +    message* msg = new_message(PEP_dir_outgoing);    
   7.408 +    msg->from = my_ident;
   7.409 +    msg->to = new_identity_list(to_ident);
   7.410 +    msg->shortmsg = strdup("This is an exciting message from Erwin!");
   7.411 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.412 +    
   7.413 +    message* enc_msg = NULL;
   7.414 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.415 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.416 +    ASSERT_NE(enc_msg, nullptr);
   7.417 +    
   7.418 +    free_message(msg);
   7.419 +    free_message(enc_msg);            
   7.420 +    free_stringlist(found_key);
   7.421 +}
   7.422 +
   7.423 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_nopass_encrypt) {
   7.424 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.425 +    stringlist_t* found_key = NULL;
   7.426 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.427 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.428 +    ASSERT_NE(found_key, nullptr);
   7.429 +    ASSERT_NE(found_key->value, nullptr);
   7.430 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.431 +    ASSERT_EQ(found_key->next, nullptr);
   7.432 +    
   7.433 +    const char* my_fpr = alice_fpr;
   7.434 +    const char* my_name = "Alice Malice";
   7.435 +    const char* my_address = "alice_malice@darthmama.cool";
   7.436 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.437 +    status = set_own_key(session, my_ident, my_fpr);
   7.438 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.439 +    
   7.440 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));    
   7.441 +    const char* to_fpr = bob_fpr;
   7.442 +    const char* to_name = "Bob Mob";
   7.443 +    const char* to_address = "bob_mob@darthmama.cool";
   7.444 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "BOB", to_name);
   7.445 +    status = set_identity(session, to_ident);
   7.446 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.447 +    
   7.448 +    message* msg = new_message(PEP_dir_outgoing);
   7.449 +    msg->from = my_ident;
   7.450 +    msg->to = new_identity_list(to_ident);
   7.451 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.452 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.453 +    
   7.454 +    message* enc_msg = NULL;
   7.455 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.456 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.457 +    ASSERT_NE(enc_msg, nullptr);
   7.458 +    
   7.459 +#if PPTEST_DUMP   
   7.460 +    char* outdata = NULL;
   7.461 +    mime_encode_message(enc_msg, false, &outdata, false);
   7.462 +    dump_out("test_mails/encrypt_to_bob.eml", outdata);
   7.463 +    free(outdata);
   7.464 +#endif
   7.465 +    
   7.466 +    free_message(msg);
   7.467 +    free_message(enc_msg);
   7.468 +    free_stringlist(found_key);
   7.469 +}
   7.470 +
   7.471 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_nopass_encrypt) {
   7.472 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.473 +    stringlist_t* found_key = NULL;
   7.474 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.475 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.476 +    ASSERT_NE(found_key, nullptr);
   7.477 +    ASSERT_NE(found_key->value, nullptr);
   7.478 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.479 +    ASSERT_EQ(found_key->next, nullptr);
   7.480 +    
   7.481 +    const char* my_fpr = alice_fpr;
   7.482 +    const char* my_name = "Alice Malice";
   7.483 +    const char* my_address = "alice_malice@darthmama.cool";
   7.484 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.485 +    status = set_own_key(session, my_ident, my_fpr);
   7.486 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.487 +    
   7.488 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));    
   7.489 +    const char* to_fpr = carol_fpr;
   7.490 +    const char* to_name = "Carol Peril";
   7.491 +    const char* to_address = "carol_peril@darthmama.cool";
   7.492 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "CAROL", to_name);
   7.493 +    status = set_identity(session, to_ident);
   7.494 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.495 +    
   7.496 +    message* msg = new_message(PEP_dir_outgoing);
   7.497 +    msg->from = my_ident;
   7.498 +    msg->to = new_identity_list(to_ident);
   7.499 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.500 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.501 +    
   7.502 +    message* enc_msg = NULL;
   7.503 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.504 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.505 +    ASSERT_NE(enc_msg, nullptr);
   7.506 +
   7.507 +#if PPTEST_DUMP   
   7.508 +    char* outdata = NULL;
   7.509 +    mime_encode_message(enc_msg, false, &outdata, false);
   7.510 +    dump_out("test_mails/encrypt_to_carol.eml", outdata);
   7.511 +    free(outdata);
   7.512 +#endif
   7.513 +    
   7.514 +    free_message(msg);
   7.515 +    free_message(enc_msg);
   7.516 +    free_stringlist(found_key);
   7.517 +}
   7.518 +
   7.519 +TEST_F(PassphraseTest, check_david_primary_unenc_sign_and_encrypt_diff_pass_two_sign_unencrypted_nopass_encrypt) {
   7.520 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.521 +    stringlist_t* found_key = NULL;
   7.522 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.523 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.524 +    ASSERT_NE(found_key, nullptr);
   7.525 +    ASSERT_NE(found_key->value, nullptr);
   7.526 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.527 +    ASSERT_EQ(found_key->next, nullptr);
   7.528 +    
   7.529 +    const char* my_fpr = alice_fpr;
   7.530 +    const char* my_name = "Alice Malice";
   7.531 +    const char* my_address = "alice_malice@darthmama.cool";
   7.532 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.533 +    status = set_own_key(session, my_ident, my_fpr);
   7.534 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.535 +    
   7.536 +    ASSERT_TRUE(slurp_and_import_key(session, david_filename));    
   7.537 +    const char* to_fpr = david_fpr;
   7.538 +    const char* to_name = "Dave Rave";
   7.539 +    const char* to_address = "dave_rave@darthmama.cool";
   7.540 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "DAVID", to_name);
   7.541 +    status = set_identity(session, to_ident);
   7.542 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.543 +    
   7.544 +    message* msg = new_message(PEP_dir_outgoing);
   7.545 +    msg->from = my_ident;
   7.546 +    msg->to = new_identity_list(to_ident);
   7.547 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.548 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.549 +    
   7.550 +    message* enc_msg = NULL;
   7.551 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.552 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.553 +    ASSERT_NE(enc_msg, nullptr);
   7.554 +    
   7.555 +#if PPTEST_DUMP   
   7.556 +    char* outdata = NULL;
   7.557 +    mime_encode_message(enc_msg, false, &outdata, false);
   7.558 +    dump_out("test_mails/encrypt_to_david.eml", outdata);
   7.559 +    free(outdata);
   7.560 +#endif
   7.561 +    
   7.562 +    free_message(msg);
   7.563 +    free_message(enc_msg);
   7.564 +    free_stringlist(found_key);
   7.565 +}    
   7.566 +
   7.567 +TEST_F(PassphraseTest, check_erwin_primary_enc_subkey_encrypted_plus_unenc_sign_nopass_encrypt) {
   7.568 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.569 +    stringlist_t* found_key = NULL;
   7.570 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.571 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.572 +    ASSERT_NE(found_key, nullptr);
   7.573 +    ASSERT_NE(found_key->value, nullptr);
   7.574 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.575 +    ASSERT_EQ(found_key->next, nullptr);
   7.576 +    
   7.577 +    const char* my_fpr = alice_fpr;
   7.578 +    const char* my_name = "Alice Malice";
   7.579 +    const char* my_address = "alice_malice@darthmama.cool";
   7.580 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.581 +    status = set_own_key(session, my_ident, my_fpr);
   7.582 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.583 +    
   7.584 +    ASSERT_TRUE(slurp_and_import_key(session, erwin_filename));    
   7.585 +    const char* to_fpr = erwin_fpr;
   7.586 +    const char* to_name = "Irv Nerve";
   7.587 +    const char* to_address = "irv_nerve@darthmama.cool";
   7.588 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ERWIN", to_name);
   7.589 +    status = set_identity(session, to_ident);
   7.590 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.591 +    
   7.592 +    message* msg = new_message(PEP_dir_outgoing);
   7.593 +    msg->from = my_ident;
   7.594 +    msg->to = new_identity_list(to_ident);
   7.595 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.596 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.597 +    
   7.598 +    message* enc_msg = NULL;
   7.599 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.600 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.601 +    ASSERT_NE(enc_msg, nullptr);
   7.602 +
   7.603 +#if PPTEST_DUMP   
   7.604 +    char* outdata = NULL;
   7.605 +    mime_encode_message(enc_msg, false, &outdata, false);
   7.606 +    dump_out("test_mails/encrypt_to_erwin.eml", outdata);
   7.607 +    free(outdata);
   7.608 +#endif
   7.609 +    
   7.610 +    free_message(msg);
   7.611 +    free_message(enc_msg);
   7.612 +    free_stringlist(found_key);
   7.613 +}
   7.614 +
   7.615 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_nopass_decrypt) {
   7.616 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));
   7.617 +    stringlist_t* found_key = NULL;
   7.618 +    PEP_STATUS status = find_keys(session, bob_fpr, &found_key);
   7.619 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.620 +    ASSERT_NE(found_key, nullptr);
   7.621 +    ASSERT_NE(found_key->value, nullptr);
   7.622 +    ASSERT_STREQ(found_key->value, bob_fpr);
   7.623 +    ASSERT_EQ(found_key->next, nullptr);
   7.624 +
   7.625 +    const char* my_fpr = bob_fpr;
   7.626 +    const char* my_name = "Bob Mob";
   7.627 +    const char* my_address = "bob_mob@darthmama.cool";
   7.628 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.629 +    status = set_own_key(session, my_ident, my_fpr);
   7.630 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.631 +    
   7.632 +    // Set up "to"
   7.633 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.634 +    const char* to_fpr = alice_fpr;
   7.635 +    const char* to_name = "Alice Malice";
   7.636 +    const char* to_address = "alice_malice@darthmama.cool";
   7.637 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.638 +    status = set_identity(session, to_ident);
   7.639 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.640 +    
   7.641 +    string msg = slurp("test_mails/encrypt_to_bob.eml");
   7.642 +    char* decrypted_msg = NULL;
   7.643 +    char* modified_src = NULL;  
   7.644 +    stringlist_t* keylist_used = NULL;
   7.645 +    PEP_rating rating;
   7.646 +    PEP_decrypt_flags_t flags = 0;
   7.647 +    status = MIME_decrypt_message(session, msg.c_str(), msg.size(), &decrypted_msg, &keylist_used, &rating, &flags, &modified_src);
   7.648 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.649 +    ASSERT_NE(decrypted_msg, nullptr);
   7.650 +    
   7.651 +    free(decrypted_msg);
   7.652 +    free(modified_src);
   7.653 +    free_stringlist(keylist_used);
   7.654 +}
   7.655 +
   7.656 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_nopass_decrypt) {
   7.657 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.658 +    stringlist_t* found_key = NULL;
   7.659 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.660 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.661 +    ASSERT_NE(found_key, nullptr);
   7.662 +    ASSERT_NE(found_key->value, nullptr);
   7.663 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.664 +    ASSERT_EQ(found_key->next, nullptr);
   7.665 +    
   7.666 +    const char* my_fpr = carol_fpr;
   7.667 +    const char* my_name = "Carol Peril";
   7.668 +    const char* my_address = "carol_peril@darthmama.cool";
   7.669 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.670 +    status = set_own_key(session, my_ident, my_fpr);
   7.671 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.672 +    
   7.673 +    // Set up "to"
   7.674 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.675 +    const char* to_fpr = alice_fpr;
   7.676 +    const char* to_name = "Alice Malice";
   7.677 +    const char* to_address = "alice_malice@darthmama.cool";
   7.678 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.679 +    status = set_identity(session, to_ident);
   7.680 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.681 +    
   7.682 +    string msg = slurp("test_mails/encrypt_to_carol.eml");
   7.683 +    char* decrypted_msg = NULL;
   7.684 +    char* modified_src = NULL;  
   7.685 +    stringlist_t* keylist_used = NULL;
   7.686 +    PEP_rating rating;
   7.687 +    PEP_decrypt_flags_t flags = 0;
   7.688 +    status = MIME_decrypt_message(session, msg.c_str(), msg.size(), &decrypted_msg, &keylist_used, &rating, &flags, &modified_src);
   7.689 +    ASSERT_EQ(status, PEP_PASSPHRASE_REQUIRED);
   7.690 +    ASSERT_EQ(decrypted_msg, nullptr);
   7.691 +    
   7.692 +    free(decrypted_msg);
   7.693 +    free(modified_src);
   7.694 +    free_stringlist(keylist_used);
   7.695 +}    
   7.696 +
   7.697 +TEST_F(PassphraseTest, check_alice_no_passphrase_withpass_sign_encrypt) {    
   7.698 +    ASSERT_TRUE(slurp_and_import_key(session, alice_filename));
   7.699 +    stringlist_t* found_key = NULL;
   7.700 +    PEP_STATUS status = find_keys(session, alice_fpr, &found_key);
   7.701 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.702 +    ASSERT_NE(found_key, nullptr);
   7.703 +    ASSERT_NE(found_key->value, nullptr);
   7.704 +    ASSERT_STREQ(found_key->value, alice_fpr);
   7.705 +    ASSERT_EQ(found_key->next, nullptr);
   7.706 +    
   7.707 +    const char* my_fpr = alice_fpr;
   7.708 +    const char* my_name = "Alice Malice";
   7.709 +    const char* my_address = "alice_malice@darthmama.cool";
   7.710 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.711 +    status = set_own_key(session, my_ident, my_fpr);
   7.712 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.713 +    
   7.714 +    const char* to_fpr = alice_fpr;
   7.715 +    const char* to_name = "Alice Malice";
   7.716 +    const char* to_address = "alice_malice@darthmama.cool";
   7.717 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, PEP_OWN_USERID, to_name);
   7.718 +    status = set_identity(session, to_ident);
   7.719 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.720 +    
   7.721 +    message* msg = new_message(PEP_dir_outgoing);
   7.722 +    msg->from = my_ident;
   7.723 +    msg->to = new_identity_list(to_ident);
   7.724 +    msg->shortmsg = strdup("This is an exciting message from Alice!");
   7.725 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.726 +    
   7.727 +    // Alice doesn't have a password, but we're gonna set one anyway
   7.728 +    const char* pass = "wombat";
   7.729 +    status = config_passphrase(session, pass);    
   7.730 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.731 +
   7.732 +        
   7.733 +    message* enc_msg = NULL;
   7.734 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.735 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.736 +    ASSERT_NE(enc_msg, nullptr);
   7.737 +    
   7.738 +    free_message(msg);
   7.739 +    free_message(enc_msg);
   7.740 +    free_stringlist(found_key);
   7.741 +}
   7.742 +
   7.743 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_withpass_sign) {
   7.744 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));
   7.745 +    stringlist_t* found_key = NULL;
   7.746 +    PEP_STATUS status = find_keys(session, bob_fpr, &found_key);
   7.747 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.748 +    ASSERT_NE(found_key, nullptr);
   7.749 +    ASSERT_NE(found_key->value, nullptr);
   7.750 +    ASSERT_STREQ(found_key->value, bob_fpr);
   7.751 +    ASSERT_EQ(found_key->next, nullptr);
   7.752 +
   7.753 +    const char* my_fpr = bob_fpr;
   7.754 +    const char* my_name = "Bob Mob";
   7.755 +    const char* my_address = "bob_mob@darthmama.cool";
   7.756 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.757 +    status = set_own_key(session, my_ident, my_fpr);
   7.758 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.759 +    
   7.760 +    // Set up "to"
   7.761 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.762 +    const char* to_fpr = alice_fpr;
   7.763 +    const char* to_name = "Alice Malice";
   7.764 +    const char* to_address = "alice_malice@darthmama.cool";
   7.765 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.766 +    status = set_identity(session, to_ident);
   7.767 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.768 +    
   7.769 +    message* msg = new_message(PEP_dir_outgoing);   
   7.770 +    msg->from = my_ident;
   7.771 +    msg->to = new_identity_list(to_ident);
   7.772 +    msg->shortmsg = strdup("This is an exciting message from Bob!");
   7.773 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.774 +    
   7.775 +    const char* pass = "bob";
   7.776 +    status = config_passphrase(session, pass);    
   7.777 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.778 +
   7.779 +    
   7.780 +    message* enc_msg = NULL;
   7.781 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.782 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.783 +    ASSERT_NE(enc_msg, nullptr);
   7.784 +    
   7.785 +#if PPTEST_DUMP   
   7.786 +    char* outdata = NULL;
   7.787 +    mime_encode_message(enc_msg, false, &outdata, false);
   7.788 +    dump_out("test_mails/signed_by_bob.eml", outdata);
   7.789 +    free(outdata);
   7.790 +#endif
   7.791 +    
   7.792 +    free_message(msg);
   7.793 +    free_message(enc_msg);
   7.794 +    free_stringlist(found_key);
   7.795 +}
   7.796 +
   7.797 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_withpass_sign) {
   7.798 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.799 +    stringlist_t* found_key = NULL;
   7.800 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.801 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.802 +    ASSERT_NE(found_key, nullptr);
   7.803 +    ASSERT_NE(found_key->value, nullptr);
   7.804 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.805 +    ASSERT_EQ(found_key->next, nullptr);
   7.806 +    
   7.807 +    const char* my_fpr = carol_fpr;
   7.808 +    const char* my_name = "Carol Peril";
   7.809 +    const char* my_address = "carol_peril@darthmama.cool";
   7.810 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.811 +    status = set_own_key(session, my_ident, my_fpr);
   7.812 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.813 +    
   7.814 +    // Set up "to"
   7.815 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.816 +    const char* to_fpr = alice_fpr;
   7.817 +    const char* to_name = "Alice Malice";
   7.818 +    const char* to_address = "alice_malice@darthmama.cool";
   7.819 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.820 +    status = set_identity(session, to_ident);
   7.821 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.822 +    
   7.823 +    message* msg = new_message(PEP_dir_outgoing);        
   7.824 +    msg->from = my_ident;
   7.825 +    msg->to = new_identity_list(to_ident);
   7.826 +    msg->shortmsg = strdup("This is an exciting message from Carol!");
   7.827 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.828 +
   7.829 +    const char* pass = "carol";
   7.830 +    status = config_passphrase(session, pass);    
   7.831 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.832 +
   7.833 +    message* enc_msg = NULL;
   7.834 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.835 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.836 +    ASSERT_NE(enc_msg, nullptr);
   7.837 +    
   7.838 +    free_message(msg);
   7.839 +    free_message(enc_msg);    
   7.840 +    free_stringlist(found_key);
   7.841 +}
   7.842 +
   7.843 +TEST_F(PassphraseTest, check_david_primary_unenc_sign_and_encrypt_diff_pass_two_sign_unencrypted_withpass_sign) {
   7.844 +    ASSERT_TRUE(slurp_and_import_key(session, david_filename));
   7.845 +    stringlist_t* found_key = NULL;
   7.846 +    PEP_STATUS status = find_keys(session, david_fpr, &found_key);
   7.847 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.848 +    ASSERT_NE(found_key, nullptr);
   7.849 +    ASSERT_NE(found_key->value, nullptr);
   7.850 +    ASSERT_STREQ(found_key->value, david_fpr);
   7.851 +    ASSERT_EQ(found_key->next, nullptr);
   7.852 +    
   7.853 +    const char* my_fpr = david_fpr;
   7.854 +    const char* my_name = "Dave Rave";
   7.855 +    const char* my_address = "dave_rave@darthmama.cool";
   7.856 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.857 +    status = set_own_key(session, my_ident, my_fpr);
   7.858 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.859 +
   7.860 +    // Set up "to"
   7.861 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.862 +    const char* to_fpr = alice_fpr;
   7.863 +    const char* to_name = "Alice Malice";
   7.864 +    const char* to_address = "alice_malice@darthmama.cool";
   7.865 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.866 +    status = set_identity(session, to_ident);
   7.867 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.868 +    
   7.869 +    message* msg = new_message(PEP_dir_outgoing);        
   7.870 +    msg->from = my_ident;
   7.871 +    msg->to = new_identity_list(to_ident);
   7.872 +    msg->shortmsg = strdup("This is an exciting message from David!");
   7.873 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
   7.874 +    
   7.875 +    const char* pass = "sign";
   7.876 +    status = config_passphrase(session, pass);    
   7.877 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.878 +
   7.879 +    
   7.880 +    message* enc_msg = NULL;
   7.881 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.882 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.883 +    ASSERT_NE(enc_msg, nullptr);
   7.884 +    
   7.885 +    free_message(msg);
   7.886 +    free_message(enc_msg);        
   7.887 +    free_stringlist(found_key);
   7.888 +}
   7.889 +
   7.890 +TEST_F(PassphraseTest, check_erwin_primary_enc_subkey_encrypted_plus_unenc_sign_withpass_sign) {
   7.891 +    ASSERT_TRUE(slurp_and_import_key(session, erwin_filename));
   7.892 +    stringlist_t* found_key = NULL;
   7.893 +    PEP_STATUS status = find_keys(session, erwin_fpr, &found_key);
   7.894 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.895 +    ASSERT_NE(found_key, nullptr);
   7.896 +    ASSERT_NE(found_key->value, nullptr);
   7.897 +    ASSERT_STREQ(found_key->value, erwin_fpr);
   7.898 +    ASSERT_EQ(found_key->next, nullptr);
   7.899 +    
   7.900 +    const char* my_fpr = erwin_fpr;
   7.901 +    const char* my_name = "Irv Nerve";
   7.902 +    const char* my_address = "irv_nerve@darthmama.cool";
   7.903 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.904 +    status = set_own_key(session, my_ident, my_fpr);
   7.905 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.906 +    
   7.907 +    // Set up "to"
   7.908 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.909 +    const char* to_fpr = alice_fpr;
   7.910 +    const char* to_name = "Alice Malice";
   7.911 +    const char* to_address = "alice_malice@darthmama.cool";
   7.912 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.913 +    status = set_identity(session, to_ident);
   7.914 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.915 +    
   7.916 +    message* msg = new_message(PEP_dir_outgoing);    
   7.917 +    msg->from = my_ident;
   7.918 +    msg->to = new_identity_list(to_ident);
   7.919 +    msg->shortmsg = strdup("This is an exciting message from Erwin!");
   7.920 +    msg->longmsg = strdup("Not\nVery\nExciting\n");  
   7.921 +    
   7.922 +    const char* pass = "erwin";
   7.923 +    status = config_passphrase(session, pass);    
   7.924 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.925 +    
   7.926 +    message* enc_msg = NULL;
   7.927 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
   7.928 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.929 +    ASSERT_NE(enc_msg, nullptr);
   7.930 +    
   7.931 +    free_message(msg);
   7.932 +    free_message(enc_msg);            
   7.933 +    free_stringlist(found_key);
   7.934 +}
   7.935 +
   7.936 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_withpass_decrypt) {
   7.937 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.938 +    stringlist_t* found_key = NULL;
   7.939 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.940 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.941 +    ASSERT_NE(found_key, nullptr);
   7.942 +    ASSERT_NE(found_key->value, nullptr);
   7.943 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.944 +    ASSERT_EQ(found_key->next, nullptr);
   7.945 +    
   7.946 +    const char* my_fpr = carol_fpr;
   7.947 +    const char* my_name = "Carol Peril";
   7.948 +    const char* my_address = "carol_peril@darthmama.cool";
   7.949 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.950 +    status = set_own_key(session, my_ident, my_fpr);
   7.951 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.952 +    
   7.953 +    // Set up "to"
   7.954 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
   7.955 +    const char* to_fpr = alice_fpr;
   7.956 +    const char* to_name = "Alice Malice";
   7.957 +    const char* to_address = "alice_malice@darthmama.cool";
   7.958 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
   7.959 +    status = set_identity(session, to_ident);
   7.960 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.961 +    
   7.962 +    const char* pass = "carol";
   7.963 +    status = config_passphrase(session, pass);    
   7.964 +    ASSERT_EQ(status, PEP_STATUS_OK);    
   7.965 +    
   7.966 +    string msg = slurp("test_mails/encrypt_to_carol.eml");
   7.967 +    char* decrypted_msg = NULL;
   7.968 +    char* modified_src = NULL;  
   7.969 +    stringlist_t* keylist_used = NULL;
   7.970 +    PEP_rating rating;
   7.971 +    PEP_decrypt_flags_t flags = 0;
   7.972 +    status = MIME_decrypt_message(session, msg.c_str(), msg.size(), &decrypted_msg, &keylist_used, &rating, &flags, &modified_src);
   7.973 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.974 +    ASSERT_NE(decrypted_msg, nullptr);
   7.975 +    
   7.976 +    free(decrypted_msg);
   7.977 +    free(modified_src);
   7.978 +    free_stringlist(keylist_used);
   7.979 +}    
   7.980 +
   7.981 +TEST_F(PassphraseTest, check_carol_primary_unenc_subkeys_passphrase_wrongpass_decrypt) {
   7.982 +    ASSERT_TRUE(slurp_and_import_key(session, carol_filename));
   7.983 +    stringlist_t* found_key = NULL;
   7.984 +    PEP_STATUS status = find_keys(session, carol_fpr, &found_key);
   7.985 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.986 +    ASSERT_NE(found_key, nullptr);
   7.987 +    ASSERT_NE(found_key->value, nullptr);
   7.988 +    ASSERT_STREQ(found_key->value, carol_fpr);
   7.989 +    ASSERT_EQ(found_key->next, nullptr);
   7.990 +    
   7.991 +    const char* my_fpr = carol_fpr;
   7.992 +    const char* my_name = "Carol Peril";
   7.993 +    const char* my_address = "carol_peril@darthmama.cool";
   7.994 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
   7.995 +    status = set_own_key(session, my_ident, my_fpr);
   7.996 +    ASSERT_EQ(status, PEP_STATUS_OK);
   7.997 +    
   7.998 +    // Set up "to"
   7.999 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1000 +    const char* to_fpr = alice_fpr;
  7.1001 +    const char* to_name = "Alice Malice";
  7.1002 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1003 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1004 +    status = set_identity(session, to_ident);
  7.1005 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1006 +    
  7.1007 +    const char* pass = "biteme";
  7.1008 +    status = config_passphrase(session, pass);    
  7.1009 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1010 +    
  7.1011 +    string msg = slurp("test_mails/encrypt_to_carol.eml");
  7.1012 +    char* decrypted_msg = NULL;
  7.1013 +    char* modified_src = NULL;  
  7.1014 +    stringlist_t* keylist_used = NULL;
  7.1015 +    PEP_rating rating;
  7.1016 +    PEP_decrypt_flags_t flags = 0;
  7.1017 +    status = MIME_decrypt_message(session, msg.c_str(), msg.size(), &decrypted_msg, &keylist_used, &rating, &flags, &modified_src);
  7.1018 +    ASSERT_EQ(status, PEP_WRONG_PASSPHRASE);
  7.1019 +    ASSERT_EQ(decrypted_msg, nullptr);
  7.1020 +    
  7.1021 +    free(decrypted_msg);
  7.1022 +    free(modified_src);
  7.1023 +    free_stringlist(keylist_used);
  7.1024 +}    
  7.1025 +
  7.1026 +TEST_F(PassphraseTest, check_bob_primary_pass_subkey_no_passphrase_wrongpass_sign) {
  7.1027 +    ASSERT_TRUE(slurp_and_import_key(session, bob_filename));
  7.1028 +    stringlist_t* found_key = NULL;
  7.1029 +    PEP_STATUS status = find_keys(session, bob_fpr, &found_key);
  7.1030 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1031 +    ASSERT_NE(found_key, nullptr);
  7.1032 +    ASSERT_NE(found_key->value, nullptr);
  7.1033 +    ASSERT_STREQ(found_key->value, bob_fpr);
  7.1034 +    ASSERT_EQ(found_key->next, nullptr);
  7.1035 +
  7.1036 +    const char* my_fpr = bob_fpr;
  7.1037 +    const char* my_name = "Bob Mob";
  7.1038 +    const char* my_address = "bob_mob@darthmama.cool";
  7.1039 +    pEp_identity* my_ident = new_identity(my_address, my_fpr, PEP_OWN_USERID, my_name);
  7.1040 +    status = set_own_key(session, my_ident, my_fpr);
  7.1041 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1042 +    
  7.1043 +    // Set up "to"
  7.1044 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1045 +    const char* to_fpr = alice_fpr;
  7.1046 +    const char* to_name = "Alice Malice";
  7.1047 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1048 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1049 +    status = set_identity(session, to_ident);
  7.1050 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1051 +    
  7.1052 +    message* msg = new_message(PEP_dir_outgoing);   
  7.1053 +    msg->from = my_ident;
  7.1054 +    msg->to = new_identity_list(to_ident);
  7.1055 +    msg->shortmsg = strdup("This is an exciting message from Bob!");
  7.1056 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
  7.1057 +    
  7.1058 +    const char* pass = "biteme";
  7.1059 +    status = config_passphrase(session, pass);    
  7.1060 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1061 +    
  7.1062 +    message* enc_msg = NULL;
  7.1063 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
  7.1064 +    ASSERT_EQ(status, PEP_WRONG_PASSPHRASE);
  7.1065 +    ASSERT_EQ(enc_msg, nullptr);
  7.1066 +    
  7.1067 +    free_message(msg);
  7.1068 +    free_message(enc_msg);
  7.1069 +    free_stringlist(found_key);
  7.1070 +}
  7.1071 +
  7.1072 +TEST_F(PassphraseTest, check_fenris_encrypted_key_generate_with_passphrase) {
  7.1073 +    const char* pass = "lyrium";    
  7.1074 +    PEP_STATUS status = config_passphrase_for_new_keys(session, true, pass);
  7.1075 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1076 +    pEp_identity* my_ident = new_identity("fenris@darthmama.org", NULL, "FENRIS", "Fenris Hawke");    
  7.1077 +    status = myself(session, my_ident);
  7.1078 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1079 +    ASSERT_NE(my_ident->fpr, nullptr);
  7.1080 +    
  7.1081 +    // Set up "to"
  7.1082 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1083 +    const char* to_fpr = alice_fpr;
  7.1084 +    const char* to_name = "Alice Malice";
  7.1085 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1086 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1087 +    status = set_identity(session, to_ident);
  7.1088 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1089 +    
  7.1090 +    message* msg = new_message(PEP_dir_outgoing);   
  7.1091 +    msg->from = my_ident;
  7.1092 +    msg->to = new_identity_list(to_ident);
  7.1093 +    msg->shortmsg = strdup("This is an exciting message from Fenris!");
  7.1094 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
  7.1095 +    
  7.1096 +    status = config_passphrase(session, pass);    
  7.1097 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1098 +    
  7.1099 +    message* enc_msg = NULL;
  7.1100 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
  7.1101 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1102 +    ASSERT_NE(enc_msg, nullptr);
  7.1103 +    
  7.1104 +    free_message(msg);
  7.1105 +    free_message(enc_msg);
  7.1106 +}
  7.1107 +
  7.1108 +TEST_F(PassphraseTest, check_fenris_encrypted_key_generate_with_passphrase_decrypt_nopass) {
  7.1109 +    PEP_STATUS status = config_passphrase_for_new_keys(session, true, "lyrium");
  7.1110 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1111 +    pEp_identity* my_ident = new_identity("fenris@darthmama.org", NULL, "FENRIS", "Fenris Hawke");    
  7.1112 +    status = myself(session, my_ident);
  7.1113 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1114 +    ASSERT_NE(my_ident->fpr, nullptr);
  7.1115 +    
  7.1116 +    // Set up "to"
  7.1117 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1118 +    const char* to_fpr = alice_fpr;
  7.1119 +    const char* to_name = "Alice Malice";
  7.1120 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1121 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1122 +    status = set_identity(session, to_ident);
  7.1123 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1124 +    
  7.1125 +    message* msg = new_message(PEP_dir_outgoing);   
  7.1126 +    msg->from = my_ident;
  7.1127 +    msg->to = new_identity_list(to_ident);
  7.1128 +    msg->shortmsg = strdup("This is an exciting message from Fenris!");
  7.1129 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
  7.1130 +        
  7.1131 +    message* enc_msg = NULL;
  7.1132 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
  7.1133 +    ASSERT_EQ(status, PEP_PASSPHRASE_REQUIRED);
  7.1134 +    ASSERT_EQ(enc_msg, nullptr);
  7.1135 +    
  7.1136 +    free_message(msg);
  7.1137 +}
  7.1138 +
  7.1139 +TEST_F(PassphraseTest, check_fenris_encrypted_key_generate_with_passphrase_decrypt) {
  7.1140 +    const char* pass = "lyrium";    
  7.1141 +    PEP_STATUS status = config_passphrase_for_new_keys(session, true, pass);
  7.1142 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1143 +    pEp_identity* my_ident = new_identity("fenris@darthmama.org", NULL, "FENRIS", "Fenris Hawke");    
  7.1144 +    status = myself(session, my_ident);
  7.1145 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1146 +    ASSERT_NE(my_ident->fpr, nullptr);
  7.1147 +    
  7.1148 +    // Set up "to"
  7.1149 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1150 +    const char* to_fpr = alice_fpr;
  7.1151 +    const char* to_name = "Alice Malice";
  7.1152 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1153 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1154 +    status = set_identity(session, to_ident);
  7.1155 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1156 +    
  7.1157 +    message* msg = new_message(PEP_dir_outgoing);   
  7.1158 +    msg->from = my_ident;
  7.1159 +    msg->to = new_identity_list(to_ident);
  7.1160 +    msg->shortmsg = strdup("This is an exciting message from Fenris!");
  7.1161 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
  7.1162 +    
  7.1163 +    status = config_passphrase(session, pass);    
  7.1164 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1165 +    
  7.1166 +    message* enc_msg = NULL;
  7.1167 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
  7.1168 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1169 +    ASSERT_NE(enc_msg, nullptr);
  7.1170 +    
  7.1171 +    free_message(msg);
  7.1172 +    msg = NULL;
  7.1173 +    stringlist_t* keylist_used = NULL;
  7.1174 +    PEP_rating rating;
  7.1175 +    PEP_decrypt_flags_t flags = 0;
  7.1176 +    status = decrypt_message(session, enc_msg, &msg, &keylist_used, &rating, &flags);
  7.1177 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1178 +    ASSERT_NE(msg, nullptr);
  7.1179 +
  7.1180 +    free_message(msg);    
  7.1181 +    free_message(enc_msg);    
  7.1182 +}
  7.1183 +
  7.1184 +TEST_F(PassphraseTest, check_fenris_encrypted_key_generate_with_passphrase_decrypt_wrongphrase) {
  7.1185 +    const char* pass = "lyrium";    
  7.1186 +    PEP_STATUS status = config_passphrase_for_new_keys(session, true, pass  );
  7.1187 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1188 +    pEp_identity* my_ident = new_identity("fenris@darthmama.org", NULL, "FENRIS", "Fenris Hawke");    
  7.1189 +    status = myself(session, my_ident);
  7.1190 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1191 +    ASSERT_NE(my_ident->fpr, nullptr);
  7.1192 +    
  7.1193 +    // Set up "to"
  7.1194 +    ASSERT_TRUE(slurp_and_import_key(session, alice_pub_filename));    
  7.1195 +    const char* to_fpr = alice_fpr;
  7.1196 +    const char* to_name = "Alice Malice";
  7.1197 +    const char* to_address = "alice_malice@darthmama.cool";
  7.1198 +    pEp_identity* to_ident = new_identity(to_address, to_fpr, "ALICE", to_name);
  7.1199 +    status = set_identity(session, to_ident);
  7.1200 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1201 +    
  7.1202 +    message* msg = new_message(PEP_dir_outgoing);   
  7.1203 +    msg->from = my_ident;
  7.1204 +    msg->to = new_identity_list(to_ident);
  7.1205 +    msg->shortmsg = strdup("This is an exciting message from Fenris!");
  7.1206 +    msg->longmsg = strdup("Not\nVery\nExciting\n");   
  7.1207 +    
  7.1208 +    status = config_passphrase(session, pass);    
  7.1209 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1210 +    
  7.1211 +    message* enc_msg = NULL;
  7.1212 +    status = encrypt_message(session, msg, NULL, &enc_msg, PEP_enc_PGP_MIME, 0);
  7.1213 +    ASSERT_EQ(status, PEP_STATUS_OK);
  7.1214 +    ASSERT_NE(enc_msg, nullptr);
  7.1215 +
  7.1216 +    pass = "bob";
  7.1217 +    status = config_passphrase(session, pass);    
  7.1218 +    ASSERT_EQ(status, PEP_STATUS_OK);    
  7.1219 +    
  7.1220 +    free_message(msg);
  7.1221 +    msg = NULL;
  7.1222 +    stringlist_t* keylist_used = NULL;
  7.1223 +    PEP_rating rating;
  7.1224 +    PEP_decrypt_flags_t flags = 0;
  7.1225 +    status = decrypt_message(session, enc_msg, &msg, &keylist_used, &rating, &flags);
  7.1226 +    ASSERT_EQ(status, PEP_WRONG_PASSPHRASE);
  7.1227 +    ASSERT_EQ(msg, nullptr);
  7.1228 +
  7.1229 +    free_message(enc_msg);    
  7.1230 +}
     8.1 Binary file test/test_keys/alice-no-passwords.pgp has changed
     9.1 Binary file test/test_keys/bob-primary-with-password-bob-subkey-without.pgp has changed
    10.1 Binary file test/test_keys/carol-subkeys-password-carol.pgp has changed
    11.1 Binary file test/test_keys/david-encryption-subkey-password-encrypt-signing-subkey-password-sign.pgp has changed
    12.1 Binary file test/test_keys/erwin-primary-encrypted-erwin-subkey-unencrypted.pgp has changed
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/test_keys/pub/alice-0x2A649B9F_pub.asc	Mon Jun 22 23:46:21 2020 +0200
    13.3 @@ -0,0 +1,41 @@
    13.4 +-----BEGIN PGP PUBLIC KEY BLOCK-----
    13.5 +
    13.6 +xsDNBF7nH6gBDADkxM9QP1fAQ3sSoBFMvwIvyRLfZXzlBFsShFMuNdX0HBF4vgr1
    13.7 +fLoUR8ZLajknAZdyMSfGfYgFpcJ/8he6zYisdGglset3Aho9dAUE+RSIf9Skhmux
    13.8 +QJ8eLtNBkWLiMB5hqe7uoHmgMGv1p+g4JYed24uIQOANPXilnSKVawDRexrPkSie
    13.9 +CQ1traZkl8aAURqJfQ7zMac+pLuylJMZtcLoL4jBq/aAgn82kLT7aHjqpy0Ks33S
   13.10 +FviYte80U9lnYwqhgunnSpKYDOqXZRkysiF6+p8Xhq23ZYZt6l5byYTI3NdEbB+j
   13.11 +6isees3YkHx1vFwp7uWQcsMVruGH9GngJyMaigDbOhxQ02IzQ6j+qd42gpLpFzTJ
   13.12 +nmVoCvqbo9nrGHeD4kiW+nyIMXH7icyr8qWLvzVQe6rpBbWBE2a9i069zWd5XUZY
   13.13 +3nSOBYMyp07lr53Tx8D1R60F4uwF2xpvdxRE5M0l38kqdgAgDGXDcqfo2lv13Yw8
   13.14 +pJ0mZAWbwF6HigUAEQEAAc0kQWxpY2UgTm9wYXNzd29yZCA8YWxpY2VAZXhhbXBs
   13.15 +ZS5vcmc+wsEOBBMBCgA4AhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAFiEEA6+I
   13.16 +9yi46arafzcL1BgBxipkm58FAl7ncuUACgkQ1BgBxipkm5+xjQwAqozUY71r0hDt
   13.17 +7KCnWNRzwPKAGhgQ+bmmdKzz2uf7CBKw4LelrgRc5CX29iCpuL+OrTRFFVZodD96
   13.18 +XffTGWyZ1rI0FpNGskIgjmGIOY+dNmAi1x2+lavluWHkUMRDfQ761nj5EkU/dQLQ
   13.19 +Nfu/nN73wMJcotB2IfQcVtOy//cFPit27Z2Kk/G7rNh/0yc7CZYUpwT+NsRILag+
   13.20 +Av81eVK4KmKXBQmhqZy9TOcp0rtlu+1ReVdQLUIcfeOEXp9pj6c57oCcZKVR+CWp
   13.21 +yiwHuJBYeZY7vP0RvORCEnU9Evu/5Lb+uGx8rzUzPFrjvFXGtGTuWQk/ay4RbzIR
   13.22 +sgDCkV97LdzXMJtxIdw7jm6OvntRkqTvVoYf+ZbV2B0EXd28Uj5OUtqe2jbzN9Rf
   13.23 +sIuRXe4zkcm+L0hMkq1zE/Ryj2li9iF18RbhNfI8VlaRhiD3mkg8JFuVN/zXVDkE
   13.24 +8O6KvqCMf3/sM7KlEqf4rNAhUulbMTXFhin6A/lFtwapPlr3s0UYzsDNBF7nH6gB
   13.25 +DADoIXSJAp+EjbQOdLiiXpAraNOe9bB6ESU2cfHKHj3BdNLyLS+o+fY4AZEM4xuW
   13.26 +oE7ItrIvfZwvvNfHZUiC1OXyxTnzE3s0NgAPKIMwdx9btBWDoJQdtKKKC87gIO//
   13.27 +NYCQtsZug29nO+AM/lS+K9sov011mgc1G1180cxBJvPWmnYvpXqLmbPKPLREsJYE
   13.28 +xCGA2yosJrCj1Ojp/vqUsL/+F+ohmw/96hfzOs1n1MaAe8ZSu8t38DGC9oPrPIry
   13.29 +fwHnOzlxE49VwKfxLkeGHi8K+4SRu0mehnlHoUk2rbIT94ZnKECaIINNllDev87K
   13.30 +tILlufhKrSaS/m+sSIIWrpbv8Bk2Sd6GjXaCWqbDgeyse8UYKVd/xrzuXot4UtS9
   13.31 +884K6fBL93nGQ4XSNz86Lr//PVP7fYniZ+SaXYyl70J+zLvM8gpz2pLsdksuOS90
   13.32 +AUeuKaPEG7acYarURtpbrlro1KhJNGhHheiIlY+3JyQrF6cVlpfVe7/kI3UbY0Fo
   13.33 +MZsAEQEAAcLA9gQYAQoAIBYhBAOviPcouOmq2n83C9QYAcYqZJufBQJe5x+oAhsM
   13.34 +AAoJENQYAcYqZJufsuEL/0HNJDARhApaC4MVTTWBZx6g6vphu5QXgbEZQqZKqTFF
   13.35 +/q23Q5rUt8xbtHOjTW1987iqt1CJpF/zN/GQg0WD4HZdNjSjiqAXwpsCRHkLySa+
   13.36 +Sx48qC2Nt6zY7wDY6g5o6faI2sz5dMj+4zEXHzQ5cpH8Jtm26BIO24+om3eY+w/3
   13.37 +2o9mJSgxiFzxUY0hAaOlpTgrRdHlER3KpHEBzJm0pAMUHHxP4rh862UMYMxhtUF6
   13.38 +vTUUwYyJhdaAAOgNLOWOMf1tzrgUVeVn2uNoU3vmF9G/+jD4c7jsDd5c1pcwR21W
   13.39 +M4ZyjGIBEglcHDZAjHyw3yBnk1bcWRtTZS5mzHd3dTTIz3ANNKphnam8Nxrx7ywX
   13.40 +x9RDjxKS9L0AXeJaqFy5MvhWxuIk7HPugJf5/oElnkC+wUx4Nnj0xFB55dIEgjLU
   13.41 +3d+wzRRVOUpeFSa73osUp+Hu+xg69mWhk5HYoaK69/orrcHyQuIKXbTTcIE0+XLw
   13.42 +rmeyrQ3bl0iN+EORxt8C5A==
   13.43 +=PUpM
   13.44 +-----END PGP PUBLIC KEY BLOCK-----
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/test_mails/encrypt_to_bob.eml	Mon Jun 22 23:46:21 2020 +0200
    14.3 @@ -0,0 +1,111 @@
    14.4 +From: Alice Malice <alice_malice@darthmama.cool>
    14.5 +To: Bob Mob <bob_mob@darthmama.cool>
    14.6 +Subject: =?utf-8?Q?p=E2=89=A1p?=
    14.7 +X-pEp-Version: 2.1
    14.8 +MIME-Version: 1.0
    14.9 +Content-Type: multipart/encrypted; boundary="7fdcc2331befd79f41a7c4c96b68079a"; 
   14.10 + protocol="application/pgp-encrypted"
   14.11 +
   14.12 +--7fdcc2331befd79f41a7c4c96b68079a
   14.13 +Content-Type: application/pgp-encrypted
   14.14 +
   14.15 +Version: 1
   14.16 +--7fdcc2331befd79f41a7c4c96b68079a
   14.17 +Content-Type: application/octet-stream
   14.18 +Content-Transfer-Encoding: 7bit
   14.19 +Content-Disposition: inline; filename="msg.asc"
   14.20 +
   14.21 +-----BEGIN PGP MESSAGE-----
   14.22 +
   14.23 +wcDMA5ETfiZpd6jgAQv/QIvYtGuhvDl5BbZuXUuVWTHCoOkntUR3hImfyEae2vgL
   14.24 +bU12WNwCmBnwJEDAp6rmxhiIOasxBBwVM0cw8MmJEbls6k9Vllw7bdh2sawiX1CY
   14.25 +mOvzlkSfT3aRbbmwGrG9n3yW234+Q+NcSEq4BBhwdw+NpbgUfBLW5bc+gtIGTmLQ
   14.26 +kilHGE+5GKDorjOIOuZkRkHpPCOqjdoOOpVrtlIYS7it8gL8vYCjVsJS7/QuZloY
   14.27 +UCxEATZijJO3mRwnGEJ6VfnZ9n0Bgbx/+KypHrJIIFT1exeavmb2Cuu38fULbULh
   14.28 +eGVESnuR7K0rJBm+h7O2BMVzpo98itXZMJG8W09T1hCP8ZnEZFOXEDWxc6PpToIj
   14.29 +y0Z3HV8ltzJ1muqyPsRgqnjrjgSAiKO7XbPWdJFncLf98c2NY8U7EwW5ZaS0ComB
   14.30 +wseHIaRkSdG4iaQ7nAt5otJzdPvu59UkM/4yq2x7JWJbdnhnefj3pp8zv06EZAoh
   14.31 +lBWVEG4EV4NpOUznFlW7wcDMAxDNpHpjDi4AAQv/YjGWvJ/I6hqQy9dihCFu9pDC
   14.32 +NLkdDA52Z7WmrVcFdn3L+MpGtPUEjU8v+GxI+oWHc5qUYqetivfzkkCzIyu2aPo4
   14.33 +xVnHtm2jPz7gHhHD7bw/ZHQQJDxagIFKda/+avrNd7s2Hxh1lyMpXVRz5zjSjb2F
   14.34 +JoGAVerjXuMaMEo/4kl224tiGjVPYg0ELlZwe1ek43M1d9fIbdSV4/40KI4rKVCE
   14.35 +Q1h2xRDRbJtRXqPC7Pbz1oJa91RkKT3cHP1qF9VBZ4NpPdzPu+l8QS44HUJ4nrH4
   14.36 +ZYtGOFM210fKhTxDSlUHsHMI9y7F851MDDYHkCMZR6EyLfpR9LDUmiH5QKa0DRzC
   14.37 +k17+ueEopL3L92UoIhgaIH2k+znyXKyY7XKwA7G4sd8vcvkqwb6uG4eidl34MBuW
   14.38 +qg3KMbOs9CTQ/wAfx0H/BAmi+9yil22BgpZvM+Fj4HEB93bZA+R/uWlU4/9h/xRB
   14.39 +X34PIJ2wJbBjwETZa9KWSgjC4kPadwu6K9gLI0hI0syfAVtvmRbmd/PvKjSabJ1L
   14.40 +iwoGVdkluD6r/6L2jL3ZxmIzqoxh13zjWSk4Cc46Wumj5th+MJX4YR2dFRo70+SY
   14.41 +/Cgpwkm4O8XxjjKeQvKmc4VYhzNdDYS8S4QqHDKJL0tDaWNv4HAvSMshKV+Jvbc8
   14.42 +ujlQHPte1PAsV83y8BueybkykaHvpZuoxQ3bGT/JRovUODmaXAyHcxUdbh2N1o7J
   14.43 +ewuG1cI77HPJyastqo83Etiz2sDVWWBWcut3Gg0f0D4W6T2oB6z/nXxKkhR3StXy
   14.44 +ABfQ/UGafS4RWBlp6bq8G38mFHOfjqZ0M7RfVVjiC/ani3NjWWcaKWJ1adL6wmdu
   14.45 +YlzMgNfZZMafyOleK/9SZU7bL99MpmATNlQ5mCYN6kKUSkiGInrti3gttV0zep05
   14.46 +sMCNiItnpurj9MES5sfwtAE33A80OR8XffYrLZ7FIPe6qTLk2A3aJ716juv4PYoY
   14.47 +ku+oaQmC1CPwzDLULQ2VCE/ha5baPsH8K84XQTPNUOIRBf/uDzIN0irAfY55D/kl
   14.48 +JmIksdaJmG5uXq7BpfqRhm/imBc3QbVFatR8AZT4e97MuVp01PQDsWvzeqIwHxFe
   14.49 +8papmnJ3frJYINZRo6/RCusLstpkxoO0VPiGLcApTGxFMW5MLdgM3prTsFsHL16X
   14.50 +VNNQS3rqsv8bg0Z+bcHLEuDnoG7EVKmMZYqZRUnxjO22eqLGEGKi5k3niL+BcGIJ
   14.51 +I1Ew2LIGR+VEjzBGwzRaRPfNvcPxVCPZx0A8ReR0VbByJrJvtfrwK6tZ9UzX9sld
   14.52 +bWf/3s3Y1WRP8zycbi05K6oPyHKdjm3x1pvg9anQcvGBUU/uhiqYPkcwDtHEzRvD
   14.53 +XZICAS1Es3nmias+RQrVdYu9T8A083nDAFA7FcMCXefx+wWuGlPceu9Gi1W7/a1A
   14.54 +/DF098XzO9UBnS3YEqSdCDResbRhQ3Jk4n7FcoWylZipC5xyFKwRAKlHyGWRVcPT
   14.55 +WxxW157X2/ED7txXXLR3yhhN/M6OICYmIwZp1sieQgFgSl61Yn/RvCfySbEo9Bkw
   14.56 +JGQYJzfGlbTzJz7IvzjEqHNrFHytMNJdB0zvTn5a3hchMgIf8RLxsOoQV7B29x4j
   14.57 +AHnXp0JgQrvLGJySj1XRxN/38M6t63THETtDoJMDetfCeLvjjtj9CdoXbYWZpiR6
   14.58 +ksrmrD53tcoopSBAkCP9ucvE6eLCFFp+IL/g/64bgvkH291EuYcczzgW1qYeCvWq
   14.59 +ggZucdU7f8tuOBQEPaTUcB3Z5OLHpvQA58oegqOOW42nsxbDgD6fEZdlAeCLB+7i
   14.60 +yobK0YrhBkLlz/sc3HQYAQHOgdjqldBGNGJUIDqO8JEQVCzqm5AXRDN9t7hbQhL5
   14.61 +TUumW2vAoIQRsJ0jOUWmr3b9fD0jBikOUdp2+IzWfByxYNJVeFSkhZaLIdNPkTXe
   14.62 +raStZ1n7jKRNjpaUw8XdDXjGeEb0e265LNXwssufu8/lvMFuQuAkFfLfowiA37ZC
   14.63 +MjB3z7ho2F/jR/bZr0gRD2Iq7QaJJZMXT6+g1pEjKJlguVkaq/BdXbWuwqCcCcj/
   14.64 +lzKrxURBRzbOMuPh+6Osr56fPO0Sg7tgbco+TpIvHwuJ3KquAbnjXB0aaBFN9DKE
   14.65 +zw6Agp4voqEWYqeV8ZaHFtsw8MWZPC4lnBj6Bp3oqU7deKImpZ75aiOpqNzCGIg4
   14.66 +mwYRDxdOJdjc7W8NRallxY2A9bu5SZ6PhcEQpatTWJ7G86ulvt5eQzcBO6LVFMV1
   14.67 +fx8RXJM/NM7pQSXil77rWAfeUcscMZr9sTRdJnbW8JHsX+t0sKklpQjDhiR7bsjI
   14.68 +PKOc1PjXmX8S9rfLUInfSRFkSmbGrPA9DI4J4z2fPoBisuhqr0qnpUjTfCxeE40V
   14.69 +ZLHsl15U/j1a2e7Sj7j9iG0A58b4I/NvJhAyAWPaAfueM07RA0d5/AwdsTzhEeVz
   14.70 +fFaeoXszHVWFZ8vd1gHZVDALXxFOpPDlaVDKW9SQUbR6/xXgI25rdV6LYiW0Y/TY
   14.71 +hwjX+9pOlf54DbGhH4LeS8z1hUu/5T8RJ/tf7GmHBTLeIoRl609MvEX9+uw2GY98
   14.72 +ewBIi+hcav/wtE9VLK7PJYylgRgs3MuMtATa5AAd4UNrC/3vTpTHigFvSNNE4vVi
   14.73 +jMRCg6HQYadKpBPl+ls9CgPN+oV1tVce/iMzD0rpxj8stPGuZgKwC/77Ysbyyr11
   14.74 +7BiETJp/ENBzdPJ6qNs+d/TbPciG3//Nq23TqbiBn1/Jy7WOizr8VbH3+S0BAHHg
   14.75 +DZwyyaA/A6OaNyi93DfT9fldrwTYWlvOEg+gz//0StTfKeHGnqLq0FPJ5mFq8KF3
   14.76 +tKV7y9ynxxOomiTMJS/q/ksexTrGX+icHlv1mAnyVPOTt3O+MkT7N8sG5UruAI7U
   14.77 +N7IjPoxZDtQYhJuJgkrM/8oi+h3RcGkeNV8TVxdIqE1/UV2aZ2Kz9YDNZmnPvEOt
   14.78 +4olu0cs9yvVPNOFGAiry9lwJX+X1zLNNKg+E6BO9nHYoaN81ZtEVjEFhY7CLiWFz
   14.79 +Ggmx+jCJrmNJIJ+2JtsndLTadmjzhOfqiJjd3ldeooSRdVro+0cFzTTo0rEo6WPi
   14.80 +6k3yvJepu5FRgkYKjEBfbw8FuKmgV3b0h0z7hyJi3J7SO4OlCSR82o76a0Fs7Rel
   14.81 +ukpssZyqF3yKwHjR8V9yD+fPXpQmm4BX7Fan6JO+XJomi7NYd46HWIRd4M0xP3fJ
   14.82 +dK2AlIpwoUjPv4O/cy5bw4kYKNFEfJ8PmTiYQ+8Moo/SpP5CXUz5SLkydU9+TYoL
   14.83 +cWatrje6IHukohjdZGqQgnWzyzmjlHg9Sdbjo37T3O6SkjFkJloKnzOXfWZFmzVQ
   14.84 +S2vJndCdhJp3KRF3F1ZsUkAol7THYkJVUHnvcbQaZDbYJxx1Pfum0u6s+g1VpLiI
   14.85 +CODGNMJY2aAB6B9POvWKVcVIjY6Q6lUp6FONHgHNZk5qKKt5H5zDQWVMzej4rarx
   14.86 +6iePQ92+wqE6cJ4h0yS5KBnX8cSFzNqN4jiZakumbgVAK0AkQhqULg8Q9ykSauUy
   14.87 +yAgpMKT15rBh/TO4+AqFhc3FApNrIDs0dGPwIqaBOoHDKpqsqvmPrScxLtedOvBi
   14.88 +fjbhxA0FoVK0DqAhD/TC0UDNjUXtGYBh6bDyBCSo3B7r6l8A7daeZMzPaxjbAgk8
   14.89 +nX+NX0OTgoRKf5JGo9DHapYOASBIFHbfnPLLsDU7wBBefO7rjBQIcXKytKfOh6q7
   14.90 +f6aiMd6Dz15660Da1a8F9uM9EOT3qHTpubymJ+yuN39kteLVtWfAMh8hsfG9Ep0R
   14.91 +6FUbYjGTsmxncbDItA1wBhw/bdGF52+apglgLPhGwwi078/NorGmI27P51vfqkrs
   14.92 +OpLL5SGrJ67ORl+1g8pxHGmm6GmrBEsaqqiRwxOxFlrJAAm89HHTfAEDXxuZcTw6
   14.93 +84XlXq6Fly+Anl+AFprX823Dd0spbS7WtuyojVJCHNzY/xvnt21jHRotF5EMWmJ4
   14.94 +7hgb5rBonAZpc4RACMamGfMbHOGAxPK9gposagLJRdxnbDUgab7E/YjS4B5NZxod
   14.95 +usy7bx6MLHI7V8rlSyRrQ5YyB/Wupd00yUAI+yk/xcq4vw8liwNlL8oEa/0Mmx1b
   14.96 +hyTV3Wy5zocIfE/1wTlzfUenJUtvq55C5f8ZC2kekRx1+0Ff3hW4b3WukBvMK8t+
   14.97 +OW/3gS/+aXaaFKLBVpbhg1Fqsy5Crj7+kIekWcCzsk2932IGFAmGQCqprdS/8oot
   14.98 +SE6Lx+AnHwww2mtGFv1jvv7THV7F6HJlzRN8JNFqbl5PNvcZ7SgWkNbKjaKnhC45
   14.99 ++u5bxK1xTCc8QFesmTmiIeQnrSXqXTs+qAiWjyX0DHl4/zSGL4ffQXbXcSUGNM7/
  14.100 +k04Jv4cW1jc+lHVczwevqWfKHuwSbtUXFTKobLxYAwbgU3rPl74aH8VCbScz4bSr
  14.101 +26ALlxmyuNWYWGSy6YpzvBEZDR0ZbbKwwKIlsUQSOt+UdqWoFU/PaIrxVTGAh1FW
  14.102 +Dg5Jw7sfj/OC5y4D1AiuZoEWmm6iT0B4YgBUMLyvVYVOK3yT369zH+7H0CQrjwEz
  14.103 +J1SP5bDS6Dl63KmeWd9aQmI3G/WHWfP6siguWyVH2byWDWB2UgTNrkvFyzcFO8bD
  14.104 +wPB/QPLQ3YWz6NreRabw4bDXNjg9bVJhCOPce96FLUdCcgmitXMIZoVAFS5aQe6t
  14.105 +NiLmiGKkhOZDl+uCRyMnAdflxMePkh7ydhjJSp6q4XwugSrkoLlIeFHnHlmxQqrQ
  14.106 +g5PxYLE60GQDo8lFX8y3g5wPeZWWU3+ouZvsY0DiPXu7h/uNQHNd7K19Znq6MiyY
  14.107 +O0TMncGGr5H3oO/GI6rMJ4pnRf8xKJZmIah45GMIGR/Dr4a11NkjF4yDi0w3hnVy
  14.108 +DA1XEKwl/NdnbEAFN7oafkBbyNQOrcPRf6YuGfh6/CT6DpmTe929MyZZAONmcmeP
  14.109 +x2M5Pxh4UaogJP24e3r6be1+Qc+6LfHujjAOX+s6AjqMYh+3iMqId/5AQ/fFSDMC
  14.110 +XtPiXMQ4UaFrWfv7nYT9XgaqT4mHk5LYnRXOYxV4qSV9sGn8oiS1/AKBk1u7mqxx
  14.111 +=qJyw
  14.112 +-----END PGP MESSAGE-----
  14.113 +
  14.114 +--7fdcc2331befd79f41a7c4c96b68079a--
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/test_mails/encrypt_to_carol.eml	Mon Jun 22 23:46:21 2020 +0200
    15.3 @@ -0,0 +1,112 @@
    15.4 +From: Alice Malice <alice_malice@darthmama.cool>
    15.5 +To: Carol Peril <carol_peril@darthmama.cool>
    15.6 +Subject: =?utf-8?Q?p=E2=89=A1p?=
    15.7 +X-pEp-Version: 2.1
    15.8 +MIME-Version: 1.0
    15.9 +Content-Type: multipart/encrypted; boundary="3f2dba317c83e458257130a362bbd95a"; 
   15.10 + protocol="application/pgp-encrypted"
   15.11 +
   15.12 +--3f2dba317c83e458257130a362bbd95a
   15.13 +Content-Type: application/pgp-encrypted
   15.14 +
   15.15 +Version: 1
   15.16 +--3f2dba317c83e458257130a362bbd95a
   15.17 +Content-Type: application/octet-stream
   15.18 +Content-Transfer-Encoding: 7bit
   15.19 +Content-Disposition: inline; filename="msg.asc"
   15.20 +
   15.21 +-----BEGIN PGP MESSAGE-----
   15.22 +
   15.23 +wcDMA5ETfiZpd6jgAQv/dibJCVP/LvUGdnBuIQp37k7OgT/6teqX26/DmFUQ5OCy
   15.24 +PFBMq7P9u6iIlBAKIrf0q72J144N3Pz0DWvpdJj9RgUUI2NBefdB2Gbpj+OzOg6Y
   15.25 +I1FcSb3uDYFT2cNQgAugsZKx87+CiSYNvmtc36N2MlQ+wYDV3Ag4Kg4HDdb4d8K8
   15.26 +d88vGoJ7TXsfhWQuZUnYP7gjwa67TxUJeCXbwRsyxvGFL7FH9EE0BcpFuyoifv1A
   15.27 +OoTOm2/wVmaiQY3cXuqzZEWEds4tf7KrdPvu3SBhKjVyeA2bgTpLVQv/TlhuLoBT
   15.28 +fe5Y5J+BEdsr8piawig/THvRkzmvTLKI1ZGRGc8/1Qv0iIeBUw1TmqxDewzYLywN
   15.29 +ViiWLJWCl2YJPPKag8EhPeSbKcRTgPbclB5cKLF3DJmemutUIVO04T/fy3Z7NKOx
   15.30 +07lBBpzr/cfiez7Uk1cVzIDoSS23Tct3rko0FuoVQdh1cRO6VBZqXE4qHNLl3XBc
   15.31 +NafhsgB2taHPWTAVaoVzwcDMAxe8Q88W9b+qAQv9GwFtTkH/dTq6pO6WBDQoZ5Zl
   15.32 +3H5vKS5AuG3h5R1DY7Q/Q9B1+naqlFxXxpja5ZBSPbXqKfSCsXOxIj50QZ0+h8Ab
   15.33 +t3DkAPIrzF4tDtJg3nj6TylD58C8VQPHgpVUQCW7GGYtlfHtflTioGGoLyZwON2C
   15.34 +WB2VlMu+70rfgDxS6KZq3WmylNNbYCcH/h2ztk6QEUWUuTKFfKGTqOlg777MjNNv
   15.35 +9+Cq8lG26dls5vMNsh0q/DLLz7dCefUJo0kE/458mJdxT/4yF5/Y5FTrJe7EiaGb
   15.36 +nE47ehQsS/Tl/2ymCBmYlrCgdeR+wh/DSq8UQ+F97cIWNvqj5rMgFB+uHXpD9Upb
   15.37 +CJimqUNeB33oJIK9aMppNxYTNqJlT3VKeOUZr8CfDWtZ0XHI2imoUvb8Ok9E++qP
   15.38 +F5F3wHJpXqM820b8sDpDfnPARRDl4/ez5yqOoeT1DHB2jCx8Kl3LbMYJl8/uaiyy
   15.39 +cd7vR8pnCOzjnO+EzaiBRX8aYfOu3KtyOM5S/LM/0syjAVuf7RaBe/GYOHKrY154
   15.40 +6B8ioD/UHRLRyCmeo6mwxUP95TUFbWHD6WEZn25PwskBVu5yD1u93CFvtcnDupuV
   15.41 +Aqvpq3Pkdqc/VNsm/Lieicclo+OM8Nwhj3wOxs2LJks732aYuQAF6F/f3LWrUqeU
   15.42 +R74P0IJnCkwFelGNQiKZUAoPEKf9N+v96tHiJH8HqJsENcA4sK4BSDOnuPZe29m/
   15.43 +hRuR9FjHBGy0JePuVfGZ05c1RY5jpNDRNjjWjwoEt8FDzRsQiKl4nN4vuHx5CrWt
   15.44 +/GN1qB/+PrgH/PusXY9khAz6510joCHz404SA16AfVc/wzTh5RkRaw/BPWP5HOcZ
   15.45 +UjEdjH5vtZ3iGML4UGTU0BWdSiaknWNRac4Hq55Cac9i8aICVbPrfuy1wjDSe+gs
   15.46 +41rFVO/W+UWkzNvr6Ho8fj7hp3MbN9CArBCRkL+pEJwYdgwclDFsDh8/smfifCW3
   15.47 +Mbg2wk7GKm27dhcvy7eWpFnL+ckeihn09cGKjAXt833P28mcGg4KPWloSyHPvXHg
   15.48 +BZ215whT4tevp3jwoOU+yzpcuryAUueL6FShVSYMK0WSFivhjXnQcVPs9O41rfDT
   15.49 +cUiP27FzLTj46QiFRdVB61MaeE4AtM+g5VppV4adgcFILzLP4CRZarh4yAMiwKND
   15.50 +H/U/0TSxKBRurCbR1lZclfftxI1dfESI2q2j3cboXoU60O943/otHyhoMGiyIEcS
   15.51 +3BWPshtvP2PmWz22W3SHJiqH3JJeyoqXYx7dVsf80gi3rVCl1v9rumAAGZzGyoa2
   15.52 +BbuY0PP5syQgQfE88AnsyrGMxDBN7oFyZp0gEiHXwuI45DEZr3ZoHah7cWwNOcii
   15.53 +qmgF15D6raLEabpF0nnJOQY/U5ufZsSXx/rKyaiYGYeLrjgU5XyynfajQmOVZJCz
   15.54 +ZHf7ntQYa4++fl7gLbvvdQVWscDLwrjI9dRF1x99hN0rqApRoEma1YJ55qn8WmF6
   15.55 +Auy3DyDZ5g+Bd9WfbIpqg0qJXJKyDgFsO7qp7FQ07EBOXRMRRab998kI10uO2Nzg
   15.56 +8rRkFG1K7fah5lgpGWRaxx3bPeQSkWMo/W6opTd+vxDghhhnUqVe+kTh/waDSMif
   15.57 +vzgbDsuNaUQFgEEM/4IlVpAs9eAQah7c1WmRqOzpgQA5AhH/h/qcuibmiNwYtCah
   15.58 +TvJBGFssmvv22mhdXQDpoIT3SVQPhh0IxRqfzqjUM/+t1CWUlyASd0qa+khy503C
   15.59 +d0F0aJPAfVd/r0ud7Aj+Nh/gbBBefm6xlPcdY4xMNZMs76MR+6YzJBwIoNHwkcCa
   15.60 +DjDJD+3R3XvquBp1MqhqWAhCq+wuFn9b3LkKxkBDeyRlaomRWwra0jdT12erFnzJ
   15.61 +cT8SqpSr4w11UVT0fX/bK6AoZF7IcipQJNCC7OvoxluqKc3mgvRsv2Tae4OcDq6S
   15.62 +xp1JHN07TD6x5TTQS558X1TozRqclkK8paYTVA2+U5GpoDSCMSzgRQi51f1p4xzQ
   15.63 +S0sXfBZMw4fOd+DT2zXnA/zKvCF1cwPx7GlW5BQ0jzu7Vvu2dhIThBOHwRDjXibw
   15.64 +zqnjWokHx2J+KfyELXuxHfftjphScwg04PaiHMH794EDaEGPde1Om9QMl4/tGrbS
   15.65 +VjM24m6ExO4UN4LT5mYXXHtvQdtInjPMuUg1gBSUGX/LIXe3YZ3VYepZKXpPOlO1
   15.66 +/mpUz9CncYPmI0Te7PhwLW6pmd0pq25jEtbDhHowrkYUekEXQ4/wpkyFzpw+kKPr
   15.67 +oGxZ5KauylVLqfUfzWEGlDpT0NBrMk1f3tgl9UuoiuwUfWMjOg6AGK2G5GkJzKA+
   15.68 +GXCpTlA66ZGp4FQ3tHEkgnn3ShJtDG+9fylmqjJWEhywoDeyIWTTJD+oWKSkrDRo
   15.69 +BQ+CVVbW+e78PzQwoxWYRzHGIDan9QVuXrY4geIuNw+j/p4RhzkzPXGVbfbMA/7p
   15.70 +U6q5euKJ7Tn/iOzmYEDpDiRU5OMiu5Px5Xi41aWdYvQOCBGrV8ewYjKLrVfWZWFN
   15.71 ++hw3udEadQ2lUlBgZaVi2gSnvB5lTaejZQ18+0PKvClyxUh0rgRKS2c8K9FubH9e
   15.72 +UfKjbIW5YUoGZhhvfkW44hfDf6wMk/iRaOOtSVQN668mcZ/iyVhJm25XxhrsEvbj
   15.73 +wyVSADbv4yupJecJInFG2BA47QkD7tgUn14sS3RaFVBnyvcaMz8jmtiohJfNebSN
   15.74 +FsMm2paD97CueObw0sNbUPh0bCHtjGfJe7ryEUicWZmIEHL0V7M2KbeuH871Lp88
   15.75 +WyPLI6rfNXXtcDBVOfmaRjm2MWT4rG5ey9WWIY2W2gg/VQgeFymy5mpCDyS7hn5N
   15.76 +fLfz6eEgPGN1v0d1rO3Atk2n+oMO2RCrAM0RLq6u0HLk3OK1pb/rR+xuqWYs5ZRU
   15.77 +hWurhjRAVf9wxwu0qUq642+R5XD69NS36IJ/avDjwQGO03cg9Cv/XMs/PlRTjRdc
   15.78 +vJ1MSVFN1MJLFsYB4Pkbz0/JEN04sk4gfAbYJyKom9ADkx/ShGy1BZdx6zbGc1d5
   15.79 +1JIHUkNAdBwnEmjbEqLDuPlzVfeb9hE0vRjiJISLt5hBAF4G7cygM1CZ9BTm7s7T
   15.80 +OseaApHt850SCPMPb+4+FJL8f4HRAXNbZFoHB1oQy6VG91g5s7LyZQfG0GOOL1vN
   15.81 +HeTnUBTilf5P41a4Bap7XGPFlhRMQ2tWdTSd7qTLWpL8n4aBqscXPuz51VS4Z1BJ
   15.82 +P1w12q+l2fIrXR1ubMih3LUiblqf2tqQN3s8Q54CpU0BeXY+cNCw3y6IpYGbewWl
   15.83 +oNxZctibuvh/clsjhZzTt6mW2tLfDB05xxv99N3Rsikol6bmJlkVhW/RWuzlghH/
   15.84 +g8wFvYYz8fz+AQjqbyQrE1kwnWWu/n2iXkyE/8RkLCaBsTNtmHLjbT9eOaXQFuR+
   15.85 +kazf58e00TpkXHLBLlTbxTg3McQcM8sPLHil7eD17labnpU9YDiGC9uKnogZTEJR
   15.86 +1582qkOBM+d8RTGaVXeMeXms/eA9CvLkGVW78CD+INSh8gmqEySUe00ww6cVpBnH
   15.87 +MzLz1bh2Dt8AsOFnjKbMKQWhpRz+4RUHjIdv9I48Olu96vCBnj/d5mJmF/6yMP8I
   15.88 +/GVF8HBu+6gOQUvMAEoHt03yioWEmLw2LD+N1KVzFqhIrr0axgKhI6+/LJIFlQgN
   15.89 +gjWGcztz/ZGHkL+c4lkH+0i/rdyU97OaIbEfIcn1VEOSPNNxUkzW8skad/4VOFCf
   15.90 +COUduUeDvGkmKkzOwNg3VIL0QV3q2reQmlJgL76AjfYnzhOfoBuaRMiGDi+gRdZ/
   15.91 +I/A135JHIgDO3e46/HcclzPSTxQqwT65jdG81Ogr9QzMt/MsqFKapzH94lbj5FOs
   15.92 +zGPgLNC783zVV7eeOWheqF90bplBEonuhG/jkgQ9p8k1EwvN5l1x59/ilTP6sVML
   15.93 +D2qWFeJvldlFmx0eeQNhp/qmSseIjkrVLVEo0xMQXbeCPmeaG3+/4DsdcbzBFqG7
   15.94 +5B+eY5Ru1YdYfzlrT2BhpbLFKh8MVMZtul3xL9vCA4OQFc8JFsJ0st8lwIzVSPrp
   15.95 +VbBpv8a+2J4NtQhfYxt+XZIyIFCcJZLC7jIDr/gR4DwomrdvNHfFKiD8Cq99Oh64
   15.96 +3FHTwhsUQ8RLQqFs2aEyLIXnyqb6CnOV0jSPMz52PSq0GG7xwcjCUfmlNj3hE3rK
   15.97 +hUPr32AG4qolRuifHP1U2ZVE2OivNdFH69yz56cNfCmMbgM8hrItYA3MehwZkALv
   15.98 +L02zwYoh46yXccRJ3c9Kj9rHp/KC7KZPLO0gOPwCcXETD6tJ0lHyXNWwnO0TysKq
   15.99 +AOusKrbhz6H14Uja8UXnuJ9W4W4Zw+6bHHh79vKQ9GKjzHagirD9w1/r1ItYrByb
  15.100 +AhU8ARKyyRr4DyYK7F94oBVYTK/pmgjYSEgVUeUN0xnkf2f+ZSSztFN+p99OgcUM
  15.101 +mqF2LBAm0FLJdA3JKPGLe+2lXgJDwYlJ6npIhHM8QoTsoidKHleLVQJi1Lpbr7wq
  15.102 +79BBjBRbBJvmpDRD/NTkV8FAx4QlpZReakg7tUpnam+iQdhyU0x4hGUix4463M0k
  15.103 +phbSpQELdGkOcrnUcxrMKvGN1OiWjj/7xTvYckXEH9h5HuH1uAU7mJr3vdZeol0o
  15.104 +lX3+Riy5lAPGMgOhk4MGRim3Y24ZoCkhMk2BjPFrVCHZF7oRH79ScKc0H7qXbrrV
  15.105 +M9sbcN+7MyraTKRLAdDOXXOMZSfOodZ5k3LfR+4J26QU4wCKcWVRJWvX3hZkOw7H
  15.106 +rFRPlSwLSIgbS2tq1RctT/GQC3jnzXE7bfqHDrjvCx+ez7KVRBlH8ZGj8FlIR0I6
  15.107 +gp3VzYP84kRKBW+T7f0d0zx7QLOqOmyYPUUl1/JScZzB65bVXDxI84rtHHLYaiNC
  15.108 +yBpj8zvxc3utAfmtr0VkvvA9+EmQjxlcbD+hNFIu9+//MId/4kERa0CcuFUxsl+s
  15.109 +vS/TMuB14C9UzDZk8TzM8tdfadZ7VgX6KE0dfIInZIqn6gRNOQ4nvbYobjh5czL2
  15.110 +gF0BslzpwFitFDWd+GbSj2TvA7gzLVdOrRuwXvJ5haHM2oyX0sUPUMt/S0Jrhpqx
  15.111 +xh2epw==
  15.112 +=RLm+
  15.113 +-----END PGP MESSAGE-----
  15.114 +
  15.115 +--3f2dba317c83e458257130a362bbd95a--
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/test_mails/encrypt_to_david.eml	Mon Jun 22 23:46:21 2020 +0200
    16.3 @@ -0,0 +1,120 @@
    16.4 +From: Alice Malice <alice_malice@darthmama.cool>
    16.5 +To: Dave Rave <dave_rave@darthmama.cool>
    16.6 +Subject: =?utf-8?Q?p=E2=89=A1p?=
    16.7 +X-pEp-Version: 2.1
    16.8 +MIME-Version: 1.0
    16.9 +Content-Type: multipart/encrypted; boundary="2443a8582d1d5ae96763845e75a2a8d4"; 
   16.10 + protocol="application/pgp-encrypted"
   16.11 +
   16.12 +--2443a8582d1d5ae96763845e75a2a8d4
   16.13 +Content-Type: application/pgp-encrypted
   16.14 +
   16.15 +Version: 1
   16.16 +--2443a8582d1d5ae96763845e75a2a8d4
   16.17 +Content-Type: application/octet-stream
   16.18 +Content-Transfer-Encoding: 7bit
   16.19 +Content-Disposition: inline; filename="msg.asc"
   16.20 +
   16.21 +-----BEGIN PGP MESSAGE-----
   16.22 +
   16.23 +wcDMA5ETfiZpd6jgAQwAhdaLCllWOb54G6DJ2lzKhgtmEb3sWvVDML/8GY88jAy3
   16.24 +ObyT101Vd7Oxq9O9OmEyixNmmvINZPhQFa8jO9kcXp1aHi1HRDXgc6YBk23wIH4v
   16.25 +YI/KNAnI7Y1DpZYdbJVGb1Bqhf8FzHCkhMD0X8UB5eZbjR+qn4QJb/djXN3BCsez
   16.26 +8rNUbMQhhdfhG6/LhMx6o0lUuW/CrqRbQvYSQ0s4hI2bod2tyMaKcEL79LL1gYJz
   16.27 +mZf5wbiTWxaA9hjHtrYmCvz+PoP2cGEk8iFAnqTKIKYUvjJ+Y8Vt+nSf+Hok6wYq
   16.28 +YJnE9mcMAMODNi07cOy8XNqyqm4qFzbfpUOq8gwV6fDTGuFzWJZlpUjW6phEEQfa
   16.29 +jOkZ47UsVTh1iTVB5QYr+dCQmjhzNcUQbE772jPEpRuDuD8VnzeZdr/H7Tnd5g0G
   16.30 +d6IbqENKfLgNIGA60JPMobinKanGAoeJtFWmu4xOFpc9m1ICkTFAXBFEPrxpEWKR
   16.31 +W96gqJOuvAQZJFB8R2LZwcDMA+56mtesqWT9AQwAp1k4OimeuUMdMwHfAL6E17f3
   16.32 +ZD71fP2frngwFMNGXmXLdBTurnoVJ5CbbXmM43SrNBCU822Uap48XGtFSbxlKfmS
   16.33 +3E7xUAk+U8tIjWbHEcqLbqdlkxxMyKmqZ7fdVg/qa70pYMLjluemCWC/9YskzYNV
   16.34 +8E3xxP4wC47a/OlRqCq8JmLS3mY//rjrST3NNHs9SpSh4Y/T5M+wa/g9rzdPy6XW
   16.35 +Jmpw7UDatZ8Otb377c9qEa8/JlO3QXZbAANibAnvQC8GR83SJo1K74sRZzXPKCWm
   16.36 +q13rot3ex6eHUqro7JJu376RDed0pF47eVHMyFbpA97wttV+f19aqSx4xpO0dKqG
   16.37 +9+pEfI1BYtu8Yz480F5i9wbyVVPXJD4WYx0wOz3bgSMFhEEHE/spzjeHNqz9VB7d
   16.38 +Dda1OLf/4QSgmhVkxAIOltbJsb3YoPsu2Rfja9Vq/qaOCc4bDIykrknjXg031lpL
   16.39 +dlsE6MC8Uec1zgV1nrJYpPHvK4QXxNjKinoeXxY1wcDMA8T7iwoG2EVRAQv+Kf7x
   16.40 +oSjqf1kh4zB4WI39mt+pLkE4xKudUvL8osf83eB3D7DfVcZdexigtSxxdqlfZ7Yy
   16.41 +5teeAC9DL6irB4hGt1Pq7kfOy5PFC5z5mnGxskE647f4N4h5Ddpj2YeIMZ8c76eD
   16.42 +j1EOsGXylzPycGg8fqYqQKQ3KbGLz7ba3ZCiLJdimQ5olELJ0lJOrHBHocT0YqdV
   16.43 +u9O8kO+RJl6YHxjsQBgoc1Q7gkAh2EoycwrCJsxfvNWxlsbviQSv7CXp3Ik5PL9t
   16.44 +60OzHGty/Gx/OerGa8/WQBZAnG467gFjNDKD2ByMveyjGlldWdnsvrsrHyMsx3gz
   16.45 +A0mTSz05+Fxiv5kv/smcicrUfpKiEymj3zunYVRhUU5jUmuDv/m16Z/LQSHxwBJj
   16.46 +9/YS20qSQz+Z+jeXuHTd4WpZny2PdScghzCVaOAQmMsgifbgM/RtXsGTTzrtCIZT
   16.47 +1o5W1a6rrAqQ7ba87knkyBtKncU7k5dXfLD3s+4/ulLULswkTSvCWT+PjKCe0syj
   16.48 +AXeMLYmfv+M4e5naEWCOtf3AdVHnaflCXUegS8CbvzzvWqd8IcD9Pf47E4xRprfj
   16.49 +It7ws1StwejVvBGrSKWYmHcGj6RNGce/8hQdJOQvqABkllK9oN4bGpVah3n0AkBo
   16.50 +aGps9l6mElNk1XibpUGpglSJEQtTejerQkvd+YoEcnc5aLHwhFy7RigGC/FfFSLg
   16.51 +7n8j/9HoOFibxOoLAmxWlFe7xAWlheBs4WYB6P4h5q0mmSpWj0nGzrEMKHa7chhc
   16.52 +ZM1ocU9tIWJ2HRbkBMpTkBWh9LDMyN4t2mwPn8ItGTCPydqXblD+VbdFXKav9OAk
   16.53 +EyOXaTgIzo5Bcmo0PKpvdoJwJOKYuR9dB5i2lyNYPWWzLlZoOBvOHtRVWdscEZE/
   16.54 +1nQ142N80eUMGIrTOcMa43cTJB29Rc+B2TRYP5udi+zuKLKMDD232nPsVUfMV6LB
   16.55 +NtLioOasYFhmty11J5UQJib5a6A5+vncbOGDRLz6pJ4GV4xiNgJhb9GM2sjt/HFl
   16.56 +cQXwbuakyDnzi04T/HbyHlkw66yLcVeYhNQKLkF8MWPIz63CJ0Goeo5cjjabC7w1
   16.57 +yPefuuIwES9XyP25/h7v5P/R//OmY67nFP5cRvbrg1/FnEIihI5TcCycJTGOoxqa
   16.58 +zMhW2LjKEG+7Jw8My7ItylN5rL5GTxmcBjzfcki87phEihNZt3+ByLgpoAg0oCGh
   16.59 +Rjef+A+qVVZBE6H/Gec6v2xli4FTJHcQVibWN0mfUppDSb3n9TkFZ8Ce4LkRd6cH
   16.60 +bzs4ZHWsoAdipF2TCA56SIBHUc/Hl2AR8JkZHPYZ+voTDJFpoZD7+8lx90zmFAvN
   16.61 +00/wP3V+nbshDKqy3pYov7XSrL4SVkZZn/76p+a3vcZls84nTNrmmc8nrKt3K5LZ
   16.62 +P/KoY0Fiz4k/oXLJsDp9vWW95dPvFI/tRfcRnxFOFbV/om4+2jxJLcorD5rB1ccN
   16.63 ++qFPSy2ISDxAcfw8wvj91YfzLnh75j9F8/cmhk4vMfAUqzA+ljkRLn+V99dLK2Q0
   16.64 +gvSWmd0mfZ/lozsgWGluY3PL0aKhT//nWqh43sciregq5GKP+JQO+oVLznamlTWe
   16.65 +Z6uB2EiG/26ZtSNIuUGnBqMSohNo6XoL/pUUW9q2rukE7WhtoYc56kxzLgtYAZX8
   16.66 +flzfC73ZCYJhb83spFYaqebaL/hzZ6fPnp2vZT0u/H2CcLXh40VyjEmqwS3jpLXz
   16.67 +uGX82xPCfO1HCa+0VN+JVrFuko9O8jzt8PckdIFZ5MXsZT3uDM4To6FV6L74hlm4
   16.68 +ObglNmivNQvFJDYn9gtNhoWGsa/ue8M3nki4RqfgelyQpgkXzx45UGL/IKMGg4W4
   16.69 +6ETvEX3vDSHM/MS6UHN8LtmsTzZiGxkQ8+X2FXzx7omNsEcH99twiaOpnnZFZ5av
   16.70 +3+OG4Vu+bmhVrvVJxYGLLACh/X14eR8s9KswQoQ25DnS87D5KBa/viIpfGMxR5dK
   16.71 +94N1HHvuLsMrEVlJ2RVgWSWJ7cGs0jrmM1WMwrNpN0aDaOBDk+vdQTxmNZFNGknA
   16.72 +bPA+HJ4FiPdpBiCSW5ML36pSBa1bueFJeVjmjMO3im4blrArZ1xHrBYntenxyGTY
   16.73 +Vhu1ooKkvLEF0W35xpiKU+efQD5Yf/nTY01NlaLKN6xh+fTTMX+OgQl9cXWk5XbN
   16.74 +BZK+xASc3O5MEcFpbZjYzWFpZlJ5RRz7eTItkAYvzkPZ4XjmO7C7cn3lYPG3vbC/
   16.75 +3gh8nDfGJs8QiQcfWYCEPBsvR/seRZQL38f+C68SR4p6DrEtm3XIDqaYiYL3dTlM
   16.76 +Rpu73M36/xvu8g91kFBh1kc/Yz8Sa+LYWtoyaGmS5j4D1jZKopRv7+qguFN07rWq
   16.77 +1pKnAEauExvH4XcTiiKzsSXiOaRPPnWWxmMFJmxBbLKTmzWDVwsmjG7ENqLHKRUD
   16.78 +peu7VOqYBRJ9FifWid1Wn7zuS23ZtHMVwHXka3q5DLb/2Nx2wu0DIUery5rUT5tC
   16.79 +jMZVgJ4kI2KeGIzu0ZSIls85UlviEPKOfC/Wya+543YilCBA6R5H6HDxf8kaYweU
   16.80 +NNXe2HWWqu5fxFhbXZf9nU5mqLcaws2F1UOia/WHFrGgQ20UsCP8vaYXeaTRSu2r
   16.81 +614H77bfHQH/rL2QjbOqUoSYsilWP5Tf07aV75VtwPxu6S/btmNHW8Ib6dj7ohbG
   16.82 +8I43qY1iLCGjgFI87rilQKmM8dLhuPRvTcjeLCnadyOylcj6+RMX20r6BXkG3MhW
   16.83 +DVd4wE0Ph3uO9JmVV4wBYG/VLUrU5vEILkfFzEywXIha3DqJTuWp2h45NykccfN0
   16.84 +q9IecUCZUKrP1eVB3gmDIAYCA8kjWMA/0mAVeTnzY7BKvekv4zbw9cmdPFgyR8TJ
   16.85 +wj62GYAS4X4UBOoP0KbhPke70lkEtssKCvHuOBYQzx80RI5dD7EYgLYnPqJRMhAu
   16.86 +uuLuc/Vq7c93itgIfv5HluuJKNd6PGIPEAfAA0gxZRrmE84fnTntf0akWafMW5Fa
   16.87 +Q/5vHRY1zwQJENW5CDs/ZT1RSJ19Ok0jOC9F6s1l3wIURb/nDgmrnn7TQ6kVMrVl
   16.88 +pimEgbDn0x1E1O4EI2xgv3aRZ5g9JCj3EJSCvjmjW2GwGw4TW+SVzsIObRpuvx9G
   16.89 +6zmDam3l2+28yvplVcD4pFwf980o8brhI9zJamdBhSMCuPJQMeYigh4gDs1WOwRy
   16.90 +SOSPOwLy0kQSpZI7+mFmUl4LSrp91EUsyzv6tJMpHO2A+nXyTFgCZxgbe97UdznL
   16.91 +WBV+XcM2MpZlmrSzTRavzBVtN16eOcdEo/vd4EqTW9zYyzUmQ5GuXN7ZqMZO4kvN
   16.92 +g+1h+75eN/kBAN/89ckKXZ9V3jka6x2UuKM/xNl2hbwi8mqqDrEos163hp3Qu7aa
   16.93 +UtOBbUbrYfnOuiV0QFHRQLYQp7/iY4rcxma0/naIQWqw10v0pGAXpFGvLRmH/NYp
   16.94 +OzkNCbqrwz7rowrYLM3s5GLQOB9Kjkn9RZg31pqW/isQ//DMbCklnYaYHKuDBj0R
   16.95 +NSQNJvzaSag/n1aVGIWn1FjuxPE6Y+7S4KYh+2RN7crTz2rRKksnyeeILZohbEwv
   16.96 +/uymdjBhSMNHygPpDyAkdVR79fJ21jq08DtqpSumoVd98uRiG+xSrnyT0beRFJZm
   16.97 +VT3pqyuPTJX5W6K0GHuBvh91opxBdbOv8asXGc1amqGVXmRgdiePy0jAKzn5Pv03
   16.98 +gu8oJVs6G4FqS37wzlHLSgeb5W8DRfoG6fk9LV6xtju0ZKkowdfQ4wHRSW9DcN69
   16.99 +VXWo46aLAAbZ1URUCBOYSmWZmCOZ2zyM/avBTgQWKoUcimXtB/cQIBJOvLuCuRZI
  16.100 +1Sc3wRYZQYAuEIZ8qAq4p0JpawxP8jSAziZeDS4JWy5b/Xw6XcMtMgRK95utMSY2
  16.101 +FnN0TtHRx8TojHBAdwNWHu8aBm/KcamCOV909YC6LNcOOWflhxM7nVudtw+kg+Ct
  16.102 +AopdqAZp2yNhwrr9DhpzalYBD3dAXclT8xbAyLbH6UCUtJoisxk4P07RT3fA/tkK
  16.103 +LCZNudw810UGx42qS6BWYYPFsn3qsBxAXVUPxfoInJHNsnnD0eianCAoBbcLw0au
  16.104 +ejvfJLVpsw/mu16XSbp8zu8+ikcJRQw2gAhQUAylNDx4p9E1yqBWZHwXV52EIgBx
  16.105 +MLeuGbMlX9SA9Bx4ntFVSL9ZwscDgqbAEx3D/ODAKA3Jo163hA5PJxsSpDVhRnJL
  16.106 +nbh2kkx9XXi4Im/ksFnZAyVBDgci4FiAT2nx7qXcPadDKkEfvYtgLV+PvwvSJVmY
  16.107 +ajAG47fXDyPjoYX7/s1WQ4DPJpH5+Qfr4k33JC58mU4GAkkkUYJXgeeNuxh3lepW
  16.108 +16jJAgZdsaqBOUH839hri6gWbtbRlzKC+PMoDOUrZ4jJ2jRWvYX1/jwcIf6l2w+2
  16.109 +wKocgZV2h72Bhek34ZcWK4erXz2CWmtOv56RTMrFHrJJyR/EuqOMkKigfah5da3B
  16.110 +av5EoxSgF8ZcEHba1eA8dZqvW5AuJf94W3HcJQy5hQm+I/vRXg6lN6nN9nnxkmLk
  16.111 +Qull802GyO0jwfKuaU+dqoMUotuInVzIWCOEbwLuDww6PB5iOyYIOiNuq54dOueI
  16.112 +CJIw/rXZ4uKDPmPhpR9tuPW+zER/1DR4JRoQ0aPe+6tltw2WIn96gIvaqMhVhPJY
  16.113 +d5EN9qD4MyG6iugdn5hXVyf+S3isjVnWQypGBdx90SkP3BAD4gq2oEU3XnEH4kR9
  16.114 +Y8ZsYQRS6qEqdG9AdYHQpXs+soHpVwTISXwCyjILf19+tkdoczvwlPo7anPIUZ9f
  16.115 +QiSSka6Z9sSruFLaP52rhm5iJoItUJbXxgNVcx6uk15cnQpettek9DWn+D7meucd
  16.116 +CQGKS+LhDCohKJc+xNTIlflR9VIBSgz9m52qq5g0BETHw3Vwae12EoibNY+I+xVK
  16.117 +Bcw+mXUXXknDpIMELWkgznPji2PYWrELBQuC0fNvhFUoCer72zy4HZ79RwrhAvCz
  16.118 +vG27xCg6VoleuKiyYLMV+FGtf+rOyzE9QNafoP0CyFb12DblPxamWQN+4m0p7yPE
  16.119 +iOtqtomx+NBIXEMk+tHHD+BtvQ==
  16.120 +=WDUy
  16.121 +-----END PGP MESSAGE-----
  16.122 +
  16.123 +--2443a8582d1d5ae96763845e75a2a8d4--
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/test_mails/encrypt_to_erwin.eml	Mon Jun 22 23:46:21 2020 +0200
    17.3 @@ -0,0 +1,111 @@
    17.4 +From: Alice Malice <alice_malice@darthmama.cool>
    17.5 +To: Irv Nerve <irv_nerve@darthmama.cool>
    17.6 +Subject: =?utf-8?Q?p=E2=89=A1p?=
    17.7 +X-pEp-Version: 2.1
    17.8 +MIME-Version: 1.0
    17.9 +Content-Type: multipart/encrypted; boundary="189a769b54e49eb471f324542ca88611"; 
   17.10 + protocol="application/pgp-encrypted"
   17.11 +
   17.12 +--189a769b54e49eb471f324542ca88611
   17.13 +Content-Type: application/pgp-encrypted
   17.14 +
   17.15 +Version: 1
   17.16 +--189a769b54e49eb471f324542ca88611
   17.17 +Content-Type: application/octet-stream
   17.18 +Content-Transfer-Encoding: 7bit
   17.19 +Content-Disposition: inline; filename="msg.asc"
   17.20 +
   17.21 +-----BEGIN PGP MESSAGE-----
   17.22 +
   17.23 +wcDMA5ETfiZpd6jgAQwA55otyj9aRwEC8fHshS7itU63XXmo19tKHXA8IvNQKBhB
   17.24 +zTQZv7VEJGXIs6y24ZJkAf1aqY6RPQj8d2NEyOPD698tv3RCTup+PADRe30uH3TS
   17.25 +xS0bssmGL1t/+ZYGJl2chnynitqruw8kF5gIfkSuqjgrRZ9Dd9EFIlcwGeoP/SgP
   17.26 +WalUGY3hUIn1c2Lws1BXbMHDypmvCC8/xB5e5kR+TpmELaGDUjQG2kWQsjRVdO4l
   17.27 +Hdx6XlUk9w/x67ODvi4x+4PMYNl2U6AIy/aL+qB7v6IQKE/Qc02BGvHiNaHzkGTQ
   17.28 +x8j9I6R859g7iSXa9i/VdKV4N6gwfFoCw6k9yUvMBx4a+P4tvjkRkLUBFZEF9iMk
   17.29 +TCvC1e0hbxMJBrUIwLfq3120a3me6erW18IhAibzSmotXflcPf6gcj18rC2ldZGK
   17.30 +LY6bYnNUoNyziJcHCeNbhDdFU89zUN8IlkrQiYxv8fn6/BvXAbXQvu2cAMGmTwKw
   17.31 +JKlkdSxsFPoV+E4HtLm/wcDMAxHxr0084VOwAQv/ZMVfgfSR1j/7iIaTiic8OIcc
   17.32 +vGBXjgjVjx1cw9vXZWrp5P2iRHjtQBvnhC58znWQEmTWeEnbzdh14fyoKw3GtavZ
   17.33 +ek3QNRHB+pGxgkn2NgiyEKUgcXnjNLSxfXoeM7qyJGRW4IQoPVBylAMxPCrFSoSx
   17.34 +qrccUoImNtarcbIjSyBN0BXb1mAGP5nhLOce9Wb38+5Ls3SH71HFHTPpODfo2VDi
   17.35 +Il8HsqtEPO8hMn1p7S4W2uWoZcWT/5vHlKhOtKFXbcdrqOYhPpjDdh5e4U4ufe/n
   17.36 +rpx4YlxNkwqyQ5i0OjLHqMaQrJZi+vubzhwOXEivgR08uHJSiBqUtykQ3W0psv5h
   17.37 +SbE1kUqc6Sfg61h3qSAtKS8rypPvvPfe/dTt/I6J8I7fxCjrqAJwoGse1GTFb9yS
   17.38 +UQiP6FMmmuopueh4mVBdhdO/hsN4kY4QBbrtqqOAKUGOV9aV0drkUFhCjzrj9gpu
   17.39 +hEsqGZ/51Uo68vM0W4GFCRfer5AvEdIP+AljFq4B0sybAccyWA2X2zEOeCU8CWy1
   17.40 +yVfllSw0lYdNajjNp31sPjlGeZiE4Zpxd0k/g4lQ1GD54DHxb+aSGwS4EvaQgbEI
   17.41 +d8Xbt+6hEbc9+S6ND69NnA+oNeRz3sAAGUOfcYR1ZxNk8jzDNApM3eANxWm5VpT+
   17.42 +sE87vF0oOiD4yaHSGvOmUgIy+cPJCQWIgKdUYlGnpg4EHtZc3WC3K7M5969Jrg6k
   17.43 +E5Y++q/C+q/Fg5U7UpexrXp9PS5pvXX/1VPbBAWhgIvDbHgGHa1Rbvy0ltv4aC3i
   17.44 +cEUDICaZx3mhEbbm9YIVyFfukVVDSIisz0Km1/+CskTfjE/ZabNORxZi1QvCEmrY
   17.45 +nZ5U975pds69120YB7ivtsZE1wKMx3SD54puUtR+jmFjkNHKiY4YR6Y8P+/ovsif
   17.46 +NBek8nkJqNwUkUH+Ipgeq1grw/9U+Z5WBU4CoqiKptGevDVG6GiR0X4WkejLiRDq
   17.47 +fqXX191WnQdwFtMEeSYdDkBs4sJS7txTxHjYRncmAnsDbQ3kjsk1zCnZnO5Tn4oM
   17.48 +h0TP+lvBmEIzk5TkEJCVvySJAt3/WWFpeHHeliHxmMa19AtH2YWpjPniGJ40qH+9
   17.49 +8Se/shnxKy3hh72GWs/C967eW2K83/gBoF2pJ/mbR6MJjZW51bRbyuKEFxZqd0k1
   17.50 +BMOvbxYXq1rMPWRVBhC6BegrisXbQkQk5JhI66rmQfRMjDA7eaJojCVP82FMCo39
   17.51 +sjNYOcClyD8dpAZn+KHVriP0jaEq7XH5JN1w5CnoB7TIYUeZPHSKZHoFq+6r/D+P
   17.52 +0arLFp4/JlkATY8S9v5MkAqplzCIVHRH/C9RoTDSQWnsCPGF3MYp5rrHbpHQls+X
   17.53 +9a9FpXJiUWoJb0WiIW2WYMQ5gRhmqrQkLkgPCj3P9/PgOiqlQSViSd9jgxPM7wGk
   17.54 +ngH3m8k0NSsNueiTeKNz/67duosnfJm5zTlSax046yGuu4psTVZHip9nquDyT/yC
   17.55 +rEfxjV8GTFBqPE4i9YMqML6NhFQR1SfeNfEOQtglgzp/hYPeDR15+vbVmoTm1JSf
   17.56 +RosGD5aBt+6dQGzNjS6QvozhDsAmKtcYH0T3FGm1pP8Pu1dqvc/XGUlB22oZu8SI
   17.57 +hYj2GUanXHo4mIl3MicMEzXIK9LBr1DH/2CkZAUkrVQw/YF17qgXhG9BdXfXqvYi
   17.58 +WB+yUAcgDXc8fUHh2eEKfR78VU+5wl4WsE0Wi361mEpIV33m39+nlzSPE3Cp+R7q
   17.59 +bpyNwEhG0FQ7zEC2vQ14jeEVTL7SDC8EGbcO5sdE2rwEkeh/lk6CFrJdVvOQ794V
   17.60 +imhVDFe/dXCrOa93nFi8nYjmdJtJWJWcg//AmrNxmIFGeVhWmfAjB9v5Iu3wdv1P
   17.61 +1FQ1jTq+Ogxq1tEkc5S8X84QnpYV2WLBEGWthBL4BD4+SSHxoD0qPqlpYrS95e66
   17.62 +6cx8vtm0SyrUh+TKhDTxFhfA9I9GH0YzHeT4qkPhJY0hRMkhpprxHud92PXIyteK
   17.63 +YrKH+SNAat+dPFcfQ1ZglCvepuCK2W+S+WOhreKyizeGWN1V+FLYxl2pmlOMSmty
   17.64 +uDUGFmCxrWVj5AIst0GgkcyCo3Fp2Jr1XgoBLgJEWFDwTfuoAuETzMKR8RC5jz3e
   17.65 +PvcajCfNsWPm4tXJmfat3pG64j+dK278qdcES2stRcK0Lpkwp7+l0G3tUh2CnoKC
   17.66 +RdAHIjNA5jlagR1Lx9OEQxxOuMNx0mIuArPZAYroNleFpq4j8hftX3ZHYgFixanx
   17.67 +bObDmrzkD1JB50WMuOyGOkQk3UcvFForkRGNP32tAMAQIMTDjg7dZaJY0Fxg/TUx
   17.68 +TVmT9xh0ky+wOLswrYzmPlokkfohFRWPAlD7Lg7IrXc5Pjstjp2pFwb+TUiki7Xn
   17.69 +o+wKMV7F02uexSMhAoe7ierU+68IglxduBZtS15Pnt0CRwQ990owornaRymsD4uv
   17.70 +4OmtlrhAKgpOMfWpBnDotvKrX0tGgzLswgA6pxtR8NNKvFtHlG70RKpxRaXxbwRB
   17.71 +NOwqQVe/JMuF+Evge1W++oq4Ec9kulYO0YuvZw0LSE6BBBB5CRQQvafRPHP0VCTS
   17.72 +NnWt0nB2d6J0YJplEqQR0M7gG24lIJinoBnYxg3F95EHfGZBujtDlkLX3bwusFHV
   17.73 +LtOrw7HcvlXX9iihddcWC5TxHsLjkbeJ+8bn0sXEbn12GyZcT9JPZKRuAMHAEpXu
   17.74 +sH04/aXiAlsIpIqX0Uis6YhVU8IJUY4NWR7tVI2XA7TDOBSZPJ4kAB8bZ99qU2NS
   17.75 +Lc+/YQhsfZpqJYebRp3H8bybCwWZLtu194XO+TA3OAq1SVjPQunscMMw76w8vWiM
   17.76 +rO3F+CcSNH9LGq99eSWjxFZk44FF3wwFMEYbFNG4AtN//MSaAPfjmXaoWETJareB
   17.77 +Eq09/urzFNTY/MaFjxDlkbmWC70G0Jvh2aT/m6NFaaFxxtxsKNp/AfTOOQ99oO70
   17.78 +8Z9DlJ+z+zdHZDWVHux0yU1GxngITX/EEH0UsNtVvPF1/pZGLkUpp3DP9ptDaAVC
   17.79 +yhhr/AgNhdGDoQjepzAlGmKVlhNnKQHU6fUaW7qcnznB3+wIfH3q9D8qDZ1d4WAS
   17.80 +rMXZ5gxropOsnTE2/yo/eQ4Ed2l/D/mm8T8DJO9WFf/DfBLzUCGvhzH/D3FGpm8o
   17.81 +PttNmFPFfj40ddTVcqZoNiBcp8ATSF+5/S7lEow3vZoxQejSHQatEcxnzYJZzCzB
   17.82 +W+YRt+eWjTkEpzMTNtemnzHX1RY7QB7beqJpiCnGo2d3HtWZMS6ruXTQ7OXD1K5x
   17.83 +8rUj72FQ1seenUbiOAShKN0tnj1KHm2tVs/+X+WuIpAbR+pSHzLo9lMNrdB4bCiM
   17.84 +bR7DFlC2x0ZaCWMiByjNfCVIOFuGfqjVgS2CLzYYj+EFRrell5Tlg8DMGWvuxobv
   17.85 +WfxIJThAnZAaOyQjObVtPaHHMc7v50+AT2DyreGMqkQQ7MX6IEIYx+g40sBxmfJt
   17.86 +YRIKcdgPvga7rON7vL415bBJYU86BHa8RAwAPRbSIQdhXTKRxmuugFkV6rdsXqbE
   17.87 +FZHXXkkAX0kG5m8P6K8kmyer5SjLRuz3GlaMFrW17Bh4K3T7f8KmDItj0nThsvP9
   17.88 +9DgYLco1fiEPPD+RdKEEl3NJAMuld+NoUGozyaongrdj6+6SInSmWST2el6QYjTs
   17.89 +6h4r5v0x9pHYdDG2QDjo3NXYP6WAbOjDtMdgK/c+RJdVmHAsSh8slEfnu9BfiirA
   17.90 +/cvIwxpKnhBEDg5QDaQIbF1nvZOPLQnVtqYWeTlIHek3dtFLSAwAiHHpPVI0WoSI
   17.91 +42PUK8EWsW4THviqMBi+LHLGd3jG+6TGO/1eFApKFPhoUVanTODunjHqOyaaoPtC
   17.92 +cuebcm5XTEEtqmnFeQGE7BOeZZnlc0sDjcEhmWAjZfxWTyHBhXNK38VL6zv9++gG
   17.93 +mFVHjv7J/JsAElDmL2ki2zdohEP1o5P89GZtWt7TwPxreHspPFWbmCayzgTIQE5H
   17.94 +trnU9flI0I4Az2r4T9TRxw0irexBGL75V19G4qUat4I/atymP+LKpInLEZnR85lN
   17.95 +MAXzRI2IikW39Wk5iGiih2mKHAp7ZkN7l1DAnnpD36pt1+0BHRAvFlodZ1E7E0q9
   17.96 +v7LyxH9lRohTbzJyQT4LjUADw+PK9tcgYFyUa7c2g1xVNdYvNvKrcYV71aaCvbKJ
   17.97 +1bMgZvK1lSziN40nh+rjqPbyCWqw7BBj9OlKki/1E1aj7WiOFIi99exNSlVG6OyD
   17.98 +PaOfEnmpqEvKjCk251wt6PcgthFccJYgal0TKi4cs4WCxSzuhdlsDBouZmjNjDUT
   17.99 +uNiKsHg+ze7LQSEOEa0Cv1QaxYe1x7vZCdCpaeLYlw00BwNsUPW2pM3IOim/7r81
  17.100 +gFV42oFywUoMuBhW3hwaWjXH6a/PhzRk+QJa62G744J7YvYS2qFIaPesfu+SKufs
  17.101 +fP7T0j4njTqE0DaVy5xh6g05hb+vgrlaH3viRRljQWCzkg6UXrciaWaLgVIrt3oE
  17.102 +C/dCKj5ldQmwqX0NKe8F9zZEYLG9t3v7YamdaLWQzIA2UYDNbIEvj77M7DJDIKQp
  17.103 +Rn1kEVnViLPeaRjX6AEk3Id8RElYwMZO5ueU9yy/iX5gpyhSJOA2xWySTGqeL2Ge
  17.104 +xLrSGkyXDenjV+KmeNTLse6upi0fUxduVVPt6/9d4TcyWEi2zPp6moc+yV3dI2la
  17.105 +fkXiuMN9ht9OVhPpQMcsN9ZSbvddeVI4nkIzVmB0BVlWKuH4WzVfnFohJRHLldmk
  17.106 +tfbkJDf7eRaPvn0WM93/t6bWjimsssKEh/Jr3TO+PvcHHyr0fg1tPKGkReLhfTmF
  17.107 +e5vA4fTJ0pl3yHvpELgqKHyf7eCTLvjTtxEF5evpyBj1/kH5wPvHGW9D/1+H4T6q
  17.108 +mTIX3FkV2qk4X+J73nyPILCIH7wejhMfnH14K2e+jO5gRlkO0TyctlW87dt+drHF
  17.109 +Zspv0fTV7d76GTbYF6wovvBNil2h5Z7ESGVOjteS8kp3JRGwXGvQQ1mshbG2+ESa
  17.110 +BNG+CBPjhy2eVd2qgplCF5nDSfCbBYr4N6dwrfnmzHEBW1Qb4DrucDAF95o=
  17.111 +=IYZu
  17.112 +-----END PGP MESSAGE-----
  17.113 +
  17.114 +--189a769b54e49eb471f324542ca88611--