Exemple #1
0
TEST(Encryption, Simple) {
  std::string text1("abcdef");
  std::string text2;
  for (int i = 0; i < 200; i++) {
    text2.push_back(i);
  }
  testEncryption(ENC_AES128_CTR, text1);
  testEncryption(ENC_AES128_CTR, text2);
  testEncryption(ENC_AES128_OFB, text1);
  testEncryption(ENC_AES128_OFB, text2);
}
Exemple #2
0
// TODO: uh... this is really a super basic/not great test (better than
// nothing but barely)
TEST(Encryption, SuperBasic) {
  std::string text1("abcdef");
  text1.push_back('\0');  // let's have some binary in there
  text1.append("89");     // even number and small (9)
  std::string text2;
  for (int i = 0; i < 274; i++) {
    text2.push_back(i);  // will wrap and bigger than 256
  }
  std::string text3 = text2;
  for (int i = ENC_NONE + 1; i < NUM_ENC_TYPES; ++i) {
    EncryptionType t = static_cast<EncryptionType>(i);
    testEncryption(t, text1);
    testEncryption(t, text2);
    EXPECT_EQ(text2, text3);  // paranoia
  }
}
Exemple #3
0
void runTests()
{
//    //testEncryption();
//    testRandom();
//    testSQL();
//    testKeyStorage();
    testHash();
    testEncryption();
//    testSQL();


    testData();
//    log("Test: %d", 54);
//    log("Test: %d", 53);


//    json_error_t error;
//    json_t *root = json_loads("aaa", 0, &error);

//    CURL *curl;
//    CURLcode res;

//    curl = curl_easy_init();
//    if(curl) {
//        curl_easy_setopt(curl, CURLOPT_URL, "http://4enjoy.com");
//        /* example.com is redirected, so we tell libcurl to follow redirection */
//        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

//        /* Perform the request, res will get the return code */
//        res = curl_easy_perform(curl);
//        /* Check for errors */
//        if(res == CURLE_OK)
//        {
//            //std::cout << res;
//        }
//        //std::cout << res;
//        /* always cleanup */
//        curl_easy_cleanup(curl);
//    }
}