protected async Task ProcessAck(string encryptedToken) { Ack ack = await base.DecryptAndInstantiateHandshakeToken <Ack>(encryptedToken); VerifyHandshakeTokenIDOwnership(ack); if (_tokenCryptoService.VerifySignature(ack)) { Ack = ack; GenerateAndSendSynAck(ack); } else { throw new SignatureDoesntMatchException("The signature was not " + "generated by the given " + "public Key"); } }
public async Task ProcessSyn(string synString) { HandshakeTokenFactory <Syn> synFactory = new HandshakeTokenFactory <Syn>(_idFacade); Syn syn = await synFactory.CreateHandshakeTokenAsync(synString); byte[] pubK = Nethereum.Hex.HexConvertors.Extensions.HexByteConvertorExtensions.HexToByteArray(syn.PublicKey); VerifyHandshakeTokenIDOwnership(syn); if (_tokenCryptoService.VerifySignature(syn)) { _syn = syn; Acknowledge(_syn); } else { throw new SignatureDoesntMatchException("The signature was not " + "generated by the given " + "public Key"); } }