Ejemplo n.º 1
0
        public async Task <EthECDSASignature> SignAsync(byte[] rawBytes)
        {
            var signature = await SignExternallyAsync(rawBytes);

            if (CalculatesV)
            {
                return(new EthECDSASignature(signature));
            }

            var publicKey = await GetPublicKeyAsync();

            var recId = CfxECKey.CalculateRecId(signature, rawBytes, publicKey);

            signature.V = new[] { (byte)(recId + 27) };
            return(new EthECDSASignature(signature));
        }
Ejemplo n.º 2
0
        public async Task <EthECDSASignature> SignAsync(byte[] rawBytes, BigInteger chainId)
        {
            var signature = await SignExternallyAsync(rawBytes);

            if (CalculatesV)
            {
                return(new EthECDSASignature(signature));
            }

            var publicKey = await GetPublicKeyAsync();

            var recId  = CfxECKey.CalculateRecId(signature, rawBytes, publicKey);
            var vChain = CfxECKey.CalculateV(chainId, recId);

            signature.V = vChain.ToBytesForRLPEncoding();
            return(new EthECDSASignature(signature));
        }