finished basic keygen

This commit is contained in:
Kevin Froman 2020-05-08 20:00:42 -05:00
parent b2fda499bd
commit 989078b6cb
2 changed files with 9 additions and 3 deletions

View File

@ -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();

View File

@ -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;
}