v30.3-roots.1 · Commit 28: [PATCH 28/68] fix(wallet): secure asynchronous sweep cancellation
src/test/key_io_tests.cpp
Before: src/test/key_io_tests.cpp · After: src/test/key_io_tests.cpp
File metadata
index 4dd77edc162a674a9090993a32f7c6204492a730..d0be20e8ce5e8fbd2c311c292c285362c7a835be 100644
Download original patch · Release notes
Diff rows 1–16 of 16. Line numbers refer to the original before/after files.
+ Added− RemovedUnmarked lines are context.
Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.
src/test/key_io_tests.cpp
CHANGED
|
@@ -147,4 +147,16 @@ BOOST_AUTO_TEST_CASE(key_io_invalid)
|
|
| 147 |
}
|
| 148 |
}
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
BOOST_AUTO_TEST_SUITE_END()
|
|
|
|
| 147 |
}
|
| 148 |
}
|
| 149 |
|
| 150 |
+
BOOST_AUTO_TEST_CASE(secure_string_private_key_decode)
|
| 151 |
+
{
|
| 152 |
+
SelectParams(ChainType::REGTEST);
|
| 153 |
+
const CKey key{GenerateRandomKey()};
|
| 154 |
+
const std::string encoded{EncodeSecret(key)};
|
| 155 |
+
SecureString secure_encoded{encoded.begin(), encoded.end()};
|
| 156 |
+
BOOST_CHECK(DecodeSecret(secure_encoded) == key);
|
| 157 |
+
|
| 158 |
+
secure_encoded.insert(secure_encoded.begin() + 1, '\0');
|
| 159 |
+
BOOST_CHECK(!DecodeSecret(secure_encoded).IsValid());
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
BOOST_AUTO_TEST_SUITE_END()
|