public string CreateEncodedSyn() { ISyn syn = new Syn() { Encrypted = false, PublicKey = _accountService.PublicKey, NetworkAddress = _session.Open(), Id = _id }; _tokenCryptoService.Sign(syn, _accountService.GetPrivateKeyAsByteArray()); return(syn.GetEncodedToken()); }
/// <summary> /// Creates and transmits an ACK in response to a previously processed SYN /// </summary> private void Acknowledge(ISyn syn) { Ack ack = new Ack() { Id = _id, PublicKey = _accountService.PublicKey, Encrypted = true, }; byte[] requesterPubKey = Nethereum.Hex.HexConvertors.Extensions.HexByteConvertorExtensions.HexToByteArray(syn.PublicKey); _tokenCryptoService.Sign(ack, _accountService.GetPrivateKeyAsByteArray()); string encryptedToken = _tokenCryptoService.Encrypt(ack, requesterPubKey, _accountService.GetPrivateKeyAsByteArray()); _session.Open(syn.NetworkAddress); _session.Send(encryptedToken); }