Browse Source

ENGINE-630: ENGINE-760: Restored old top-level API - new functionality is bound to cryptotech under internal API command _import_key_with_fpr_return

import_key_2.1
parent
commit
49d5a2c4fb
32 changed files with 164 additions and 119 deletions
  1. +8
    -2
      src/message_api.c
  2. +13
    -4
      src/pEpEngine.c
  3. +39
    -9
      src/pEpEngine.h
  4. +6
    -6
      test/src/AppleMailTest.cc
  5. +4
    -4
      test/src/BCCTest.cc
  6. +1
    -1
      test/src/BlacklistAcceptNewKeyTest.cc
  7. +2
    -2
      test/src/BlacklistTest.cc
  8. +1
    -1
      test/src/CaseAndDotAddressTest.cc
  9. +3
    -3
      test/src/DecorateTest.cc
  10. +3
    -3
      test/src/DecryptAttachPrivateKeyTrustedTest.cc
  11. +3
    -3
      test/src/DecryptAttachPrivateKeyUntrustedTest.cc
  12. +6
    -6
      test/src/EncryptAttachPrivateKeyTest.cc
  13. +8
    -8
      test/src/EncryptForIdentityTest.cc
  14. +1
    -1
      test/src/EncryptMissingPrivateKeyTest.cc
  15. +4
    -4
      test/src/Engine463Test.cc
  16. +1
    -1
      test/src/Engine715Test.cc
  17. +2
    -2
      test/src/ExternalRevokeTest.cc
  18. +19
    -19
      test/src/ImportKeyTest.cc
  19. +2
    -2
      test/src/KeyringImportTest.cc
  20. +1
    -1
      test/src/LeastColorGroupTest.cc
  21. +4
    -4
      test/src/LeastCommonDenomColorTest.cc
  22. +1
    -1
      test/src/LookupTest.cc
  23. +3
    -3
      test/src/MessageApiTest.cc
  24. +3
    -3
      test/src/MessageNullFromTest.cc
  25. +4
    -4
      test/src/MessageTwoPointOhTest.cc
  26. +3
    -3
      test/src/PepSubjectReceivedTest.cc
  27. +9
    -9
      test/src/ReencryptPlusExtraKeysTest.cc
  28. +2
    -2
      test/src/RevocationTest.cc
  29. +1
    -1
      test/src/RevokeRegenAttachTest.cc
  30. +3
    -3
      test/src/UpdateIdAndMyselfTest.cc
  31. +2
    -2
      test/src/UserIDAliasTest.cc
  32. +2
    -2
      test/src/test_util.cc

+ 8
- 2
src/message_api.c View File

