C++11 library providing functionality common to all adapters.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

2 years ago
2 years ago
2 years ago
  1. // This file is under GNU General Public License 3.0
  2. // see LICENSE.txt
  3. #include "framework/framework.hh"
  4. #include <cassert>
  5. #include <pEp/keymanagement.h>
  6. #include <pEp/key_reset.h>
  7. #include "../src/passphrase_cache.hh"
  8. #include "../src/Adapter.hh"
  9. using namespace pEp;
  10. using namespace std;
  11. int main(int argc, char** argv)
  12. {
  13. Test::setup(argc, argv);
  14. Adapter::session.initialize();
  15. passphrase_cache.add("erwin");
  16. passphrase_cache.add("cathy");
  17. passphrase_cache.add("bob");
  18. const char* bob_filename = ENGINE_TEST
  19. "/test_keys/bob-primary-with-password-bob-subkey-without.pgp";
  20. const char* bob_fpr = "5C76378A62B04CF3F41BEC8D4940FC9FA1878736";
  21. const char* erwin_filename = ENGINE_TEST "/test_keys/erwin_normal_encrypted.pgp";
  22. const char* erwin_fpr = "CBA968BC01FCEB89F04CCF155C5E9E3F0420A570";
  23. Test::import_key_from_file(bob_filename);
  24. Test::import_key_from_file(erwin_filename);
  25. ::pEp_identity* bob = ::new_identity("bob@example.org", bob_fpr, "BOB", "Bob Dog");
  26. ::PEP_STATUS status = ::set_own_key(Adapter::session(), bob, bob_fpr);
  27. assert(status == PEP_STATUS_OK);
  28. ::pEp_identity* erwin = ::new_identity("erwin@example.org", erwin_fpr, "BOB", "Bob is Erwin");
  29. status = ::set_own_key(Adapter::session(), erwin, erwin_fpr);
  30. assert(status == PEP_STATUS_OK);
  31. status = ::key_reset_all_own_keys(Adapter::session());
  32. assert(status == PEP_STATUS_OK);
  33. ::free_identity(bob);
  34. ::free_identity(erwin);
  35. // session(Adapter::release);
  36. return 0;
  37. }