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"); Assert.AreEqual(iden2.getNote(), "test");
} }
[Test]
public void TestPrivateIdenToPublic()
{
}
} }
} }

View File

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

View File

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