public void TestAddressRoundtrip() { // Tests encode and decode var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); var a = new cipher__Address(); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); var b = new GoSlice(); err = SKY_cipher_Address_Bytes(a, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_AddressFromBytes(b, a); Assert.AreEqual(err, SKY_OK); var a2 = new cipher__Address(); err = SKY_cipher_AddressFromBytes(b, a2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(a.isEqual(a2), 1); var str = new _GoString_(); var str2 = new _GoString_(); err = SKY_cipher_Address_String(a, str); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_Address_String(a2, str2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(str.p == str2.p, true); }
public void TestAddressFromBytes() { var s = new cipher_SecKey(); var p = new cipher_PubKey(); uint err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); var a = new cipher__Address(); var a2 = new cipher__Address(); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); var b = new GoSlice(); var b2 = new GoSlice(); err = SKY_cipher_Address_Bytes(a, b); err = SKY_cipher_Address_Bytes(a, b2); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_AddressFromBytes(b2, a2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(a2.isEqual(a), 1); // Invalid number of bytes long len_b = b.len; b.len = b.len - 2; err = SKY_cipher_AddressFromBytes(b, a2); Assert.AreEqual(SKY_ErrAddressInvalidLength, err, "Failed SKY_cipher_AddressFromBytes 2"); b.len = len_b; a.setVersion('2'); err = SKY_cipher_Address_Bytes(a, b); Assert.AreEqual(err, SKY_OK, "SKY_cipher_Address_Bytes SKY_ErrAddressInvalidVersion"); err = SKY_cipher_AddressFromBytes(b, a); Assert.AreEqual(SKY_ErrAddressInvalidVersion, err); }
public void TestBitcoinWIPRoundTrio() { var p = new cipher_PubKey(); var seckey1 = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, seckey1); var wip1 = new _GoString_(); SKY_cipher_BitcoinWalletImportFormatFromSeckey(seckey1, wip1); var seckey2 = new skycoin.cipher_SecKey(); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_SecKeyFromBitcoinWalletImportFormat(wip1.p, seckey2); Assert.AreEqual(err, SKY_OK); var wip2 = new _GoString_(); SKY_cipher_BitcoinWalletImportFormatFromSeckey(seckey2, wip2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(seckey1.isEqual(seckey2), 1); var seckey1_hex = new _GoString_(); var seckey2_hex = new _GoString_(); err = SKY_cipher_SecKey_Hex(seckey1, seckey1_hex); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_SecKey_Hex(seckey2, seckey2_hex); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(seckey1_hex.p == seckey2_hex.p, true); Assert.AreEqual(wip1.p == wip2.p, true); }
public void TestBitcoinAddressVerify() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var a = new cipher__BitcoinAddress(); SKY_cipher_GenerateKeyPair(p, s); SKY_cipher_BitcoinAddressFromPubKey(p, a); // Valid pubkey+address var err = SKY_cipher_BitcoinAddress_Verify(a, p); Assert.AreEqual(err, SKY_OK); // Invalid pubkey err = SKY_cipher_BitcoinAddress_Verify(a, new cipher_PubKey()); Assert.AreEqual(err, SKY_ErrAddressInvalidPubKey); var p2 = new cipher_PubKey(); var s2 = new cipher_SecKey(); SKY_cipher_GenerateKeyPair(p2, s2); err = SKY_cipher_BitcoinAddress_Verify(a, p2); Assert.AreEqual(err, SKY_ErrAddressInvalidPubKey); // Bad Version a.Version = 0x01; err = SKY_cipher_BitcoinAddress_Verify(a, p2); Assert.AreEqual(err, SKY_ErrAddressInvalidVersion); }
public void makeTransactionFromUxOut(coin__UxOut ux, cipher_SecKey s, SWIGTYPE_p_Transaction__Handle handle, coin__Transaction ptx) { handle = makeEmptyTransaction(); var h = new cipher_SHA256(); Assert.AreEqual(skycoin.skycoin.SKY_cipher_SecKey_Verify(s), skycoin.skycoin.SKY_OK); var err = skycoin.skycoin.SKY_coin_UxOut_Hash(ux, h); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); var r = new uint(); r = skycoin.skycoin.SKY_coin_Transaction_PushInput(handle, h); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); err = skycoin.skycoin.SKY_coin_Transaction_PushOutput(handle, makeAddress(), (ulong)1e6, 50); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); err = skycoin.skycoin.SKY_coin_Transaction_PushOutput(handle, makeAddress(), (ulong)5e6, 50); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); var seckeys = new cipher_SecKeys(); seckeys.allocate(1); seckeys.setAt(0, s); err = skycoin.skycoin.SKY_coin_Transaction_SignInputs(handle, seckeys); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); err = skycoin.skycoin.SKY_coin_Transaction_UpdateHeader(handle); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); err = skycoin.skycoin.SKY_coin_GetTransactionObject(handle, ptx); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); err = skycoin.skycoin.SKY_coin_Transaction_Verify(handle); Assert.AreEqual(err, skycoin.skycoin.SKY_OK); }
public void TestAddressBulk() { for (int i = 0; i < 1024; i++) { var pub = new cipher_PubKey(); var sec = new cipher_SecKey(); var b = new GoSlice(); var err = SKY_cipher_RandByte(32, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_GenerateDeterministicKeyPair(b, pub, sec); Assert.AreEqual(err, SKY_OK); var a = new cipher__Address(); err = SKY_cipher_AddressFromPubKey(pub, a); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_Address_Verify(a, pub); Assert.AreEqual(err, SKY_OK); var s = new _GoString_(); err = SKY_cipher_Address_String(a, s); Assert.AreEqual(err, SKY_OK); var a2 = new cipher__Address(); err = SKY_cipher_DecodeBase58Address(s.p, a2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(a2.isEqual(a), 1); } }
public void TestCreateUnspents() { var a = new cipher__Address(); var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); var h = new cipher_SHA256(); var txn = new_Transaction__Handlep(); makeEmptyTransaction(txn); err = SKY_coin_Transaction_PushOutput(txn, a, (ulong)11e6, 255); Assert.AreEqual(err, SKY_OK); var bh = new coin__BlockHeader(); bh.Time = 0; bh.BkSeq = 1; var uxouts = new coin_UxOutArray(); err = SKY_coin_CreateUnspents(bh, txn, uxouts); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(uxouts.count, 1); }
public void makeTransaction(SWIGTYPE_p_Transaction__Handle handle, coin__Transaction ptx) { var s = new cipher_SecKey(); var ux = new coin__UxOut(); makeUxOutWithSecret(ux, s); makeTransactionFromUxOut(ux, s, handle, ptx); }
public coin__UxOut makeUxOut() { var uxb = new coin__UxOut(); var s = new cipher_SecKey(); makeUxOutWithSecret(uxb, s); return(uxb); }
public void TestPubKeyVerifyDefault1() { // Generated pub key should be valid var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK); }
public void TestGenerateKeyPair() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_SecKey_Verify(s); Assert.AreEqual(err, SKY_OK); }
public cipher__Address makeAddress() { var pubkey = new cipher_PubKey(); var seckey = new cipher_SecKey(); var addr = new cipher__Address(); var result = skycoin.skycoin.SKY_cipher_GenerateKeyPair(pubkey, seckey); Assert.AreEqual(result, skycoin.skycoin.SKY_OK); result = skycoin.skycoin.SKY_cipher_AddressFromPubKey(pubkey, addr); return(addr); }
public void TestPubKeyVerifyDefault2() { for (int i = 0; i < 1024; i++) { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK); } }
public void makeUxOutWithSecret(coin__UxOut uxOut, cipher_SecKey secKey) { var uxBody = new coin__UxBody(); makeUxBodyWithSecret(uxBody, secKey); uxOut = new coin__UxOut(); var uxHead = new coin__UxHead(); uxHead.Time = 100; uxHead.BkSeq = 2; uxOut.Body = uxBody; uxOut.Head = uxHead; }
public void TestBitcoinAddressNull() { var a = new cipher__BitcoinAddress(); Assert.IsTrue(Convert.ToBoolean(SKY_cipher_BitcoinAddress_Null(a))); var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); SKY_cipher_BitcoinAddressFromPubKey(p, a); Assert.IsFalse(Convert.ToBoolean(SKY_cipher_BitcoinAddress_Null(a))); }
public void TestAddressNull() { var a = new cipher__Address(); Assert.AreEqual(a.isEqual(new cipher__Address()), 1); var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(a.isEqual(new cipher__Address()), 0); }
public void TestPubKeyFromSecKey() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var err = SKY_cipher_GenerateKeyPair(p, s); var p1 = new cipher_PubKey(); err = SKY_cipher_PubKeyFromSecKey(s, p1); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(p1.isEqual(p), 1); s = new cipher_SecKey(); err = SKY_cipher_PubKeyFromSecKey(s, p); Assert.AreEqual(err, SKY_ErrPubKeyFromNullSecKey); }
public void TestSecKeyVerify() { // Empty secret key should not be valid var s = new cipher_SecKey(); var err = SKY_cipher_SecKey_Verify(s); Assert.AreEqual(err, SKY_ErrInvalidSecKey); // Generated sec key should be valid var p = new cipher_PubKey(); s = new cipher_SecKey(); err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(SKY_cipher_SecKey_Verify(s), SKY_OK); }
public void TestNewPubKey() { var b = new GoSlice(); var p = new cipher_PubKey(); var err = SKY_cipher_RandByte(31, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); b = new GoSlice(); err = SKY_cipher_RandByte(32, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); b = new GoSlice(); err = SKY_cipher_RandByte(34, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); b = new GoSlice(); err = SKY_cipher_RandByte(0, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); b = new GoSlice(); err = SKY_cipher_RandByte(100, b); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); b = new GoSlice(); p = new cipher_PubKey(); err = SKY_cipher_NewPubKey(b, p); Assert.AreEqual(err, SKY_ErrInvalidLengthPubKey); var s = new cipher_SecKey(); var pTemp = new GoSlice(); err = SKY_cipher_GenerateKeyPair(p, s); pTemp = p.toSlice(); Assert.AreEqual(err, SKY_OK); var p2 = new cipher_PubKey(); err = SKY_cipher_NewPubKey(pTemp, p2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(p.isEqual(p2), 1); }
public void TestDecodeBase58Address() { uint err = 0; var s = new cipher_SecKey(); var p = new cipher_PubKey(); Assert.AreEqual(SKY_cipher_GenerateKeyPair(p, s), SKY_OK, "Failed SKY_cipher_GenerateKeyPair"); err = SKY_cipher_SecKey_Verify(s); Assert.AreEqual(err, SKY_OK, "Failed SKY_cipher_SecKey_Verify "); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK, "Failed SKY_cipher_PubKey_Verify"); var a = new cipher__Address(); var a1 = new cipher__Address(); var a2 = new cipher__Address(); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK, "Failed SKY_cipher_AddressFromPubKey"); Assert.AreEqual(err, SKY_OK, "Failed SKY_cipher_AddressFromPubKey"); err = SKY_cipher_Address_Verify(a, p); Assert.AreEqual(err, SKY_OK, " Failed SKY_cipher_Address_Verify"); err = SKY_cipher_DecodeBase58Address("", a1); Assert.AreEqual(err, SKY_ERROR, "Failed SKY_cipher_DecodeBase58Address 1"); err = SKY_cipher_DecodeBase58Address("asa", a1); Assert.AreEqual(err, SKY_ErrAddressInvalidLength, "Failed SKY_cipher_DecodeBase58Address 2"); var addrStr = new _GoString_(); err = SKY_cipher_Address_String(a, addrStr); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_DecodeBase58Address(addrStr.p, a2); Assert.AreEqual(err, SKY_OK, "Failed SKY_cipher_DecodeBase58Address"); Assert.IsTrue(a.isEqual(a2) == 1); var as2 = " " + addrStr.p; err = SKY_cipher_DecodeBase58Address(as2, a1); Assert.AreEqual(err, SKY_ERROR, "Failed SKY_cipher_DecodeBase58Address 31"); as2 = "000" + addrStr.p; err = SKY_cipher_DecodeBase58Address(as2, a1); Assert.AreEqual(err, SKY_ERROR, "Failed SKY_cipher_DecodeBase58Address 3"); as2 = addrStr.p + "000"; err = SKY_cipher_DecodeBase58Address(as2, a1); Assert.AreEqual(err, SKY_ERROR, "Failed SKY_cipher_DecodeBase58Address 30"); }
public void TestCreateUnspent() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var a = new cipher__Address(); var err = SKY_cipher_GenerateKeyPair(p, s); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); var h = new cipher_SHA256(); var handle = new_Transaction__Handlep(); makeEmptyTransaction(handle); err = SKY_coin_Transaction_PushOutput(handle, a, 11000000, 255); Assert.AreEqual(err, SKY_OK); var bh = new coin__BlockHeader(); bh.Time = 0; bh.BkSeq = 1; testcase[] t = new testcase[2]; var tc = new testcase(); tc.index = 0; tc.failure = SKY_OK; t[0] = tc; tc = new testcase(); tc.failure = SKY_ERROR; tc.index = 10; t[1] = tc; var ux = new coin__UxOut(); var tests_count = t.Length; for (int i = 0; i < tests_count; i++) { err = SKY_coin_CreateUnspent(bh, handle, t[i].index, ux); if (t[i].failure == SKY_ERROR) { continue; } Assert.AreEqual(bh.Time, ux.Head.Time); Assert.AreEqual(bh.BkSeq, ux.Head.BkSeq); } }
public void TestBitcoinAddressFromSecKey() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var a = new cipher__BitcoinAddress(); var a2 = new cipher__BitcoinAddress(); SKY_cipher_GenerateKeyPair(p, s); var err = SKY_cipher_BitcoinAddressFromSecKey(s, a); Assert.AreEqual(err, SKY_OK); // Valid pubkey+address err = SKY_cipher_BitcoinAddress_Verify(a, p); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_BitcoinAddressFromSecKey(new cipher_SecKey(), a2); Assert.AreEqual(err, SKY_ErrPubKeyFromNullSecKey); }
public void TestPubKeyToAddress() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var addr = new cipher__Address(); var addr1 = new cipher__Address(); var err = SKY_cipher_GenerateKeyPair(p, s); err = SKY_cipher_AddressFromPubKey(p, addr); err = SKY_cipher_Address_Verify(addr, p); Assert.AreEqual(err, SKY_OK); var addrStr = new _GoString_(); err = SKY_cipher_Address_String(addr, addrStr); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_DecodeBase58Address(addrStr.p, addr1); Assert.AreEqual(err, SKY_OK); }
public void makeUxBodyWithSecret(coin__UxBody uxBody, cipher_SecKey secKey) { var p = new cipher_PubKey(); skycoin.skycoin.SKY_cipher_GenerateKeyPair(p, secKey); var b = new GoSlice(); skycoin.skycoin.SKY_cipher_RandByte(128, b); var h = new cipher_SHA256(); skycoin.skycoin.SKY_cipher_SumSHA256(b, h); uxBody.SetSrcTransaction(h); var a = new cipher__Address(); skycoin.skycoin.SKY_cipher_AddressFromPubKey(p, a); uxBody.Address = a; uxBody.Coins = (ulong)(1e6); uxBody.Hours = 100; }
public void TestECDHonce() { var pub1 = new cipher_PubKey(); var pub2 = new cipher_PubKey(); var sec1 = new cipher_SecKey(); var sec2 = new cipher_SecKey(); var buf1 = new GoSlice(); var buf2 = new GoSlice(); var err = SKY_cipher_GenerateKeyPair(pub1, sec1); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_GenerateKeyPair(pub2, sec2); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_ECDH(pub2, sec1, buf1); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_ECDH(pub1, sec2, buf2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(buf1.isEqual(buf2), 1); }
public void TestSignHash() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var a = new cipher__Address(); SKY_cipher_GenerateKeyPair(p, s); var err = SKY_cipher_AddressFromPubKey(p, a); Assert.AreEqual(err, SKY_OK); var b_temp = new GoSlice(); SKY_cipher_RandByte(256, b_temp); var h = new cipher_SHA256(); SKY_cipher_SumSHA256(b_temp, h); var sig = new cipher_Sig(); SKY_cipher_SignHash(h, s, sig); Assert.AreEqual(sig.isEqual(new cipher_Sig()), 0); }
public void TestTransactionVerifyInput() { // Valid var uxOut = new coin__UxOut(); var seckey = new cipher_SecKey(); var result = (uint)makeUxOutWithSecret(uxOut, seckey); Assert.AreEqual(result, SKY_OK); var handle = new_Transaction__Handlep(); makeEmptyTransaction(handle); var ptx = makeTransactionFromUxOut(uxOut, seckey, handle); Assert.AreEqual(result, SKY_OK); var ux = new coin_UxOutArray(); ux.allocate(0); ux.append(uxOut); result = SKY_coin_VerifyInputSignatures(handle, ux); Assert.AreEqual(result, SKY_OK); }
public void TestNewGenesisBlock() { var pubkey = new cipher_PubKey(); var seckey = new cipher_SecKey(); ulong genTime = 1000; ulong genCoins = (ulong)1000e6; var err = SKY_cipher_GenerateKeyPair(pubkey, seckey); Assert.AreEqual(err, SKY_OK); var addr = new cipher__Address(); err = SKY_cipher_AddressFromPubKey(pubkey, addr); Assert.AreEqual(err, SKY_OK); var block = new_Block__HandlePtr(); err = SKY_coin_NewGenesisBlock(addr, genCoins, genTime, block); Assert.AreEqual(err, SKY_OK); var pBlockPP = new_coin__BlockPtr(); err = SKY_coin_GetBlockObject(block, pBlockPP); var pBlock = coin__BlockPtr_value(pBlockPP); Assert.AreEqual(err, SKY_OK); var nullHash = new cipher_SHA256(); var Head = new GoSlice(); err = SKY_coin_BlockHeader_Bytes(pBlock.Head, Head); Assert.AreEqual(err, SKY_OK); var strnullHash = nullHash.getStr(); var strHead = new _GoString_(); Head.getString(strHead); Assert.AreEqual(strnullHash.p, strHead.p); Assert.AreEqual(genTime, pBlock.Head.Time); Assert.AreEqual(0, pBlock.Head.BkSeq); Assert.AreEqual(0, pBlock.Head.Version); Assert.AreEqual(0, pBlock.Head.Fee); }
public void TestPubKeyFromSig() { var p = new cipher_PubKey(); var s = new cipher_SecKey(); var b = new GoSlice(); var h = new cipher_SHA256(); var err = SKY_cipher_GenerateKeyPair(p, s); err = SKY_cipher_RandByte(256, b); err = SKY_cipher_SumSHA256(b, h); var sig = new cipher_Sig(); err = SKY_cipher_SignHash(h, s, sig); var p2 = new cipher_PubKey(); err = SKY_cipher_PubKeyFromSig(sig, h, p2); Assert.AreEqual(err, SKY_OK); Assert.AreEqual(p2.isEqual(p), 1); p2 = new cipher_PubKey(); err = SKY_cipher_PubKeyFromSig(new cipher_Sig(), h, p2); Assert.AreEqual(err, SKY_ErrInvalidSigPubKeyRecovery); }
public void TestGenerateDeterministicKeyPair() { // TODO -- deterministic key pairs are useless as is because we can't // generate pair n+1, only pair 0 var seed = new GoSlice(); var err = SKY_cipher_RandByte(32, seed); var p = new cipher_PubKey(); var s = new cipher_SecKey(); err = SKY_cipher_GenerateDeterministicKeyPair(seed, p, s); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_SecKey_Verify(s); Assert.AreEqual(err, SKY_OK); p = new cipher_PubKey(); s = new cipher_SecKey(); err = SKY_cipher_GenerateDeterministicKeyPair(seed, p, s); err = SKY_cipher_PubKey_Verify(p); Assert.AreEqual(err, SKY_OK); err = SKY_cipher_SecKey_Verify(s); Assert.AreEqual(err, SKY_OK); }