@ -1579,7 +1579,8 @@ bool import_attached_keys(
}
}
identity_list *local_private_idents = NULL;
PEP_STATUS import_status = import_key(session, blob_value, blob_size,
PEP_STATUS import_status = _import_key_with_fpr_return(
session, blob_value, blob_size,
&local_private_idents,
imported_keys,
changed_keys);
@ -3420,7 +3421,12 @@ static bool import_header_keys(PEP_SESSION session, message* src, stringlist_t**
bloblist_t* the_key = base64_str_to_binary_blob(start_key, length);
if (!the_key)
return false;
PEP_STATUS status = import_key(session, the_key->value, the_key->size, NULL, imported_keys, changed_keys);
PEP_STATUS status = _import_key_with_fpr_return(session,
the_key->value,
the_key->size,
NULL,
imported_keys,
changed_keys);
free_bloblist(the_key);
if (status == PEP_STATUS_OK || status == PEP_KEY_IMPORTED)
return true;


+ 13
- 4
src/pEpEngine.c View File

@ -4850,12 +4850,21 @@ DYNAMIC_API PEP_STATUS get_key_rating(
}
DYNAMIC_API PEP_STATUS import_key(
PEP_SESSION session,
const char *key_data,
size_t size,
identity_list **private_keys)
{
return _import_key_with_fpr_return(session, key_data, size, private_keys, NULL, NULL);
}
PEP_STATUS _import_key_with_fpr_return(
PEP_SESSION session,
const char *key_data,
size_t size,
identity_list **private_keys,
stringlist_t** imported_keys,
uint64_t* changed_key_index
uint64_t* changed_public_keys
)
{
assert(session);
@ -4864,11 +4873,11 @@ DYNAMIC_API PEP_STATUS import_key(
if (!(session && key_data))
return PEP_ILLEGAL_VALUE;
if (imported_keys && !*imported_keys && changed_key_index)
*changed_key_index = 0;
if (imported_keys && !*imported_keys && changed_public_keys)
*changed_public_keys = 0;
return session->cryptotech[PEP_crypt_OpenPGP].import_key(session, key_data,
size, private_keys, imported_keys, changed_key_index);
size, private_keys, imported_keys, changed_public_keys);
}
DYNAMIC_API PEP_STATUS recv_key(PEP_SESSION session, const char *pattern)


+ 39
- 9
src/pEpEngine.h View File

@ -900,12 +900,6 @@ DYNAMIC_API PEP_STATUS delete_keypair(PEP_SESSION session, const char *fpr);
// size (in) amount of data to handle
// private_keys (out) list of identities containing the
// private keys that have been imported
// imported_keys (out) list of actual keys imported
// changed_key_index (out) bitvector - corresponds to the first 64 keys
// imported. If nth bit is set, import changed a
// key corresponding to the nth element in
// imported keys (i.e. key was in DB and was
// changed by import)
//
// return value:
// PEP_STATUS_OK = 0 key was successfully imported
@ -920,11 +914,47 @@ DYNAMIC_API PEP_STATUS import_key(
PEP_SESSION session,
const char *key_data,
size_t size,
identity_list **private_keys,
stringlist_t** imported_keys,
uint64_t* changed_key_index
identity_list **private_keys
);
// _import_key_with_fpr_return() -
// INTERNAL FUNCTION - import keys from data, return optional list
// of fprs imported
//
// parameters:
// session (in) session handle
// key_data (in) key data, i.e. ASCII armored OpenPGP key
// size (in) amount of data to handle
// private_keys (out) list of identities containing the
// private keys that have been imported
// imported_keys (out) if non-NULL, list of actual keys imported
// changed_public_keys (out) if non-NULL AND imported_keys is non-NULL:
// bitvector - corresponds to the first 64 keys
// imported. If nth bit is set, import changed a
// key corresponding to the nth element in
// imported keys (i.e. key was in DB and was
// changed by import)
//
// return value:
// PEP_STATUS_OK = 0 key was successfully imported
// PEP_OUT_OF_MEMORY out of memory
// PEP_ILLEGAL_VALUE there is no key data to import, or imported keys was NULL and
// changed_public_keys was not
//
// caveat:
// private_keys and imported_keys goes to the ownership of the caller
// private_keys and imported_keys can be left NULL, it is then ignored
// *** THIS IS THE ACTUAL FUNCTION IMPLEMENTED BY CRYPTOTECH "import_key" ***
PEP_STATUS _import_key_with_fpr_return(
PEP_SESSION session,
const char *key_data,
size_t size,
identity_list** private_keys,
stringlist_t** imported_keys,
uint64_t* changed_public_keys // use as bit field for the first 64 changed keys
);
// export_key() - export ascii armored key
//


+ 6
- 6
test/src/AppleMailTest.cc View File

@ -99,9 +99,9 @@ TEST_F(AppleMailTest, check_apple_mail_text_signed_encrypted) {
const string keytextkey2 = slurp("test_keys/priv/pep-test-recip-0x08DB0AEE_priv.asc");
const string keytextkey3 = slurp("test_keys/pub/pep-test-recip-0x08DB0AEE_pub.asc");
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL, NULL, NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL, NULL, NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL, NULL, NULL);
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL);
const string mailtext = slurp(mailfile);
pEp_identity * me = new_identity("pep.test.recip@kgrothoff.org", "93D19F24AD6F4C4BA9134AAF84D9217908DB0AEE", PEP_OWN_USERID, "pEp Test Recipient");
@ -157,9 +157,9 @@ TEST_F(AppleMailTest, check_apple_mail_html_signed_encrypted) {
const string keytextkey2 = slurp("test_keys/priv/pep-test-recip-0x08DB0AEE_priv.asc");
const string keytextkey3 = slurp("test_keys/pub/pep-test-recip-0x08DB0AEE_pub.asc");
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL, NULL, NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL, NULL, NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL, NULL, NULL);
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL);
pEp_identity * me = new_identity("pep.test.recip@kgrothoff.org", "93D19F24AD6F4C4BA9134AAF84D9217908DB0AEE", PEP_OWN_USERID, "pEp Test Recipient");
me->me = true;


+ 4
- 4
test/src/BCCTest.cc View File

