test/src/engine_tests/SignOnlyTests.cc
author Krista Bennett <krista@pep-project.org>
Tue, 20 Nov 2018 15:36:06 +0100
branchsync
changeset 3141 c931141752fe
child 3142 a095aa1286eb
permissions -rw-r--r--
SignOnlyTest base
krista@3141
     1
// This file is under GNU General Public License 3.0
krista@3141
     2
// see LICENSE.txt
krista@3141
     3
krista@3141
     4
#include <stdlib.h>
krista@3141
     5
#include <string>
krista@3141
     6
#include <cpptest.h>
krista@3141
     7
krista@3141
     8
#include "pEpEngine.h"
krista@3141
     9
krista@3141
    10
#include "test_util.h"
krista@3141
    11
#include "EngineTestIndividualSuite.h"
krista@3141
    12
#include "SignOnlyTests.h"
krista@3141
    13
krista@3141
    14
using namespace std;
krista@3141
    15
krista@3141
    16
SignOnlyTests::SignOnlyTests(string suitename, string test_home_dir) :
krista@3141
    17
    EngineTestIndividualSuite::EngineTestIndividualSuite(suitename, test_home_dir) {
krista@3141
    18
    add_test_to_suite(std::pair<std::string, void (Test::Suite::*)()>(string("SignOnlyTests::check_sign_only"),
krista@3141
    19
                                                                      static_cast<Func>(&SignOnlyTests::check_sign_only)));
krista@3141
    20
}
krista@3141
    21
krista@3141
    22
void SignOnlyTests::check_sign_only() {
krista@3141
    23
    slurp_and_import_key(session, "test_keys/pub/pep-test-alice-0x6FF00E97_pub.asc");
krista@3141
    24
    slurp_and_import_key(session, "test_keys/priv/pep-test-alice-0x6FF00E97_priv.asc");    
krista@3141
    25
    const char* alice_fpr = "4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
krista@3141
    26
    string msg_text = "Grrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr! I mean, yo. Greetings to Meesti.\n - Alice";
krista@3141
    27
    char* signed_text = NULL;
krista@3141
    28
    size_t signed_text_size = 0;
krista@3141
    29
    
krista@3141
    30
    PEP_STATUS status = sign_only(session, msg_text.c_str(), msg_text.size(), alice_fpr, &signed_text, &signed_text_size);
krista@3141
    31
    TEST_ASSERT(status == PEP_STATUS_OK);
krista@3141
    32
    cout << signed_text << endl;
krista@3141
    33
        
krista@3141
    34
    TEST_ASSERT(true);
krista@3141
    35
}