summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-09-01 13:58:00 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-09-01 14:19:44 +0200
commit63d609985eb7eefa5f2332bfe4fab96f017760a1 (patch)
treead38d0beb698f3bb35bfcedc145c1f7f85a38989 /test/libapt
parent55ae7a516126f9f064d8353bf962256b7307590a (diff)
use unusable-for-security hashes for integrity checks
We want to declare some hashes as not enough for security, so that a user will need --allow-unauthenticated or similar to get data secured only by those hashes, but we can still us these hashes for integrity checks if we got them.
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/hashsums_test.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 63c63ecd3..033493f84 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -306,6 +306,8 @@ TEST(HashSumsTest, HashStringList)
EXPECT_EQ(NULL, list.find(NULL));
EXPECT_EQ(NULL, list.find(""));
EXPECT_EQ(NULL, list.find("MD5Sum"));
+ EXPECT_EQ(NULL, list.find("ROT26"));
+ EXPECT_EQ(NULL, list.find("SHA1"));
EXPECT_EQ(0, list.FileSize());
// empty lists aren't equal
@@ -319,6 +321,18 @@ TEST(HashSumsTest, HashStringList)
EXPECT_FALSE(list.usable());
EXPECT_EQ(1, list.size());
EXPECT_EQ(29, list.FileSize());
+ list.push_back(HashString("MD5Sum", "d41d8cd98f00b204e9800998ecf8427e"));
+ EXPECT_FALSE(list.empty());
+ EXPECT_FALSE(list.usable());
+ EXPECT_EQ(2, list.size());
+ EXPECT_EQ(29, list.FileSize());
+ EXPECT_TRUE(NULL != list.find("MD5Sum"));
+ list.push_back(HashString("SHA1", "cacecbd74968bc90ea3342767e6b94f46ddbcafc"));
+ EXPECT_TRUE(list.usable());
+ EXPECT_EQ(3, list.size());
+ EXPECT_EQ(29, list.FileSize());
+ EXPECT_TRUE(NULL != list.find("MD5Sum"));
+ EXPECT_TRUE(NULL != list.find("SHA1"));
Hashes hashes;
hashes.Add("The quick brown fox jumps over the lazy dog");