Replace dcp::Data with dcp::ArrayData
[dcpomatic.git] / test / crypto_test.cc
index 576a6ebc6bdbb28772ebe940ecb82a1dfd941e5d..26c6748b8bd453bc8a2f472d267469c58d3be03b 100644 (file)
 
 using std::string;
 using std::list;
-using boost::shared_array;
 
 BOOST_AUTO_TEST_CASE (crypto_test)
 {
-       shared_array<unsigned char> key (new unsigned char[dcpomatic::crypto_key_length()]);
-       shared_array<unsigned char> 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);
+       dcp::ArrayData 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);
 }