X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=test%2Fcrypto_test.cc;h=53451b352360b2d3ec386b97822d9bf214ccbe16;hb=d2929a5dea6639f1896fb69929a4913e3d4f4fb5;hp=576a6ebc6bdbb28772ebe940ecb82a1dfd941e5d;hpb=5ab0c3bc04e4aa5acd883bb8126fc6b185c6c5d6;p=dcpomatic.git diff --git a/test/crypto_test.cc b/test/crypto_test.cc index 576a6ebc6..53451b352 100644 --- a/test/crypto_test.cc +++ b/test/crypto_test.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2018 Carl Hetherington + Copyright (C) 2018-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,27 +18,30 @@ */ + #include "lib/crypto.h" #include "lib/exceptions.h" #include "test.h" #include #include + using std::string; using std::list; -using boost::shared_array; + BOOST_AUTO_TEST_CASE (crypto_test) { - shared_array key (new unsigned char[dcpomatic::crypto_key_length()]); - shared_array iv = dcpomatic::random_iv (); + dcp::ArrayData key (dcpomatic::crypto_key_length()); + dcp::ArrayData iv = dcpomatic::random_iv (); - RAND_bytes (key.get(), dcpomatic::crypto_key_length()); + RAND_bytes (key.data(), dcpomatic::crypto_key_length()); - dcp::Data ciphertext = dcpomatic::encrypt ("Can you see any fish?", key, iv); + auto ciphertext = dcpomatic::encrypt ("Can you see any fish?", key, iv); BOOST_REQUIRE_EQUAL (dcpomatic::decrypt (ciphertext, key, iv), "Can you see any fish?"); - key[5]++; + key.data()[5]++; + key.data()[6]++; BOOST_REQUIRE_THROW (dcpomatic::decrypt (ciphertext, key, iv), CryptoError); }