diff --git a/tests/KeyGenTest.cs b/tests/KeyGenTest.cs index 85b9a85..f3ededf 100644 --- a/tests/KeyGenTest.cs +++ b/tests/KeyGenTest.cs @@ -14,8 +14,11 @@ namespace tests [Test] public void TestKeyGen() { - System.Console.Write(chestcrypto.PrivateKeyGenerator.generate().Length); - if (chestcrypto.PrivateKeyGenerator.generate().Length != 96){ + byte[] key = chestcrypto.PrivateKeyGenerator.generate(); + if (key.Length != 96){ + Assert.Fail(); + } + if (key.Equals(chestcrypto.PrivateKeyGenerator.generate())){ Assert.Fail(); } Assert.Pass(); diff --git a/treasurechest/chestcrypto/keygen.cs b/treasurechest/chestcrypto/keygen.cs index 4b5d3de..ff853b0 100644 --- a/treasurechest/chestcrypto/keygen.cs +++ b/treasurechest/chestcrypto/keygen.cs @@ -28,10 +28,13 @@ namespace chestcrypto{ Buffer.BlockCopy(second, 0, bytes, first.Length, second.Length); return bytes; } - public static byte[] generate(){ + public static byte[] generate() + { byte[] ed25519 = Ed25519KeyGenerator.generator(); byte[] curve25519 = Curve25519KeyGenerator.generator(); byte[] key = Combine(ed25519, curve25519); + Array.Clear(ed25519, 0, ed25519.Length); + Array.Clear(curve25519, 0, curve25519.Length); return key; }