/// <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); }
/// <summary> /// JSON-Encodes and sends attributes and attribute contents to the verifier for certification /// </summary> protected virtual void GenerateAndSendSynAck(Ack ack) { SynAck synAck = new SynAck() { Id = _id, PublicKey = _accountService.PublicKey, Encrypted = true, AccessibleAttributes = _accessibleAttributes }; byte[] requesterPubKey = Nethereum.Hex.HexConvertors.Extensions.HexByteConvertorExtensions.HexToByteArray(ack.PublicKey); _tokenCryptoService.Sign(synAck, _accountService.GetPrivateKeyAsByteArray()); string encryptedToken = _tokenCryptoService.Encrypt(synAck, requesterPubKey, _accountService.GetPrivateKeyAsByteArray()); _session.Send(encryptedToken); }