@ -65,18 +65,18 @@ namespace {
// Engine is up. Keep on truckin'
string keystr = slurp("test_keys/priv/bcc_test_dude_0-0x1CCCFC41_priv.asc");
PEP_STATUS status = import_key(session, keystr.c_str(), keystr.size(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, keystr.c_str(), keystr.size(), NULL);
ASSERT_TRUE(status == PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity * me = new_identity("bcc_test_dude_0@darthmama.cool", "0AE9AA3E320595CF93296BDFA155AC491CCCFC41", PEP_OWN_USERID, "BCC Test Sender");
status = set_own_key(session, me, "0AE9AA3E320595CF93296BDFA155AC491CCCFC41");
keystr = slurp("test_keys/pub/bcc_test_dude_0-0x1CCCFC41_pub.asc");
status = import_key(session, keystr.c_str(), keystr.size(), NULL, NULL, NULL);
status = import_key(session, keystr.c_str(), keystr.size(), NULL);
ASSERT_TRUE(status == PEP_TEST_KEY_IMPORT_SUCCESS);
keystr = slurp("test_keys/pub/bcc_test_dude_1-0xDAC746BE_pub.asc");
status = import_key(session, keystr.c_str(), keystr.size(), NULL, NULL, NULL);
status = import_key(session, keystr.c_str(), keystr.size(), NULL);
ASSERT_TRUE(status == PEP_TEST_KEY_IMPORT_SUCCESS);
keystr = slurp("test_keys/pub/bcc_test_dude_2-0x53CECCF7_pub.asc");
status = import_key(session, keystr.c_str(), keystr.size(), NULL, NULL, NULL);
status = import_key(session, keystr.c_str(), keystr.size(), NULL);
ASSERT_TRUE(status == PEP_TEST_KEY_IMPORT_SUCCESS);
}


+ 1
- 1
test/src/BlacklistAcceptNewKeyTest.cc View File

@ -100,7 +100,7 @@ TEST_F(BlacklistAcceptNewKeyTest, check_blacklist_accept_new_key) {
const string keytext = slurp("test_keys/pub/blacklisted_pub.asc");
/* import it into pep */
PEP_STATUS status7 = import_key(session, keytext.c_str(), keytext.length(), NULL, NULL, NULL);
PEP_STATUS status7 = import_key(session, keytext.c_str(), keytext.length(), NULL);
const char* bl_fpr_1 = "279765A2FEB5B7C731B861D93E4CEFD9F7AF4684";
bool is_blacklisted = false;


+ 2
- 2
test/src/BlacklistTest.cc View File

@ -152,7 +152,7 @@ TEST_F(BlacklistTest, check_blacklist) {
/* FIXME: put in automated test stuff (N.B. only gdb mem examination to this point to get
* fix in */
/* import it into pep */
PEP_STATUS status7 = import_key(session, keytext.c_str(), keytext.length(), NULL, NULL, NULL);
PEP_STATUS status7 = import_key(session, keytext.c_str(), keytext.length(), NULL);
const char* bl_fpr_1 = "279765A2FEB5B7C731B861D93E4CEFD9F7AF4684";
const char* bl_fpr_2 = "634FAC4417E9B2A5DC2BD4AAC4AEEBBE7E62701B";
@ -229,7 +229,7 @@ TEST_F(BlacklistTest, check_blacklist) {
free_message(msg23);
const string keytext2 = slurp("test_keys/pub/blacklisted_pub2.asc");
PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL, NULL, NULL);
PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL);
pEp_identity* blacklisted_identity2 = new_identity("blacklistedkeys@kgrothoff.org",
bl_fpr_2,


+ 1
- 1
test/src/CaseAndDotAddressTest.cc View File

@ -98,7 +98,7 @@ TEST_F(CaseAndDotAddressTest, check_case_and_dot_address) {
const char* alice_email_dotless = "peptestalice@pep-project.org";
const char* alice_email_case_and_dot = "PE.p.teS.t.ALICE@pep-project.OrG";
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity * alice_id = new_identity("pep.test.alice@pep-project.org", "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97", user_id, "Alice Test");


+ 3
- 3
test/src/DecorateTest.cc View File

@ -92,9 +92,9 @@ TEST_F(DecorateTest, check_decorate) {
const string alice_pub_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
const string alice_priv_key = slurp("test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statusbob = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
PEP_STATUS statusbob = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statusbob , PEP_TEST_KEY_IMPORT_SUCCESS);


+ 3
- 3
test/src/DecryptAttachPrivateKeyTrustedTest.cc View File

@ -108,11 +108,11 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
//
// 13A9F97964A2B52520CAA40E51BCA783C065A213
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
@ -121,7 +121,7 @@ TEST_F(DecryptAttachPrivateKeyTrustedTest, check_decrypt_attach_private_key_trus
// key with same address and user_id
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);


+ 3
- 3
test/src/DecryptAttachPrivateKeyUntrustedTest.cc View File

@ -106,11 +106,11 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
//
// 13A9F97964A2B52520CAA40E51BCA783C065A213
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0xC065A213_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0xC065A213_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// ensure there's no private key - doesn't work in automated tests, sadly. Uncommon when running script manually.
@ -126,7 +126,7 @@ TEST_F(DecryptAttachPrivateKeyUntrustedTest, check_decrypt_attach_private_key_un
// key with same address and user_id
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);


+ 6
- 6
test/src/EncryptAttachPrivateKeyTest.cc View File

@ -118,35 +118,35 @@ TEST_F(EncryptAttachPrivateKeyTest, check_encrypt_attach_private_key) {
// key for main own user
// 8AB616A3BD51DEF714B5E688EFFB540C3276D2E5
input_key = slurp("test_keys/pub/priv-key-import-test-main_0-0x3276D2E5_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
input_key = slurp("test_keys/priv/priv-key-import-test-main_0-0x3276D2E5_priv.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// key with same address and user_id (initially untrusted, then trusted)
// 359DD8AC87D1F5E4304D08338D7185F180C8CD87
input_key = slurp("test_keys/pub/priv-key-import-test-main_1-0x80C8CD87_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// key with same address and to have different (non-aliased) user_id (initially untrusted, then trusted)
// B044B83639E292283A3F6E14C2E64B520B74809C
input_key = slurp("test_keys/pub/priv-key-import-test-main_2-0x0B74809C_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// key with different address to have same user_id (initially untrusted, then trusted)
// C52911EBA0D34B0F549594A15A7A363BD11252C9
input_key = slurp("test_keys/pub/priv-key-import-test-other_0-0xD11252C9_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
// key with different address to have different user_id (initially untrusted, then trusted)
// 567212EFB8A3A76B1D32B9565F45BEA9C785F20A
input_key = slurp("test_keys/pub/priv-key-import-test-other_1-0xC785F20A_pub.asc");
status = import_key(session, input_key.c_str(), input_key.length(), NULL, NULL, NULL);
status = import_key(session, input_key.c_str(), input_key.length(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
output_stream << "Done!" << endl << endl;


+ 8
- 8
test/src/EncryptForIdentityTest.cc View File

@ -98,14 +98,14 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity) {
const string gabrielle_pub_key = slurp("test_keys/pub/pep-test-gabrielle-0xE203586C_pub.asc");
const string bella_pub_key = slurp("test_keys/pub/pep.test.bella-0xAF516AAE_pub.asc");
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv, PEP_TEST_KEY_IMPORT_SUCCESS);
statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
@ -363,14 +363,14 @@ TEST_F(EncryptForIdentityTest, check_encrypt_for_identity_with_URI) {
const string gabrielle_pub_key = slurp("test_keys/pub/pep-test-gabrielle-0xE203586C_pub.asc");
const string bella_pub_key = slurp("test_keys/pub/pep.test.bella-0xAF516AAE_pub.asc");
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv, PEP_TEST_KEY_IMPORT_SUCCESS);
statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, gabrielle_pub_key.c_str(), gabrielle_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";


+ 1
- 1
test/src/EncryptMissingPrivateKeyTest.cc View File

@ -71,7 +71,7 @@ namespace {
// Engine is up. Keep on truckin'
string recip_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
}


+ 4
- 4
test/src/Engine463Test.cc View File

@ -88,9 +88,9 @@ TEST_F(Engine463Test, check_engine_463_no_own_key) {
const string claudio_keys = slurp("test_keys/priv/notfound-alt-pub_and_private.asc");
const string fake_schleuder_key = slurp("test_keys/pub/fake-schleuder.asc");
PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL, NULL, NULL);
status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
// Ok, bring in message, decrypt, and see what happens.
@ -111,9 +111,9 @@ TEST_F(Engine463Test, check_engine_463_own_key) {
const string claudio_keys = slurp("test_keys/priv/notfound-alt-pub_and_private.asc");
const string fake_schleuder_key = slurp("test_keys/pub/fake-schleuder.asc");
PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, claudio_keys.c_str(), claudio_keys.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL, NULL, NULL);
status = import_key(session, fake_schleuder_key.c_str(), fake_schleuder_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* own_ident = new_identity("claudio+engine-463@pep.foundation", "A039BC60E43E0DFDDC9DE8663B48C38325210C88", PEP_OWN_USERID, "Not Actually Claudio");


+ 1
- 1
test/src/Engine715Test.cc View File

@ -81,6 +81,6 @@ TEST_F(Engine715Test, check_engine_715) {
// This is just a dummy test case. The convention is check_whatever_you_are_checking
// so for multiple test cases in a suite, be more explicit ;)
string keyfile = slurp("test_keys/t001.asc");
PEP_STATUS status = import_key(session, keyfile.c_str(), keyfile.size(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, keyfile.c_str(), keyfile.size(), NULL);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
}

+ 2
- 2
test/src/ExternalRevokeTest.cc View File

@ -102,8 +102,8 @@ TEST_F(ExternalRevokeTest, check_external_revoke) {
ASSERT_NE(fenris_pub_key.length() , 0);
ASSERT_NE(fenris_priv_key.length() , 0);
PEP_STATUS statuspub = import_key(session, fenris_pub_key.c_str(), fenris_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, fenris_priv_key.c_str(), fenris_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, fenris_pub_key.c_str(), fenris_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, fenris_priv_key.c_str(), fenris_priv_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv , PEP_TEST_KEY_IMPORT_SUCCESS);


+ 19
- 19
test/src/ImportKeyTest.cc View File

@ -82,7 +82,7 @@ TEST_F(ImportKeyTest, check_import_fpr_pub_new) {
string pubkey = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
stringlist_t* keylist = NULL;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, NULL);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, NULL);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
@ -97,7 +97,7 @@ TEST_F(ImportKeyTest, check_import_change_pub_new) {
string pubkey = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
@ -111,7 +111,7 @@ TEST_F(ImportKeyTest, check_import_fpr_priv_new) {
string pubkey = slurp("test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
stringlist_t* keylist = NULL;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, NULL);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, NULL);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
@ -126,7 +126,7 @@ TEST_F(ImportKeyTest, check_import_change_pub_nochange) {
string pubkey = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
@ -137,7 +137,7 @@ TEST_F(ImportKeyTest, check_import_change_pub_nochange) {
free_stringlist(keylist);
keylist = NULL;
changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97");
@ -150,7 +150,7 @@ TEST_F(ImportKeyTest, check_import_change_wo_fpr_illegal) {
string pubkey = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
uint64_t changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, NULL, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, NULL, &changes);
ASSERT_EQ(status, PEP_ILLEGAL_VALUE);
}
@ -159,7 +159,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_pub_concat) {
string pubkey_material = slurp("test_keys/pub/import_keys_multi_pub_concat.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -171,7 +171,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_priv_concat) {
string privkey_material = slurp("test_keys/priv/import_keys_multi_priv_concat.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -183,7 +183,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_priv_then_pub) {
string privkey_material = slurp("test_keys/priv/import_keys_multi_priv_concat.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -192,7 +192,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_priv_then_pub) {
keylist = NULL;
changes = 0;
string pubkey_material = slurp("test_keys/pub/import_keys_multi_pub_concat.asc");
status = import_key(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -204,7 +204,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_pub_then_priv) {
string pubkey_material = slurp("test_keys/pub/import_keys_multi_pub_concat.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -213,7 +213,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_pub_then_priv) {
keylist = NULL;
changes = 0;
string privkey_material = slurp("test_keys/priv/import_keys_multi_priv_concat.asc");
status = import_key(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -226,7 +226,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_pub_blob) {
string pubkey_material = slurp("test_keys/pub/import_keys_multi_pub_serial_blob.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -238,7 +238,7 @@ TEST_F(ImportKeyTest, check_import_fpr_list_priv_blob) {
string privkey_material = slurp("test_keys/priv/import_keys_multi_priv_serial_blob.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, privkey_material.c_str(), privkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -251,7 +251,7 @@ TEST_F(ImportKeyTest, check_import_added_subkey_then_revoke_subkey) {
string pubkey = slurp("test_keys/pub/import_keys_multi_9-0x045134F0_pub.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "25D08DAFD15F21F6A9492FB00A958FA5045134F0");
@ -262,7 +262,7 @@ TEST_F(ImportKeyTest, check_import_added_subkey_then_revoke_subkey) {
free_stringlist(keylist);
keylist = NULL;
changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "25D08DAFD15F21F6A9492FB00A958FA5045134F0");
@ -273,7 +273,7 @@ TEST_F(ImportKeyTest, check_import_added_subkey_then_revoke_subkey) {
free_stringlist(keylist);
keylist = NULL;
changes = 0;
status = import_key(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, pubkey.c_str(), pubkey.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_STREQ(keylist->value, "25D08DAFD15F21F6A9492FB00A958FA5045134F0");
@ -290,7 +290,7 @@ TEST_F(ImportKeyTest, check_import_huge_concat_then_change) {
string pubkey_material = slurp("test_keys/pub/import_keys_multi_pub_concat.asc");
stringlist_t* keylist = NULL;
uint64_t changes = 0;
PEP_STATUS status = import_key(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
PEP_STATUS status = _import_key_with_fpr_return(session, pubkey_material.c_str(), pubkey_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);
@ -299,7 +299,7 @@ TEST_F(ImportKeyTest, check_import_huge_concat_then_change) {
keylist = NULL;
changes = 0;
string some_changed_material = slurp("test_keys/pub/import_keys_multi_with_mult_changes_concat.asc");
status = import_key(session, some_changed_material.c_str(), some_changed_material.size(), NULL, &keylist, &changes);
status = _import_key_with_fpr_return(session, some_changed_material.c_str(), some_changed_material.size(), NULL, &keylist, &changes);
ASSERT_EQ(status, PEP_KEY_IMPORTED);
ASSERT_NE(keylist, nullptr);
ASSERT_EQ(stringlist_length(keylist), 10);


+ 2
- 2
test/src/KeyringImportTest.cc View File

@ -93,7 +93,7 @@ TEST_F(KeyringImportTest, check_import1) {
#ifdef USE_SEQUOIA
const string pub_key = slurp("test_keys/pub/pep-test-keyring.asc");
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
struct entry {
@ -145,7 +145,7 @@ TEST_F(KeyringImportTest, check_import2) {
#ifdef USE_SEQUOIA
const string pub_key = slurp("test_keys/pub/pep-test-android-keyring.pgp");
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
struct entry {


+ 1
- 1
test/src/LeastColorGroupTest.cc View File

@ -103,7 +103,7 @@ TEST_F(LeastColorGroupTest, check_least_color_group) {
for (auto name : keynames) {
output_stream << "\t read keyfile \"" << name << "\"..." << std::endl;
const string keytextkey = slurp(name);
PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL, NULL, NULL);
PEP_STATUS statuskey = import_key(session, keytextkey.c_str(), keytextkey.length(), NULL);
ASSERT_EQ(statuskey , PEP_TEST_KEY_IMPORT_SUCCESS);
}


+ 4
- 4
test/src/LeastCommonDenomColorTest.cc View File

@ -98,10 +98,10 @@ TEST_F(LeastCommonDenomColorTest, check_least_common_denom_color) {
const string keytextkey3 = slurp("test_keys/pub/pep.never.me.test-0x79C11D1D_pub.asc");
const string keytextkey4 = slurp("test_keys/priv/pep.never.me.test-0x79C11D1D_priv.asc");
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL, NULL, NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL, NULL, NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL, NULL, NULL);
PEP_STATUS statuskey4 = import_key(session, keytextkey4.c_str(), keytextkey4.length(), NULL, NULL, NULL);
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL);
PEP_STATUS statuskey4 = import_key(session, keytextkey4.c_str(), keytextkey4.length(), NULL);
pEp_identity * sender = new_identity("pep.never.me.test@kgrothoff.org", NULL, "TOFU_pep.never.me.test@kgrothoff.org", "pEp Never Me Test");
sender->me = false;


+ 1
- 1
test/src/LookupTest.cc View File

@ -96,7 +96,7 @@ TEST_F(LookupTest, check_lookup) {
const char* username = "SuperDuperHans";
const string pub_key = slurp("test_keys/pub/hans@xn--bcher-kva.tld_-0x08AD6E9400D38894_pub.asc");
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, pub_key.c_str(), pub_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* hans = new_identity(expected_address, NULL, userid, username);


+ 3
- 3
test/src/MessageApiTest.cc View File

@ -94,11 +94,11 @@ TEST_F(MessageApiTest, check_message_api) {
const string alice_priv_key = slurp("test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
PEP_STATUS status0 = import_key(session, alice_pub_key.c_str(), alice_pub_key.size(), NULL, NULL, NULL);
PEP_STATUS status0 = import_key(session, alice_pub_key.c_str(), alice_pub_key.size(), NULL);
ASSERT_EQ(status0 , PEP_TEST_KEY_IMPORT_SUCCESS);
status0 = import_key(session, alice_priv_key.c_str(), alice_priv_key.size(), NULL, NULL, NULL);
status0 = import_key(session, alice_priv_key.c_str(), alice_priv_key.size(), NULL);
ASSERT_EQ(status0 , PEP_TEST_KEY_IMPORT_SUCCESS);
status0 = import_key(session, bob_pub_key.c_str(), bob_pub_key.size(), NULL, NULL, NULL);
status0 = import_key(session, bob_pub_key.c_str(), bob_pub_key.size(), NULL);
ASSERT_EQ(status0 , PEP_TEST_KEY_IMPORT_SUCCESS);
// message_api test code


+ 3
- 3
test/src/MessageNullFromTest.cc View File

@ -42,16 +42,16 @@ namespace {
void import_alice_pub() {
const string alice_pub_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
PEP_STATUS status = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
assert(status == PEP_TEST_KEY_IMPORT_SUCCESS);
}
void import_bob_pair_and_set_own() {
const string bob_pub_key = slurp("test_keys/pub/pep-test-bob-0xC9C2EE39_pub.asc");
const string bob_priv_key = slurp("test_keys/priv/pep-test-bob-0xC9C2EE39_priv.asc");
PEP_STATUS status = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, bob_pub_key.c_str(), bob_pub_key.length(), NULL);
assert(status == PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, bob_priv_key.c_str(), bob_priv_key.length(), NULL, NULL, NULL);
status = import_key(session, bob_priv_key.c_str(), bob_priv_key.length(), NULL);
assert(status == PEP_TEST_KEY_IMPORT_SUCCESS);
}


+ 4
- 4
test/src/MessageTwoPointOhTest.cc View File

@ -100,12 +100,12 @@ TEST_F(MessageTwoPointOhTest, check_message_two_point_oh) {
const string carol_pub_key = slurp("test_keys/pub/pep-test-carol-0x42A85A42_pub.asc");
const string carol_priv_key = slurp("test_keys/priv/pep-test-carol-0x42A85A42_priv.asc");
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv , PEP_TEST_KEY_IMPORT_SUCCESS);
statuspub = import_key(session, carol_pub_key.c_str(), carol_pub_key.length(), NULL, NULL, NULL);
statuspriv = import_key(session, carol_priv_key.c_str(), carol_priv_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, carol_pub_key.c_str(), carol_pub_key.length(), NULL);
statuspriv = import_key(session, carol_priv_key.c_str(), carol_priv_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv , PEP_TEST_KEY_IMPORT_SUCCESS);


+ 3
- 3
test/src/PepSubjectReceivedTest.cc View File

@ -95,9 +95,9 @@ TEST_F(PepSubjectReceivedTest, check_pep_subject_received) {
const string keytextkey1 = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
const string keytextkey2 = slurp("test_keys/priv/pep-test-recip-0x08DB0AEE_priv.asc");
const string keytextkey3 = slurp("test_keys/pub/pep-test-recip-0x08DB0AEE_pub.asc");
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL, NULL, NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL, NULL, NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL, NULL, NULL);
PEP_STATUS statuskey1 = import_key(session, keytextkey1.c_str(), keytextkey1.length(), NULL);
PEP_STATUS statuskey2 = import_key(session, keytextkey2.c_str(), keytextkey2.length(), NULL);
PEP_STATUS statuskey3 = import_key(session, keytextkey3.c_str(), keytextkey3.length(), NULL);
pEp_identity * me = new_identity("pep.test.recip@kgrothoff.org", "93D19F24AD6F4C4BA9134AAF84D9217908DB0AEE", PEP_OWN_USERID, "pEp Test Recipient");
me->me = true;


+ 9
- 9
test/src/ReencryptPlusExtraKeysTest.cc View File

@ -99,35 +99,35 @@ namespace {
const string own_recip_priv_key = slurp("test_keys/priv/reencrypt_recip_0-0xB1A2BE89_priv.asc");
const string own_recip_2_pub_key = slurp("test_keys/pub/reencrypt_recip_numero_deux_test_0-0xD6E75FFF_pub.asc");
const string own_recip_2_priv_key = slurp("test_keys/priv/reencrypt_recip_numero_deux_test_0-0xD6E75FFF_priv.asc");
status = import_key(session, own_recip_pub_key.c_str(), own_recip_pub_key.length(), NULL, NULL, NULL);
status = import_key(session, own_recip_pub_key.c_str(), own_recip_pub_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, own_recip_priv_key.c_str(), own_recip_priv_key.length(), NULL, NULL, NULL);
status = import_key(session, own_recip_priv_key.c_str(), own_recip_priv_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, own_recip_2_pub_key.c_str(), own_recip_2_pub_key.length(), NULL, NULL, NULL);
status = import_key(session, own_recip_2_pub_key.c_str(), own_recip_2_pub_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, own_recip_2_priv_key.c_str(), own_recip_2_priv_key.length(), NULL, NULL, NULL);
status = import_key(session, own_recip_2_priv_key.c_str(), own_recip_2_priv_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
// Import sender key
const string sender_pub_key = slurp("test_keys/pub/reencrypt_sender_0-0x3B508C8E_pub.asc");
status = import_key(session, sender_pub_key.c_str(), sender_pub_key.length(), NULL, NULL, NULL);
status = import_key(session, sender_pub_key.c_str(), sender_pub_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
// Import other recips
const string recip_0_pub_key = slurp("test_keys/pub/reencrypt_other_recip_0-0x1F4A5986_pub.asc");
status = import_key(session, recip_0_pub_key.c_str(), recip_0_pub_key.length(), NULL, NULL, NULL);
status = import_key(session, recip_0_pub_key.c_str(), recip_0_pub_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
// we're leaving recip_1 out for the Hell of it - D3886D0DF75113BE2799C9374D6B99FE0F8273D8
const string recip_2_pub_key = slurp("test_keys/pub/reencrypt_other_recip_2-0x1EDBE691_pub.asc");
status = import_key(session, recip_2_pub_key.c_str(), recip_2_pub_key.length(), NULL, NULL, NULL);
status = import_key(session, recip_2_pub_key.c_str(), recip_2_pub_key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
// Import extra keys
const string pub_extra_key_0 = slurp("test_keys/pub/reencrypt_extra_keys_0-0x828AA789_pub.asc");
const string pub_extra_key_1 = slurp("test_keys/pub/reencrypt_extra_keys_1-0x8B026AEC_pub.asc");
status = import_key(session, pub_extra_key_0.c_str(), pub_extra_key_0.length(), NULL, NULL, NULL);
status = import_key(session, pub_extra_key_0.c_str(), pub_extra_key_0.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
status = import_key(session, pub_extra_key_1.c_str(), pub_extra_key_1.length(), NULL, NULL, NULL);
status = import_key(session, pub_extra_key_1.c_str(), pub_extra_key_1.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
output_stream << "Keys imported." << endl;


+ 2
- 2
test/src/RevocationTest.cc View File

@ -93,7 +93,7 @@ TEST_F(RevocationTest, check_revocation) {
// Read the key.
const string key = slurp("test_keys/priv/pep-test-linda-0xDCD555B6055ADE22_priv.asc");
PEP_STATUS status = import_key(session, key.c_str(), key.length(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, key.c_str(), key.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* pre = new_identity("linda@example.org", NULL, NULL, NULL);
@ -104,7 +104,7 @@ TEST_F(RevocationTest, check_revocation) {
// Read in the revocation certificate.
const string rev = slurp("test_keys/priv/pep-test-linda-0xDCD555B6055ADE22.rev");
status = import_key(session, rev.c_str(), rev.length(), NULL, NULL, NULL);
status = import_key(session, rev.c_str(), rev.length(), NULL);
ASSERT_EQ(status , PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* post = new_identity("linda@example.org", NULL, NULL, NULL);


+ 1
- 1
test/src/RevokeRegenAttachTest.cc View File

@ -70,7 +70,7 @@ namespace {
// Engine is up. Keep on truckin'
string recip_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL, NULL, NULL);
PEP_STATUS status = import_key(session, recip_key.c_str(), recip_key.size(), NULL);
ASSERT_EQ(status, PEP_TEST_KEY_IMPORT_SUCCESS);
}


+ 3
- 3
test/src/UpdateIdAndMyselfTest.cc View File

@ -258,7 +258,7 @@ TEST_F(UpdateIdAndMyselfTest, check_update_identity_and_myself) {
// 1. create original identity
const string alex_pub_key = slurp("test_keys/pub/pep.test.alexander-0x26B54E4E_pub.asc");
PEP_STATUS statuspub = import_key(session, alex_pub_key.c_str(), alex_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alex_pub_key.c_str(), alex_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* alex = new_identity(alex_address, alex_fpr, alex_userid, alex_username);
@ -451,7 +451,7 @@ TEST_F(UpdateIdAndMyselfTest, check_update_identity_and_myself) {
const char* bella_username = "Annabella the Great";
const string bella_pub_key = slurp("test_keys/pub/pep.test.bella-0xAF516AAE_pub.asc");
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, bella_pub_key.c_str(), bella_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* bella = new_identity(bella_address, bella_fpr, bella_userid, bella_username);
@ -500,7 +500,7 @@ TEST_F(UpdateIdAndMyselfTest, check_update_identity_and_myself) {
const char* bernd_username = "Bernd das Brot der Ultimative Testkandidat";
const string bernd_pub_key = slurp("test_keys/pub/bernd.das.brot-0xCAFAA422_pub.asc");
statuspub = import_key(session, bernd_pub_key.c_str(), bernd_pub_key.length(), NULL, NULL, NULL);
statuspub = import_key(session, bernd_pub_key.c_str(), bernd_pub_key.length(), NULL);
ASSERT_EQ(statuspub, PEP_TEST_KEY_IMPORT_SUCCESS);
pEp_identity* bernd = new_identity(bernd_address, bernd_fpr, bernd_userid, bernd_username);


+ 2
- 2
test/src/UserIDAliasTest.cc View File

@ -94,8 +94,8 @@ TEST_F(UserIDAliasTest, check_userid_aliases) {
const string alice_pub_key = slurp("test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
const string alice_priv_key = slurp("test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL, NULL, NULL);
PEP_STATUS statuspub = import_key(session, alice_pub_key.c_str(), alice_pub_key.length(), NULL);
PEP_STATUS statuspriv = import_key(session, alice_priv_key.c_str(), alice_priv_key.length(), NULL);
ASSERT_EQ(statuspub , PEP_TEST_KEY_IMPORT_SUCCESS);
ASSERT_EQ(statuspriv , PEP_TEST_KEY_IMPORT_SUCCESS);


+ 2
- 2
test/src/test_util.cc View File

@ -72,7 +72,7 @@ PEP_STATUS read_file_and_import_key(PEP_SESSION session, const char* fname) {
const std::string key = slurp(fname);
PEP_STATUS status = (key.empty() ? PEP_KEY_NOT_FOUND : PEP_STATUS_OK);
if (status == PEP_STATUS_OK)
status = import_key(session, key.c_str(), key.size(), NULL, NULL, NULL);
status = import_key(session, key.c_str(), key.size(), NULL);
return status;
}
@ -450,7 +450,7 @@ std::string tl_ident_flags_String(identity_flags_t fl) {
}
bool slurp_and_import_key(PEP_SESSION session, const char* key_filename) {
std::string keyfile = slurp(key_filename);
if (import_key(session, keyfile.c_str(), keyfile.size(), NULL, NULL, NULL) != PEP_TEST_KEY_IMPORT_SUCCESS)
if (import_key(session, keyfile.c_str(), keyfile.size(), NULL) != PEP_TEST_KEY_IMPORT_SUCCESS)
return false;
return true;
}


Loading…
Cancel
Save