mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 23:50:18 -04:00
Changed test project type to WIndows 8.1
Changed test project framework from Nunit to MSTest Changed HashAlgorithm from BouncyCastle to WinRT crypto WIP progress bar in opendatabaseusercontrol TextBox with button made generic WIP implement copy on button click in Entry Page
This commit is contained in:
@@ -1,33 +1,35 @@
|
||||
using NUnit.Framework;
|
||||
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
|
||||
using ModernKeePassLib.Cryptography.KeyDerivation;
|
||||
using ModernKeePassLib.Keys;
|
||||
using ModernKeePassLib.Utility;
|
||||
|
||||
namespace ModernKeePassLib.Test.Keys
|
||||
{
|
||||
[TestFixture ()]
|
||||
public class CompositeKeyTests
|
||||
{
|
||||
[Test]
|
||||
public void TestGenerateKey32 ()
|
||||
[TestClass()]
|
||||
public class CompositeKeyTests
|
||||
{
|
||||
var originalKey = new byte[32];
|
||||
var expectedKey = new byte[32] {
|
||||
0xF0, 0xED, 0x57, 0xD5, 0xF0, 0xDA, 0xF3, 0x47,
|
||||
0x90, 0xD0, 0xDB, 0x43, 0x25, 0xC6, 0x81, 0x2C,
|
||||
0x81, 0x6A, 0x0D, 0x94, 0x96, 0xA9, 0x03, 0xE1,
|
||||
0x20, 0xD4, 0x3A, 0x3E, 0x45, 0xAD, 0x02, 0x65
|
||||
};
|
||||
const ulong rounds = 1;
|
||||
[TestMethod]
|
||||
public void TestGenerateKey32()
|
||||
{
|
||||
var originalKey = new byte[32];
|
||||
var expectedKey = new byte[32]
|
||||
{
|
||||
0xF0, 0xED, 0x57, 0xD5, 0xF0, 0xDA, 0xF3, 0x47,
|
||||
0x90, 0xD0, 0xDB, 0x43, 0x25, 0xC6, 0x81, 0x2C,
|
||||
0x81, 0x6A, 0x0D, 0x94, 0x96, 0xA9, 0x03, 0xE1,
|
||||
0x20, 0xD4, 0x3A, 0x3E, 0x45, 0xAD, 0x02, 0x65
|
||||
};
|
||||
const ulong rounds = 1;
|
||||
|
||||
var composite = new CompositeKey ();
|
||||
AesKdf kdf = new AesKdf();
|
||||
KdfParameters p = kdf.GetDefaultParameters();
|
||||
p.SetUInt64(AesKdf.ParamRounds, rounds);
|
||||
p.SetByteArray(AesKdf.ParamSeed, originalKey);
|
||||
var key = composite.GenerateKey32(p);
|
||||
Assert.That (key, Is.Not.Null);
|
||||
var keyData = key.ReadData ();
|
||||
Assert.That (keyData, Is.EqualTo (expectedKey));
|
||||
var composite = new CompositeKey();
|
||||
AesKdf kdf = new AesKdf();
|
||||
KdfParameters p = kdf.GetDefaultParameters();
|
||||
p.SetUInt64(AesKdf.ParamRounds, rounds);
|
||||
p.SetByteArray(AesKdf.ParamSeed, originalKey);
|
||||
var key = composite.GenerateKey32(p);
|
||||
Assert.IsNotNull(key);
|
||||
var keyData = key.ReadData();
|
||||
Assert.IsTrue(MemUtil.ArraysEqual(keyData, expectedKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user