Skip to content

Commit

Permalink
Test if exported key BLOB can be re-imported
Browse files Browse the repository at this point in the history
  • Loading branch information
ektrah committed Nov 13, 2021
1 parent 7ce1017 commit 91895e1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Formatting/NSecTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ private static void Test(Algorithm a, int seedSize, KeyBlobFormat importFormat,
Assert.Equal(blobHeader, blob.AsSpan(0, blobHeader.Length).ToArray());
Assert.Equal(keySize, BitConverter.ToInt16(blob, blobHeader.Length));
Assert.Equal(outputSize, BitConverter.ToInt16(blob, blobHeader.Length + sizeof(short)));

if (format < 0)
{
Assert.True(Key.TryImport(a, blob, format, out var k2));
Assert.NotNull(k2);
k2!.Dispose();
}
else
{
Assert.True(PublicKey.TryImport(a, blob, format, out var p));
Assert.NotNull(p);
Assert.Equal(k.PublicKey, p);
}
}

[Fact]
Expand Down

0 comments on commit 91895e1

Please sign in to comment.