public void TestMethod1() { AesFileEncryptionPrivider.Create("hamed"); var key1 = new KeyContainer(); var key2 = new KeyContainer(); key1.ExportPrivateKey("key.dat"); var t1 = new Transaction(1, key1.PublicKeyS, key2.PublicKeyS, 15.5, 0, Guid.NewGuid().ToString().GetHashString()); t1.GenerateSignture("key.dat"); Assert.IsTrue(t1.IsSignatureVerified); key2.ExportPrivateKey("key.dat"); t1.GenerateSignture("key.dat"); Assert.IsFalse(t1.IsSignatureVerified); key1.Dispose(); key2.Dispose(); }
public void TransactionTest1() { Init.Initizer("Xunit", () => "Xunit"); var key1 = new KeyContainer(); var key2 = new KeyContainer(); key1.ExportPrivateKey("key.dat"); DataUtilities.Principles.TryAdd((DataUtilities.Version).GetPrinciplesKey(Principles.PrinciplesType.Transaction), new Galleon.Principles.TransactionPrinciples(1, "hi", "short", 1000, 1)); var t1 = new Galleon.ContractManager.TransactionManager.Transaction(DataUtilities.Version, key1.PublicKeyS, key2.PublicKeyS, 15.5, 0, Guid.NewGuid().ToString().GetHashString(HashAlgorithms.SHA256)); t1.GenerateSignture("key.dat"); Assert.True(t1.IsSignatureVerified); key2.ExportPrivateKey("key.dat"); t1.GenerateSignture("key.dat"); Assert.False(t1.IsSignatureVerified); key1.Dispose(); key2.Dispose(); }