2016-02-10 00:58:03 +01:00
|
|
|
#include <gtest/gtest.h>
|
2016-02-11 12:04:49 +01:00
|
|
|
#include "../../../../src/cpp-utils/crypto/kdf/DerivedKey.h"
|
|
|
|
#include "../../../../src/cpp-utils/data/DataFixture.h"
|
2015-10-27 22:19:06 +01:00
|
|
|
|
2015-10-27 23:19:11 +01:00
|
|
|
using namespace cpputils;
|
2015-10-27 22:19:06 +01:00
|
|
|
|
|
|
|
TEST(DerivedKeyTest, Config) {
|
|
|
|
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));
|
|
|
|
EXPECT_EQ(DataFixture::generate(32, 1), key.config().salt());
|
2016-02-11 12:04:49 +01:00
|
|
|
EXPECT_EQ(1024u, key.config().N());
|
|
|
|
EXPECT_EQ(8u, key.config().r());
|
|
|
|
EXPECT_EQ(16u, key.config().p());
|
2015-10-27 22:19:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST(DerivedKeyTest, Key) {
|
|
|
|
DerivedKey<32> key(DerivedKeyConfig(DataFixture::generate(32, 1), 1024, 8, 16), DataFixture::generateFixedSize<32>(2));
|
|
|
|
EXPECT_EQ(DataFixture::generateFixedSize<32>(2), key.key());
|
|
|
|
}
|