added public identity test
This commit is contained in:
parent
77db2af0e6
commit
95dd1116d1
@ -52,12 +52,6 @@ namespace PrivateIndentityTest
|
|||||||
Assert.AreEqual(iden2.getNote(), "test");
|
Assert.AreEqual(iden2.getNote(), "test");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestPrivateIdenToPublic()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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;}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user