added public identity test

This commit is contained in:
Kevin Froman 2020-06-04 03:32:23 -05:00
parent 77db2af0e6
commit 95dd1116d1
3 changed files with 8 additions and 23 deletions

View File

@ -52,12 +52,6 @@ namespace PrivateIndentityTest
Assert.AreEqual(iden2.getNote(), "test");
}
[Test]
public void TestPrivateIdenToPublic()
{
}
}
}

View File

@ -5,7 +5,7 @@ using System;
using System.Linq;
using Sodium;
namespace PrivateIndentityTest
namespace PublicIndentityTest
{
public class Tests
{
@ -15,19 +15,15 @@ namespace PrivateIndentityTest
}
[Test]
public void TestPrivateIdentityGetDoublePrivateKey(){
byte[] signingKey = PublicKeyAuth.GenerateKeyPair().PrivateKey;
byte[] encryptionKey = PublicKeyBox.GenerateKeyPair().PrivateKey;
public void TestPublicIdentityGetDoublePublicIdentity(){
byte[] signingKey = PublicKeyAuth.GenerateKeyPair().PublicKey;
byte[] encryptionKey = PublicKeyBox.GenerateKeyPair().PublicKey;
byte[] combinedKey = new byte[signingKey.Length + encryptionKey.Length];
Buffer.BlockCopy(signingKey, 0, combinedKey, 0, signingKey.Length);
Buffer.BlockCopy(encryptionKey, 0, combinedKey, signingKey.Length, encryptionKey.Length);
DoublePrivateKey combinedLoad = new chestcrypto.DoublePrivateKey(combinedKey);
PrivateIdentity iden = new PrivateIdentity(combinedLoad, "Picard");
Assert.IsTrue(Enumerable.SequenceEqual(iden.getPrivateKey().getRawDouble(), combinedLoad.getRawDouble()));
DoublePublicKey doubleKey = new DoublePublicKey(combinedKey);
PublicIdentity iden = new PublicIdentity(doubleKey, "Picard");
Assert.IsTrue(Enumerable.SequenceEqual(iden.getPublicKey().getRawDouble(), combinedKey));
}
@ -52,11 +48,6 @@ namespace PrivateIndentityTest
Assert.AreEqual(iden2.getNote(), "test");
}
[Test]
public void TestPrivateIdenToPublic()
{
}
}

View File

@ -24,7 +24,7 @@ namespace chestcrypto.identity
comment = note;
}
public DoublePublicKey getPrivateKey(){return key;}
public DoublePublicKey getPublicKey(){return key;}
public string getName(){return name;}
public string getNote(){return comment;}