1.1 --- a/src/pgp_gpg.c Tue Nov 20 17:37:00 2018 +0100
1.2 +++ b/src/pgp_gpg.c Tue Nov 20 17:56:04 2018 +0100
1.3 @@ -355,6 +355,7 @@
1.4 DLOAD(gpgme_op_decrypt_result);
1.5 DLOAD(gpgme_op_encrypt_sign);
1.6 DLOAD(gpgme_op_encrypt);
1.7 + DLOAD(gpgme_op_sign);
1.8 DLOAD(gpgme_op_verify_result);
1.9 DLOAD(gpgme_signers_clear);
1.10 DLOAD(gpgme_signers_add);
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/test/include/SignOnlyTests.h Tue Nov 20 17:56:04 2018 +0100
2.3 @@ -0,0 +1,19 @@
2.4 +// This file is under GNU General Public License 3.0
2.5 +// see LICENSE.txt
2.6 +
2.7 +#ifndef SIGN_ONLY_H
2.8 +#define SIGN_ONLY_H
2.9 +
2.10 +#include <string>
2.11 +#include "EngineTestIndividualSuite.h"
2.12 +
2.13 +using namespace std;
2.14 +
2.15 +class SignOnlyTests : public EngineTestIndividualSuite {
2.16 + public:
2.17 + SignOnlyTests(string test_suite, string test_home_dir);
2.18 + private:
2.19 + void check_sign_only();
2.20 +};
2.21 +
2.22 +#endif
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/test/src/engine_tests/SignOnlyTests.cc Tue Nov 20 17:56:04 2018 +0100
3.3 @@ -0,0 +1,47 @@
3.4 +// This file is under GNU General Public License 3.0
3.5 +// see LICENSE.txt
3.6 +
3.7 +#include <stdlib.h>
3.8 +#include <string>
3.9 +#include <cstring>
3.10 +#include <cpptest.h>
3.11 +
3.12 +#include "pEpEngine.h"
3.13 +
3.14 +#include "test_util.h"
3.15 +#include "EngineTestIndividualSuite.h"
3.16 +#include "SignOnlyTests.h"
3.17 +
3.18 +using namespace std;
3.19 +
3.20 +SignOnlyTests::SignOnlyTests(string suitename, string test_home_dir) :
3.21 + EngineTestIndividualSuite::EngineTestIndividualSuite(suitename, test_home_dir) {
3.22 + add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("SignOnlyTests::check_sign_only"),
3.23 + static_cast<Func>(&SignOnlyTests::check_sign_only)));
3.24 +}
3.25 +
3.26 +void SignOnlyTests::check_sign_only() {
3.27 + slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
3.28 + slurp_and_import_key(session, "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");
3.29 + const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
3.30 + string msg_text = "Grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr! I mean, yo. Greetings to Meesti.\n - Alice";
3.31 + char* signed_text = NULL;
3.32 + size_t signed_text_size = 0;
3.33 +
3.34 + stringlist_t* keylist = NULL;
3.35 +
3.36 + PEP_STATUS status = sign_only(session, msg_text.c_str(), msg_text.size(), alice_fpr, &signed_text, &signed_text_size);
3.37 + TEST_ASSERT(status == PEP_STATUS_OK);
3.38 + cout << signed_text << endl;
3.39 +
3.40 + status = verify_text(session, msg_text.c_str(), msg_text.size(),
3.41 + signed_text, signed_text_size, &keylist);
3.42 + TEST_ASSERT(status == PEP_VERIFIED);
3.43 + TEST_ASSERT(keylist);
3.44 + TEST_ASSERT(keylist->value);
3.45 + TEST_ASSERT(strcmp(keylist->value, alice_fpr) == 0);
3.46 +
3.47 + // FIXME: free stuff
3.48 +
3.49 + TEST_ASSERT(true);
3.50 +}