Exemplo n.º 1
0
        // We need to handle this message carefully like how about decoding a random message with random length
        // and the value of 'share.ShareId' needs to be checked. If it is out of range, it can throw exception
        private void HandleDecryptedMessage(TPKEPartiallyDecryptedShareMessage msg, int senderId)
        {
            PartiallyDecryptedShare?share = null;

            try
            {
                // Converting any random bytes to G1 is not possible
                share = Wallet.TpkePublicKey.Decode(msg);
                _decryptedShares[share.ShareId].Add(share);
            }
            catch (Exception exception)
            {
                var pubKey = Broadcaster.GetPublicKeyById(senderId) !.ToHex();
                Logger.LogWarning($"Exception occured handling Decrypted message: {msg} from {senderId} ({pubKey})");
            }

            if (!(share is null))
            {
                CheckDecryptedShares(share.ShareId);
            }
        }
Exemplo n.º 2
0
        public PartiallyDecryptedShare Decode(TPKEPartiallyDecryptedShareMessage message)
        {
            var u = G1.FromBytes(message.Share.ToByteArray());

            return(new PartiallyDecryptedShare(u, message.DecryptorId, message.ShareId));
        }