ENGINE-448: made key removal much less aggressive. NetPGP will still be a problem, but versions built against gpg will now only remove actual keys ENGINE-448
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Tue, 29 Jan 2019 19:19:30 +0100
branchENGINE-448
changeset 32546e7f6bc9460a
parent 3246 ec48ea509c8d
child 3255 7bc1a49f6c74
ENGINE-448: made key removal much less aggressive. NetPGP will still be a problem, but versions built against gpg will now only remove actual keys
src/message_api.c
src/message_api.h
src/pEpEngine.h
src/pgp_gpg.c
src/pgp_netpgp.c
test/src/engine_tests/BCCTests.cc
test/src/engine_tests/CaseAndDotAddressTests.cc
test/src/engine_tests/DecorateTests.cc
test/src/engine_tests/DecryptAttachPrivateKeyTrustedTests.cc
test/src/engine_tests/DecryptAttachPrivateKeyUntrustedTests.cc
test/src/engine_tests/EncryptAttachPrivateKeyTests.cc
test/src/engine_tests/EncryptForIdentityTests.cc
test/src/engine_tests/EncryptMissingPrivateKeyTests.cc
test/src/engine_tests/Engine463Tests.cc
test/src/engine_tests/ExternalRevokeTests.cc
test/src/engine_tests/LeastColorGroupTests.cc
test/src/engine_tests/MessageApiTests.cc
test/src/engine_tests/MessageNullFromTests.cc
test/src/engine_tests/MessageTwoPointOhTests.cc
test/src/engine_tests/MistrustUndoTests.cc
test/src/engine_tests/NewUpdateIdAndMyselfTests.cc
test/src/engine_tests/ReencryptPlusExtraKeysTests.cc
test/src/engine_tests/RevokeRegenAttachTests.cc
test/src/engine_tests/UserIDAliasTests.cc
test/src/util/test_util.cc
     1.1 --- a/src/message_api.c	Mon Jan 28 14:04:12 2019 +0100
     1.2 +++ b/src/message_api.c	Tue Jan 29 19:19:30 2019 +0100
     1.3 @@ -1092,6 +1092,19 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +static bool _has_PGP_MIME_format(message* msg) {
     1.8 +    if (!msg || !msg->attachments || !msg->attachments->next)
     1.9 +        return false;
    1.10 +    if (msg->attachments->next->next)
    1.11 +        return false;
    1.12 +    if (!msg->attachments->mime_type ||
    1.13 +        strcmp(msg->attachments->mime_type, "application/pgp-encrypted") != 0)    
    1.14 +        return false;
    1.15 +    if (!msg->attachments->next->mime_type || 
    1.16 +        strcmp(msg->attachments->next->mime_type, "application/octet-stream") != 0)        
    1.17 +        return false;
    1.18 +    return true;    
    1.19 +}
    1.20  
    1.21  static PEP_rating _rating(PEP_comm_type ct, PEP_rating rating)
    1.22  {
    1.23 @@ -1423,9 +1436,28 @@
    1.24      }
    1.25  }
    1.26  
    1.27 +static bool compare_first_n_bytes(const char* first, const char* second, size_t n) {
    1.28 +    int i;
    1.29 +    for (i = 0; i < n; i++) {
    1.30 +        char num1 = *first;
    1.31 +        char num2 = *second;
    1.32 +
    1.33 +        if (num1 != num2)
    1.34 +            return false;
    1.35 +                    
    1.36 +        if (num1 == '\0') {
    1.37 +            if (num2 == '\0')
    1.38 +                return true;
    1.39 +        }   
    1.40 +        first++;
    1.41 +        second++;                     
    1.42 +    }
    1.43 +    return true;
    1.44 +}
    1.45 +
    1.46  bool import_attached_keys(
    1.47          PEP_SESSION session,
    1.48 -        const message *msg,
    1.49 +        message *msg,
    1.50          identity_list **private_idents
    1.51      )
    1.52  {
    1.53 @@ -1438,8 +1470,18 @@
    1.54      bool remove = false;
    1.55  
    1.56      int i = 0;
    1.57 +    
    1.58 +    bloblist_t* prev = NULL;
    1.59 +    
    1.60 +    bool do_not_advance = false;
    1.61 +    const char* pubkey_header = "-----BEGIN PGP PUBLIC KEY BLOCK-----";
    1.62 +    const char* privkey_header = "-----BEGIN PGP PRIVATE KEY BLOCK-----";
    1.63 +    // Hate my magic numbers at your peril, but I don't want a strlen each time
    1.64 +    const size_t PUBKEY_HSIZE = 36;
    1.65 +    const size_t PRIVKEY_HSIZE = 37;
    1.66 +
    1.67      for (bloblist_t *bl = msg->attachments; i < MAX_KEYS_TO_IMPORT && bl && bl->value;
    1.68 -            bl = bl->next, i++)
    1.69 +         i++)
    1.70      {
    1.71          if (bl && bl->value && bl->size && bl->size < MAX_KEY_SIZE
    1.72                  && is_key(bl))
    1.73 @@ -1470,12 +1512,40 @@
    1.74                      // We shouldn't delete it or import it, because we can't
    1.75                      // do the latter.
    1.76                      free(bl_ptext);
    1.77 +                    prev = bl;
    1.78                      continue;
    1.79                  }
    1.80              }
    1.81              identity_list *local_private_idents = NULL;
    1.82 -            import_key(session, blob_value, blob_size, &local_private_idents);
    1.83 -            remove = true;
    1.84 +            PEP_STATUS import_status = import_key(session, blob_value, blob_size, &local_private_idents);
    1.85 +            bloblist_t* to_delete = NULL;
    1.86 +            switch (import_status) {
    1.87 +                case PEP_NO_KEY_IMPORTED:
    1.88 +                    break;
    1.89 +                case PEP_KEY_IMPORT_STATUS_UNKNOWN:
    1.90 +                    // We'll delete armoured stuff, at least
    1.91 +                    if (blob_size <= PUBKEY_HSIZE)
    1.92 +                        break;
    1.93 +                    if ((!compare_first_n_bytes(pubkey_header, (const char*)blob_value, PUBKEY_HSIZE)) &&
    1.94 +                       (!compare_first_n_bytes(privkey_header, (const char*)blob_value, PRIVKEY_HSIZE)))
    1.95 +                        break;
    1.96 +                    // else fall through and delete    
    1.97 +                case PEP_KEY_IMPORTED:
    1.98 +                    to_delete = bl;
    1.99 +                    if (prev)
   1.100 +                        prev->next = bl->next;
   1.101 +                    else
   1.102 +                        msg->attachments = bl->next;
   1.103 +                    bl = bl->next;
   1.104 +                    to_delete->next = NULL;
   1.105 +                    free_bloblist(to_delete);
   1.106 +                    do_not_advance = true;
   1.107 +                    remove = true;
   1.108 +                    break;
   1.109 +                default:  
   1.110 +                    // bad stuff, but ok.
   1.111 +                    break;
   1.112 +            }
   1.113              if (private_idents && *private_idents == NULL && local_private_idents != NULL)
   1.114                  *private_idents = local_private_idents;
   1.115              else
   1.116 @@ -1483,6 +1553,10 @@
   1.117              if (free_blobval)
   1.118                  free(blob_value);
   1.119          }
   1.120 +        if (!do_not_advance) {
   1.121 +            prev = bl;
   1.122 +            bl = bl->next;
   1.123 +        }
   1.124      }
   1.125      return remove;
   1.126  }
   1.127 @@ -3095,11 +3169,16 @@
   1.128          return false;
   1.129      PEP_STATUS status = import_key(session, the_key->value, the_key->size, NULL);
   1.130      free_bloblist(the_key);
   1.131 -    if (status == PEP_STATUS_OK)
   1.132 +    if (status == PEP_KEY_IMPORTED)
   1.133          return true;
   1.134      return false;
   1.135  }
   1.136  
   1.137 +typedef struct _pEp_attach_ref {
   1.138 +    bloblist_t* ref;
   1.139 +    struct _pep_attach_ref* next;
   1.140 +} pEp_attach_ref;
   1.141 +
   1.142  DYNAMIC_API PEP_STATUS _decrypt_message(
   1.143          PEP_SESSION session,
   1.144          message *src,
   1.145 @@ -3184,7 +3263,13 @@
   1.146  
   1.147      /*** Begin Import any attached public keys and update identities accordingly ***/
   1.148      // Private key in unencrypted mail are ignored -> NULL
   1.149 -    bool imported_keys = import_attached_keys(session, src, NULL);
   1.150 +    //
   1.151 +    // This import is from the outermost message.
   1.152 +    // We don't do this for PGP_mime.
   1.153 +    bool imported_keys = false;
   1.154 +    if (!_has_PGP_MIME_format(src))
   1.155 +        imported_keys = import_attached_keys(session, src, NULL);
   1.156 +            
   1.157      import_header_keys(session, src);
   1.158      
   1.159      // FIXME: is this really necessary here?
   1.160 @@ -3221,6 +3306,7 @@
   1.161  
   1.162          *rating = PEP_rating_unencrypted;
   1.163  
   1.164 +        // We remove these from the outermost source message
   1.165          if (imported_keys)
   1.166              remove_attached_keys(src);
   1.167                                      
   1.168 @@ -3272,6 +3358,9 @@
   1.169                  // N.B. Apparently, we always import private keys into the keyring; however,
   1.170                  // we do NOT always allow those to be used for encryption. THAT is controlled
   1.171                  // by setting it as an own identity associated with the key in the DB.
   1.172 +                //
   1.173 +                // We are importing from the decrypted outermost message now.
   1.174 +                //
   1.175                  status = import_priv_keys_from_decrypted_msg(session, src, msg,
   1.176                                                               &imported_keys,
   1.177                                                               &imported_private_key_address,
   1.178 @@ -3379,8 +3468,10 @@
   1.179                                              // If we have a message 2.0 message, we are ONLY going to be ok with keys
   1.180                                              // we imported from THIS part of the message.
   1.181                                              imported_private_key_address = false;
   1.182 -                                            free(private_il);
   1.183 +                                            free(private_il); 
   1.184                                              private_il = NULL;
   1.185 +                                            
   1.186 +                                            // import keys from decrypted INNER source
   1.187                                              status = import_priv_keys_from_decrypted_msg(session, src, inner_message,
   1.188                                                                                           &imported_keys,
   1.189                                                                                           &imported_private_key_address,
   1.190 @@ -3484,7 +3575,8 @@
   1.191          
   1.192          /* add pEp-related status flags to header */
   1.193          decorate_message(msg, *rating, _keylist, false, false);
   1.194 -        
   1.195 +
   1.196 +        // Maybe unnecessary
   1.197          if (imported_keys)
   1.198              remove_attached_keys(msg);
   1.199                      
     2.1 --- a/src/message_api.h	Mon Jan 28 14:04:12 2019 +0100
     2.2 +++ b/src/message_api.h	Tue Jan 29 19:19:30 2019 +0100
     2.3 @@ -15,7 +15,7 @@
     2.4  bool import_attached_keys(
     2.5      
     2.6          PEP_SESSION session, 
     2.7 -        const message *msg,
     2.8 +        message *msg,
     2.9          identity_list **private_idents
    2.10      );
    2.11  
     3.1 --- a/src/pEpEngine.h	Mon Jan 28 14:04:12 2019 +0100
     3.2 +++ b/src/pEpEngine.h	Tue Jan 29 19:19:30 2019 +0100
     3.3 @@ -52,6 +52,10 @@
     3.4      PEP_CANNOT_EXPORT_KEY                           = 0x0204,
     3.5      PEP_CANNOT_EDIT_KEY                             = 0x0205,
     3.6      PEP_KEY_UNSUITABLE                              = 0x0206,
     3.7 +
     3.8 +    PEP_KEY_IMPORTED                                = 0x0210,
     3.9 +    PEP_NO_KEY_IMPORTED                             = 0x0211,
    3.10 +    PEP_KEY_IMPORT_STATUS_UNKNOWN                   = 0x0212,
    3.11      
    3.12      PEP_CANNOT_FIND_IDENTITY                        = 0x0301,
    3.13      PEP_CANNOT_SET_PERSON                           = 0x0381,
     4.1 --- a/src/pgp_gpg.c	Mon Jan 28 14:04:12 2019 +0100
     4.2 +++ b/src/pgp_gpg.c	Tue Jan 29 19:19:30 2019 +0100
     4.3 @@ -1372,20 +1372,31 @@
     4.4  
     4.5      gpgme_import_result_t gpgme_import_result;
     4.6  
     4.7 +    bool key_imported = false;
     4.8 +    
     4.9      gpgme_error = gpg.gpgme_op_import(session->ctx, dh);
    4.10      gpgme_error = _GPGERR(gpgme_error);
    4.11      switch (gpgme_error) {
    4.12      case GPG_ERR_NO_ERROR:
    4.13 +    
    4.14 +        gpgme_import_result =
    4.15 +            gpg.gpgme_op_import_result(session->ctx);
    4.16 +        assert(gpgme_import_result);
    4.17 +        if (!gpgme_import_result) {
    4.18 +            gpg.gpgme_data_release(dh);
    4.19 +            return PEP_UNKNOWN_ERROR;
    4.20 +        }
    4.21 +        // considered seems to only be true if it was 
    4.22 +        // actually a key
    4.23 +        if (gpgme_import_result->considered > 0)
    4.24 +            // gpgme_import_result->imported > 0 ||
    4.25 +            // gpgme_import_result->secret_imported > 0 ||
    4.26 +            // gpgme_import_result->unchanged > 0 ||
    4.27 +            // gpgme_import_result->secret_unchanged > 0)
    4.28 +            key_imported = true;
    4.29 +            
    4.30          if(private_idents)
    4.31          {
    4.32 -            gpgme_import_result =
    4.33 -                gpg.gpgme_op_import_result(session->ctx);
    4.34 -            assert(gpgme_import_result);
    4.35 -            if (!gpgme_import_result) {
    4.36 -                gpg.gpgme_data_release(dh);
    4.37 -                return PEP_UNKNOWN_ERROR;
    4.38 -            }
    4.39 -
    4.40              gpgme_import_status_t import;
    4.41              for (import = gpgme_import_result->imports;
    4.42                   import;
    4.43 @@ -1451,7 +1462,11 @@
    4.44      }
    4.45  
    4.46      gpg.gpgme_data_release(dh);
    4.47 -    return PEP_STATUS_OK;
    4.48 +    
    4.49 +    if (key_imported)
    4.50 +        return PEP_KEY_IMPORTED;
    4.51 +        
    4.52 +    return PEP_NO_KEY_IMPORTED;
    4.53  }
    4.54  
    4.55  PEP_STATUS pgp_export_keydata(
     5.1 --- a/src/pgp_netpgp.c	Mon Jan 28 14:04:12 2019 +0100
     5.2 +++ b/src/pgp_netpgp.c	Tue Jan 29 19:19:30 2019 +0100
     5.3 @@ -1000,7 +1000,8 @@
     5.4      if (netpgp_save_pubring(&netpgp) &&
     5.5          netpgp_save_secring(&netpgp))
     5.6      {
     5.7 -        result = PEP_STATUS_OK;
     5.8 +        // we never really know if a key was imported. MEH.
     5.9 +        result = PEP_KEY_IMPORT_STATUS_UNKNOWN;
    5.10      }else{
    5.11          result = PEP_UNKNOWN_ERROR;
    5.12      }
     6.1 --- a/test/src/engine_tests/BCCTests.cc	Mon Jan 28 14:04:12 2019 +0100
     6.2 +++ b/test/src/engine_tests/BCCTests.cc	Tue Jan 29 19:19:30 2019 +0100
     6.3 @@ -26,18 +26,18 @@
     6.4      EngineTestIndividualSuite::setup();
     6.5      string keystr = slurp("test_keys/priv/bcc_test_dude_0-0x1CCCFC41_priv.asc");
     6.6      PEP_STATUS status = import_key(session, keystr.c_str(), keystr.size(), NULL);
     6.7 -    assert(status == PEP_STATUS_OK);    
     6.8 +    assert(status == PEP_KEY_IMPORTED);    
     6.9      pEp_identity * me = new_identity("bcc_test_dude_0@darthmama.cool", "0AE9AA3E320595CF93296BDFA155AC491CCCFC41", PEP_OWN_USERID, "BCC Test Sender");    
    6.10      status = set_own_key(session, me, "0AE9AA3E320595CF93296BDFA155AC491CCCFC41");
    6.11      keystr = slurp("test_keys/pub/bcc_test_dude_0-0x1CCCFC41_pub.asc");
    6.12      status = import_key(session, keystr.c_str(), keystr.size(), NULL);
    6.13 -    assert(status == PEP_STATUS_OK);
    6.14 +    assert(status == PEP_KEY_IMPORTED);
    6.15      keystr = slurp("test_keys/pub/bcc_test_dude_1-0xDAC746BE_pub.asc");
    6.16      status = import_key(session, keystr.c_str(), keystr.size(), NULL);
    6.17 -    assert(status == PEP_STATUS_OK);
    6.18 +    assert(status == PEP_KEY_IMPORTED);
    6.19      keystr = slurp("test_keys/pub/bcc_test_dude_2-0x53CECCF7_pub.asc");
    6.20      status = import_key(session, keystr.c_str(), keystr.size(), NULL);
    6.21 -    assert(status == PEP_STATUS_OK);    
    6.22 +    assert(status == PEP_KEY_IMPORTED);    
    6.23  }
    6.24  
    6.25  void BCCTests::check_single_BCC() {
    6.26 @@ -64,4 +64,3 @@
    6.27  
    6.28      TEST_ASSERT(status == PEP_STATUS_OK);
    6.29  }
    6.30 -
     7.1 --- a/test/src/engine_tests/CaseAndDotAddressTests.cc	Mon Jan 28 14:04:12 2019 +0100
     7.2 +++ b/test/src/engine_tests/CaseAndDotAddressTests.cc	Tue Jan 29 19:19:30 2019 +0100
     7.3 @@ -36,7 +36,7 @@
     7.4      const char* alice_email_case_and_dot = "PE.p.teS.t.ALICE@pep-project.OrG";
     7.5  
     7.6      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
     7.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
     7.8 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
     7.9  
    7.10      pEp_identity * alice_id = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id, "Alice Test");
    7.11  
     8.1 --- a/test/src/engine_tests/DecorateTests.cc	Mon Jan 28 14:04:12 2019 +0100
     8.2 +++ b/test/src/engine_tests/DecorateTests.cc	Tue Jan 29 19:19:30 2019 +0100
     8.3 @@ -35,9 +35,9 @@
     8.4      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
     8.5      PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
     8.6      PEP_STATUS statusbob = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
     8.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
     8.8 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
     8.9 -    TEST_ASSERT_MSG((statusbob == PEP_STATUS_OK), "statusbob == PEP_STATUS_OK");
    8.10 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
    8.11 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
    8.12 +    TEST_ASSERT_MSG((statusbob == PEP_KEY_IMPORTED), "statusbob == PEP_STATUS_OK");
    8.13  
    8.14      cout << "creating message…\n";
    8.15      pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", NULL, PEP_OWN_USERID, "Alice Test");
     9.1 --- a/test/src/engine_tests/DecryptAttachPrivateKeyTrustedTests.cc	Mon Jan 28 14:04:12 2019 +0100
     9.2 +++ b/test/src/engine_tests/DecryptAttachPrivateKeyTrustedTests.cc	Tue Jan 29 19:19:30 2019 +0100
     9.3 @@ -45,11 +45,11 @@
     9.4      // 13A9F97964A2B52520CAA40E51BCA783C065A213    
     9.5      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
     9.6      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
     9.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
     9.8 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
     9.9  
    9.10      input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
    9.11      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    9.12 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    9.13 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
    9.14  
    9.15      // ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
    9.16      bool has_priv = false;
    9.17 @@ -58,7 +58,7 @@
    9.18      // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
    9.19      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
    9.20      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    9.21 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    9.22 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
    9.23  
    9.24      
    9.25      cout << "Setting up own identity with default key " << fpr_main_me << endl;
    10.1 --- a/test/src/engine_tests/DecryptAttachPrivateKeyUntrustedTests.cc	Mon Jan 28 14:04:12 2019 +0100
    10.2 +++ b/test/src/engine_tests/DecryptAttachPrivateKeyUntrustedTests.cc	Tue Jan 29 19:19:30 2019 +0100
    10.3 @@ -44,11 +44,11 @@
    10.4      // 13A9F97964A2B52520CAA40E51BCA783C065A213    
    10.5      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
    10.6      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    10.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
    10.8 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), "status == PEP_STATUS_OK");
    10.9  
   10.10      input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
   10.11      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   10.12 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   10.13 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), "status == PEP_STATUS_OK");
   10.14  
   10.15      // ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
   10.16      bool has_priv = false;
   10.17 @@ -64,7 +64,7 @@
   10.18      // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
   10.19      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
   10.20      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   10.21 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), "status == PEP_STATUS_OK");
   10.22 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), "status == PEP_STATUS_OK");
   10.23  
   10.24      
   10.25      cout << "Setting up own identity with default key " << fpr_main_me << endl;
    11.1 --- a/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc	Mon Jan 28 14:04:12 2019 +0100
    11.2 +++ b/test/src/engine_tests/EncryptAttachPrivateKeyTests.cc	Tue Jan 29 19:19:30 2019 +0100
    11.3 @@ -56,35 +56,35 @@
    11.4      // 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
    11.5      input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
    11.6      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
    11.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
    11.8 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
    11.9  
   11.10      input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc");
   11.11      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   11.12 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   11.13 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
   11.14          
   11.15      // key with same address and user_id (initially untrusted, then trusted)
   11.16      // 359DD8AC87D1F5E4304D08338D7185F180C8CD87
   11.17      input_key = slurp("test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc");
   11.18      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   11.19 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   11.20 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
   11.21  
   11.22      // key with same address and to have different (non-aliased) user_id (initially untrusted, then trusted)
   11.23      // B044B83639E292283A3F6E14C2E64B520B74809C
   11.24      input_key = slurp("test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc");
   11.25      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   11.26 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   11.27 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
   11.28  
   11.29      // key with different address to have same user_id (initially untrusted, then trusted)
   11.30      // C52911EBA0D34B0F549594A15A7A363BD11252C9
   11.31      input_key = slurp("test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc");
   11.32      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   11.33 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   11.34 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
   11.35          
   11.36      // key with different address to have different user_id (initially untrusted, then trusted)
   11.37      // 567212EFB8A3A76B1D32B9565F45BEA9C785F20A
   11.38      input_key = slurp("test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc");
   11.39      status = import_key(session, input_key.c_str(), input_key.length(), NULL);
   11.40 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));
   11.41 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));
   11.42      cout << "Done!" << endl << endl;
   11.43      
   11.44      cout << "Setting up own identity with default key " << fpr_main_me << endl;
    12.1 --- a/test/src/engine_tests/EncryptForIdentityTests.cc	Mon Jan 28 14:04:12 2019 +0100
    12.2 +++ b/test/src/engine_tests/EncryptForIdentityTests.cc	Tue Jan 29 19:19:30 2019 +0100
    12.3 @@ -37,13 +37,13 @@
    12.4  
    12.5      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
    12.6      PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
    12.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    12.8 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    12.9 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   12.10 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
   12.11      
   12.12      statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL);
   12.13 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
   12.14 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   12.15      statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
   12.16 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
   12.17 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   12.18  
   12.19      const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
   12.20      const char* gabrielle_fpr = "906C9B8349954E82C5623C3C8C541BD4E203586C";
    13.1 --- a/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc	Mon Jan 28 14:04:12 2019 +0100
    13.2 +++ b/test/src/engine_tests/EncryptMissingPrivateKeyTests.cc	Tue Jan 29 19:19:30 2019 +0100
    13.3 @@ -34,7 +34,7 @@
    13.4      EngineTestSessionSuite::setup();
    13.5      string recip_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
    13.6      PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL);
    13.7 -    assert(status == PEP_STATUS_OK);
    13.8 +    assert(status == PEP_KEY_IMPORTED);
    13.9  }
   13.10  
   13.11  void EncryptMissingPrivateKeyTests::check_encrypt_missing_private_key() {
    14.1 --- a/test/src/engine_tests/Engine463Tests.cc	Mon Jan 28 14:04:12 2019 +0100
    14.2 +++ b/test/src/engine_tests/Engine463Tests.cc	Tue Jan 29 19:19:30 2019 +0100
    14.3 @@ -31,9 +31,9 @@
    14.4      const string fake_schleuder_key = slurp("test_keys/pub/fake-schleuder.asc");
    14.5      
    14.6      PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL);
    14.7 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));    
    14.8 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));    
    14.9      status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL);
   14.10 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));    
   14.11 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));    
   14.12  
   14.13      // Ok, bring in message, decrypt, and see what happens.
   14.14      const string msg = slurp("test_mails/notfound-alt.msg");
   14.15 @@ -54,9 +54,9 @@
   14.16      const string fake_schleuder_key = slurp("test_keys/pub/fake-schleuder.asc");
   14.17      
   14.18      PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL);
   14.19 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));    
   14.20 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));    
   14.21      status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL);
   14.22 -    TEST_ASSERT_MSG((status == PEP_STATUS_OK), tl_status_string(status));    
   14.23 +    TEST_ASSERT_MSG((status == PEP_KEY_IMPORTED), tl_status_string(status));    
   14.24  
   14.25      pEp_identity* own_ident = new_identity("claudio+engine-463@pep.foundation", "A039BC60E43E0DFDDC9DE8663B48C38325210C88", PEP_OWN_USERID, "Not Actually Claudio");
   14.26      status = set_own_key(session, own_ident, "A039BC60E43E0DFDDC9DE8663B48C38325210C88");
    15.1 --- a/test/src/engine_tests/ExternalRevokeTests.cc	Mon Jan 28 14:04:12 2019 +0100
    15.2 +++ b/test/src/engine_tests/ExternalRevokeTests.cc	Tue Jan 29 19:19:30 2019 +0100
    15.3 @@ -41,8 +41,8 @@
    15.4      
    15.5      PEP_STATUS statuspub = import_key(session, fenris_pub_key.c_str(), fenris_pub_key.length(), NULL);
    15.6      PEP_STATUS statuspriv = import_key(session, fenris_priv_key.c_str(), fenris_priv_key.length(), NULL);
    15.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    15.8 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    15.9 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   15.10 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
   15.11  
   15.12      // Create sender ID
   15.13      
    16.1 --- a/test/src/engine_tests/LeastColorGroupTests.cc	Mon Jan 28 14:04:12 2019 +0100
    16.2 +++ b/test/src/engine_tests/LeastColorGroupTests.cc	Tue Jan 29 19:19:30 2019 +0100
    16.3 @@ -41,7 +41,7 @@
    16.4          cout << "\t read keyfile \"" << name << "\"..." << std::endl;
    16.5          const string keytextkey = slurp(name);
    16.6          PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL);
    16.7 -        TEST_ASSERT_MSG((statuskey == PEP_STATUS_OK), "statuskey == PEP_STATUS_OK");
    16.8 +        TEST_ASSERT_MSG((statuskey == PEP_KEY_IMPORTED), "statuskey == PEP_STATUS_OK");
    16.9      }
   16.10      
   16.11      cout << "\t read keyfile mailfile \"" << mailfile << "\"..." << std::endl;
    17.1 --- a/test/src/engine_tests/MessageApiTests.cc	Mon Jan 28 14:04:12 2019 +0100
    17.2 +++ b/test/src/engine_tests/MessageApiTests.cc	Tue Jan 29 19:19:30 2019 +0100
    17.3 @@ -32,11 +32,11 @@
    17.4      const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
    17.5  
    17.6      PEP_STATUS status0 = import_key(session, alice_pub_key.c_str(), alice_pub_key.size(), NULL);
    17.7 -    TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
    17.8 +    TEST_ASSERT_MSG((status0 == PEP_KEY_IMPORTED), "status0 == PEP_STATUS_OK");
    17.9      status0 = import_key(session, alice_priv_key.c_str(), alice_priv_key.size(), NULL);
   17.10 -    TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
   17.11 +    TEST_ASSERT_MSG((status0 == PEP_KEY_IMPORTED), "status0 == PEP_STATUS_OK");
   17.12      status0 = import_key(session, bob_pub_key.c_str(), bob_pub_key.size(), NULL);
   17.13 -    TEST_ASSERT_MSG((status0 == PEP_STATUS_OK), "status0 == PEP_STATUS_OK");
   17.14 +    TEST_ASSERT_MSG((status0 == PEP_KEY_IMPORTED), "status0 == PEP_STATUS_OK");
   17.15      // message_api test code
   17.16  
   17.17      cout << "creating message…\n";
   17.18 @@ -97,7 +97,7 @@
   17.19      
   17.20      flags = 0;
   17.21      PEP_STATUS status4 = decrypt_message(session, enc_msg2, &msg4, &keylist4, &rating, &flags);
   17.22 -    TEST_ASSERT_MSG((status4 == PEP_STATUS_OK), "status4 == PEP_STATUS_OK");
   17.23 +    TEST_ASSERT_MSG((status4 == PEP_STATUS_OK), tl_status_string(status4));
   17.24      TEST_ASSERT_MSG((msg4), "msg4");
   17.25      TEST_ASSERT_MSG((keylist4), "keylist4");
   17.26      TEST_ASSERT_MSG((rating), "rating");
    18.1 --- a/test/src/engine_tests/MessageNullFromTests.cc	Mon Jan 28 14:04:12 2019 +0100
    18.2 +++ b/test/src/engine_tests/MessageNullFromTests.cc	Tue Jan 29 19:19:30 2019 +0100
    18.3 @@ -29,16 +29,16 @@
    18.4  void MessageNullFromTests::import_alice_pub() {
    18.5      const string alice_pub_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
    18.6      PEP_STATUS status = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
    18.7 -    assert(status == PEP_STATUS_OK);
    18.8 +    assert(status == PEP_KEY_IMPORTED);
    18.9  }
   18.10  
   18.11  void MessageNullFromTests::import_bob_pair_and_set_own() {
   18.12      const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
   18.13      const string bob_priv_key = slurp("test_keys/priv/pep-test-bob-0xC9C2EE39_priv.asc");
   18.14      PEP_STATUS status = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
   18.15 -    assert(status == PEP_STATUS_OK);
   18.16 +    assert(status == PEP_KEY_IMPORTED);
   18.17      status = import_key(session, bob_priv_key.c_str(), bob_priv_key.length(), NULL);
   18.18 -    assert(status == PEP_STATUS_OK);
   18.19 +    assert(status == PEP_KEY_IMPORTED);
   18.20  }
   18.21  
   18.22  void MessageNullFromTests::setup() {
   18.23 @@ -121,4 +121,3 @@
   18.24      TEST_ASSERT_MSG(status == PEP_STATUS_OK, tl_status_string(status));                                         
   18.25      TEST_ASSERT(mime_plaintext);
   18.26  }
   18.27 -
    19.1 --- a/test/src/engine_tests/MessageTwoPointOhTests.cc	Mon Jan 28 14:04:12 2019 +0100
    19.2 +++ b/test/src/engine_tests/MessageTwoPointOhTests.cc	Tue Jan 29 19:19:30 2019 +0100
    19.3 @@ -39,12 +39,12 @@
    19.4  
    19.5      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
    19.6      PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
    19.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    19.8 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    19.9 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   19.10 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
   19.11      statuspub = import_key(session, carol_pub_key.c_str(), carol_pub_key.length(), NULL);
   19.12      statuspriv = import_key(session, carol_priv_key.c_str(), carol_priv_key.length(), NULL);
   19.13 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
   19.14 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
   19.15 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   19.16 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
   19.17  
   19.18      cout << "creating message…\n";
   19.19      pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", PEP_OWN_USERID, "Alice Test");
    20.1 --- a/test/src/engine_tests/MistrustUndoTests.cc	Mon Jan 28 14:04:12 2019 +0100
    20.2 +++ b/test/src/engine_tests/MistrustUndoTests.cc	Tue Jan 29 19:19:30 2019 +0100
    20.3 @@ -35,7 +35,7 @@
    20.4      TEST_ASSERT_MSG((pub_key.length() != 0), "pub_key.length() != 0");
    20.5      
    20.6      PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
    20.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    20.8 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
    20.9      cout << "Key imported." << endl << endl;
   20.10      
   20.11      cout << "Setting up identity for mistrust.undo.test@pep-project.org and making comm_type PEP_ct_pEp."  << endl;
    21.1 --- a/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc	Mon Jan 28 14:04:12 2019 +0100
    21.2 +++ b/test/src/engine_tests/NewUpdateIdAndMyselfTests.cc	Tue Jan 29 19:19:30 2019 +0100
    21.3 @@ -195,7 +195,7 @@
    21.4      const string alex_pub_key = slurp("test_keys/pub/pep.test.alexander-0x26B54E4E_pub.asc");
    21.5      
    21.6      PEP_STATUS statuspub = import_key(session, alex_pub_key.c_str(), alex_pub_key.length(), NULL);
    21.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    21.8 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
    21.9  
   21.10      pEp_identity* alex = new_identity(alex_address, alex_fpr, alex_userid, alex_username);
   21.11  
   21.12 @@ -353,7 +353,7 @@
   21.13      const string bella_pub_key = slurp("test_keys/pub/pep.test.bella-0xAF516AAE_pub.asc");
   21.14      
   21.15      statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
   21.16 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
   21.17 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   21.18  
   21.19      pEp_identity* bella = new_identity(bella_address, bella_fpr, bella_userid, bella_username);
   21.20      
   21.21 @@ -460,7 +460,7 @@
   21.22      const string bernd_pub_key = slurp("test_keys/pub/bernd.das.brot-0xCAFAA422_pub.asc");
   21.23      
   21.24      statuspub = import_key(session, bernd_pub_key.c_str(), bernd_pub_key.length(), NULL);
   21.25 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
   21.26 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   21.27  
   21.28      pEp_identity* bernd = new_identity(bernd_address, bernd_fpr, bernd_userid, bernd_username);
   21.29      
    22.1 --- a/test/src/engine_tests/ReencryptPlusExtraKeysTests.cc	Mon Jan 28 14:04:12 2019 +0100
    22.2 +++ b/test/src/engine_tests/ReencryptPlusExtraKeysTests.cc	Tue Jan 29 19:19:30 2019 +0100
    22.3 @@ -52,24 +52,24 @@
    22.4      const string pub_extra_key_1 = slurp("test_keys/pub/reencrypt_extra_keys_1-0x8B026AEC_pub.asc");
    22.5  
    22.6      status = import_key(session, own_recip_pub_key.c_str(), own_recip_pub_key.length(), NULL);
    22.7 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import own recipient public key.");
    22.8 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import own recipient public key.");
    22.9      status = import_key(session, own_recip_priv_key.c_str(), own_recip_priv_key.length(), NULL);
   22.10 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import own recipient private key.");    
   22.11 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import own recipient private key.");    
   22.12      status = import_key(session, own_recip_2_pub_key.c_str(), own_recip_2_pub_key.length(), NULL);
   22.13 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import own second recipient public key.");
   22.14 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import own second recipient public key.");
   22.15      status = import_key(session, own_recip_2_priv_key.c_str(), own_recip_2_priv_key.length(), NULL);
   22.16 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import own second recipient public key.");
   22.17 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import own second recipient public key.");
   22.18      
   22.19      status = import_key(session, sender_pub_key.c_str(), sender_pub_key.length(), NULL);
   22.20 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import own sender public key.");
   22.21 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import own sender public key.");
   22.22      status = import_key(session, recip_2_pub_key.c_str(), recip_2_pub_key.length(), NULL);
   22.23 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to second recipient public key.");
   22.24 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to second recipient public key.");
   22.25      status = import_key(session, recip_0_pub_key.c_str(), recip_0_pub_key.length(), NULL);
   22.26 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import zeroth recipient public key.");
   22.27 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import zeroth recipient public key.");
   22.28      status = import_key(session, pub_extra_key_0.c_str(), pub_extra_key_0.length(), NULL);
   22.29 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import first extra public key.");
   22.30 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import first extra public key.");
   22.31      status = import_key(session, pub_extra_key_1.c_str(), pub_extra_key_1.length(), NULL);
   22.32 -    TEST_ASSERT_MSG(status == PEP_STATUS_OK, "Failed to import second extra public key.");
   22.33 +    TEST_ASSERT_MSG(status == PEP_KEY_IMPORTED, "Failed to import second extra public key.");
   22.34  
   22.35      cout << "Keys imported." << endl;
   22.36  
    23.1 --- a/test/src/engine_tests/RevokeRegenAttachTests.cc	Mon Jan 28 14:04:12 2019 +0100
    23.2 +++ b/test/src/engine_tests/RevokeRegenAttachTests.cc	Tue Jan 29 19:19:30 2019 +0100
    23.3 @@ -32,7 +32,7 @@
    23.4      EngineTestSessionSuite::setup();
    23.5      string recip_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
    23.6      PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL);
    23.7 -    assert(status == PEP_STATUS_OK);
    23.8 +    assert(status == PEP_KEY_IMPORTED);
    23.9  }
   23.10  
   23.11  
    24.1 --- a/test/src/engine_tests/UserIDAliasTests.cc	Mon Jan 28 14:04:12 2019 +0100
    24.2 +++ b/test/src/engine_tests/UserIDAliasTests.cc	Tue Jan 29 19:19:30 2019 +0100
    24.3 @@ -33,8 +33,8 @@
    24.4      
    24.5      PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
    24.6      PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
    24.7 -    TEST_ASSERT_MSG((statuspub == PEP_STATUS_OK), "statuspub == PEP_STATUS_OK");
    24.8 -    TEST_ASSERT_MSG((statuspriv == PEP_STATUS_OK), "statuspriv == PEP_STATUS_OK");
    24.9 +    TEST_ASSERT_MSG((statuspub == PEP_KEY_IMPORTED), "statuspub == PEP_STATUS_OK");
   24.10 +    TEST_ASSERT_MSG((statuspriv == PEP_KEY_IMPORTED), "statuspriv == PEP_STATUS_OK");
   24.11  
   24.12      pEp_identity* alice = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", PEP_OWN_USERID, "Alice Test");
   24.13  
    25.1 --- a/test/src/util/test_util.cc	Mon Jan 28 14:04:12 2019 +0100
    25.2 +++ b/test/src/util/test_util.cc	Tue Jan 29 19:19:30 2019 +0100
    25.3 @@ -338,7 +338,7 @@
    25.4  
    25.5  bool slurp_and_import_key(PEP_SESSION session, const char* key_filename) {
    25.6      std::string keyfile = slurp(key_filename);
    25.7 -    if (import_key(session, keyfile.c_str(), keyfile.size(), NULL) != PEP_STATUS_OK)
    25.8 +    if (import_key(session, keyfile.c_str(), keyfile.size(), NULL) != PEP_KEY_IMPORTED)
    25.9          return false;
   25.10      return true;
   25.11  }
   25.12 @@ -372,4 +372,3 @@
   25.13      
   25.14      return retval;
   25.15  }
   25.16 -