mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2024-12-13 18:06:24 +00:00
6fc77e2f7a
* Doc refactoring * Updated changelog and cleaned up legacy scripts. * Marked 3rd party modules as vendored * Fixed a couple non-passing unit tests
64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using DSInternals.Common;
|
|
using DSInternals.DataStore;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using System;
|
|
using System.IO;
|
|
using System.Security;
|
|
using System.Text;
|
|
|
|
namespace DSInternals.DataStore.Test
|
|
{
|
|
[TestClass]
|
|
public class BootKeyRetrieverTester
|
|
{
|
|
[TestMethod]
|
|
public void BootKeyRetriever_Hive1()
|
|
{
|
|
throw new AssertInconclusiveException("There are no test registry hives available yet.");
|
|
}
|
|
[TestMethod]
|
|
[ExpectedException(typeof(FileNotFoundException))]
|
|
public void BootKeyRetriever_NonExistingFile()
|
|
{
|
|
BootKeyRetriever.GetBootKey(@"C:\xxxxxx");
|
|
}
|
|
[TestMethod]
|
|
[ExpectedException(typeof(ArgumentNullException))]
|
|
public void BootKeyRetriever_NullFile()
|
|
{
|
|
BootKeyRetriever.GetBootKey(null);
|
|
}
|
|
[TestMethod]
|
|
public void BootKeyRetriever_NotRegistryHiveFile()
|
|
{
|
|
throw new AssertInconclusiveException();
|
|
}
|
|
[TestMethod]
|
|
public void BootKeyRetriever_NotSystemHiveFile()
|
|
{
|
|
throw new AssertInconclusiveException();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void BootKeyRetriever_Online()
|
|
{
|
|
byte[] bootKey = BootKeyRetriever.GetBootKey();
|
|
// Just test that the key has 16B.
|
|
Assert.AreEqual(BootKeyRetriever.BootKeyLength, bootKey.Length);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void BootKeyRetriever_LDS()
|
|
{
|
|
// AD LDS/ADAM
|
|
byte[] rootObjectPekList = "e2b95102f97b7528a7e2477a2406438f97974fabd412be91aca18a2c241d513482a51553d3f28b26".HexToBinary();
|
|
byte[] schemaNCPekList = "cb6ef0da6e2069f735b8211ee6071fb206ba4ade0d048e4b279decdc174747bb55ee46a321796c8a".HexToBinary();
|
|
|
|
byte[] bootKey = BootKeyRetriever.GetBootKey(rootObjectPekList, schemaNCPekList);
|
|
string expected = "51f9a1e2282c7b7a79f0ba210d1e8ef7";
|
|
|
|
Assert.AreEqual(expected, bootKey.ToHex(false));
|
|
}
|
|
}
|
|
}
|