18 #include <boost/test/unit_test.hpp> 30 BOOST_AUTO_TEST_SUITE(Crypto)
36 cnote <<
"AesDecrypt";
37 bytes seed =
fromHex(
"2dbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621");
44 cnote <<
"AesDecryptWrongSeed";
45 bytes seed =
fromHex(
"badaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621");
52 cnote <<
"AesDecryptWrongPassword";
53 bytes seed =
fromHex(
"2dbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621");
60 cnote <<
"AesDecryptFailInvalidSeed";
61 bytes seed =
fromHex(
"xdbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621");
67 cnote <<
"AesDecryptFailInvalidSeedSize";
68 bytes seed =
fromHex(
"000102030405060708090a0b0c0d0e0f");
74 cnote <<
"AesDecryptFailInvalidSeed2";
75 bytes seed =
fromHex(
"000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f");
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Simple class that represents a "key pair".
BOOST_AUTO_TEST_CASE(AesDecrypt)
h160 Address
An Ethereum address: 20 bytes.
SecureFixedHash< 32 > sha3Secure(bytesConstRef _input)
std::hash for asio::adress
bytes fromHex(std::string const &_s, WhenError _throw=WhenError::DontThrow)
std::vector< byte > bytes
AES block cipher (Rijndael)
Address const & address() const
Retrieve the associated address of the public key.
#define BOOST_FIXTURE_TEST_SUITE(a, b)
bytes aesDecrypt(bytesConstRef _cipher, std::string const &_password, unsigned _rounds=2000, bytesConstRef _salt=bytesConstRef())
#define BOOST_AUTO_TEST_SUITE_END()
Helper functions to work with json::spirit and test files.
#define BOOST_CHECK(expr)