Commit 40f3cb96 authored by Michael Herndon's avatar Michael Herndon

PROTO: fix psake tests command

- exclude test projects in archive
- fix bug in AssembleKey for CompositeKey that didn't properly compute the hash size
  in byte length
parent 3d21e516
......@@ -20,7 +20,8 @@ Task "Build" -depends "restore" {
Task "Test" {
exec {
$projects = Get-Item "$PsScriptRoot\test\**\*Tests.csproj"
$query = "$PsScriptRoot\test\**\*.csproj"
$projects = Get-ChildItem $query -Recurse | Where-Object { !$_.FullName.Contains("Archive")}
foreach($project in $projects)
{
......
......@@ -47,7 +47,7 @@ namespace NerdyMishka
throw new ArgumentOutOfRangeException(nameof(length));
var next = new T[length];
Array.Copy(array, next, length);
Array.Copy(array, next, Math.Min(array.Length, next.Length));
return next;
}
......
......@@ -97,12 +97,13 @@ namespace NerdyMishka.Security.Cryptography
using(var signer = HashAlgorithm.Create(this.options.HashAlgorithm.ToString()))
{
byte[] hashedKey = UnprotectAndConcatData(this, signer);
if (hashedKey == null || hashedKey.Length != signer.HashSize)
if (hashedKey == null || hashedKey.Length != (signer.HashSize / 8))
return null;
// key generator can be swapped out with a native implementation.
key = transform(hashedKey, symmetricKey, this.options.Iterations);
hashedKey.Clear();
var hash = signer.ComputeHash(key);
hashedKey.Clear();
key.Clear();
return hash;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment