public RLPSigner(byte[][] data, byte[] r, byte[] s, byte[] v, int numberOfEncodingElements)
 {
     this.numberOfEncodingElements = numberOfEncodingElements;
     this.data = data;
     signature = EthECDSASignatureFactory.FromComponents(r, s, v);
     decoded   = true;
 }
Ejemplo n.º 2
0
 public bool VerifyAllowingOnlyLowS(byte[] hash, EthECDSASignature sig)
 {
     if (!sig.IsLowS)
     {
         return(false);
     }
     return(_ecKey.Verify(hash, sig.ECDSASignature));
 }
Ejemplo n.º 3
0
 public void RlpDecode()
 {
   var decodedList = RLP.RLP.Decode(GetRLPEncoded());
   var decodedData = new List\\();
   var decodedElements = (RLPCollection)decodedList[0];
   for (var i = 0; i \        decodedData.Add(decodedElements[i].RLPData);
   // only parse signature in case is signed
   if (decodedElements[numberOfEncodingElements].RLPData != null)
   {
     //Decode Signature
     var v = decodedElements[numberOfEncodingElements].RLPData;
     var r = decodedElements[numberOfEncodingElements + 1].RLPData;
     var s = decodedElements[numberOfEncodingElements + 2].RLPData;
     signature = EthECDSASignatureFactory.FromComponents(r, s, v);
   }
   data = decodedData.ToArray();
   decoded = true;
 }
Ejemplo n.º 4
0
 public bool Verify(byte[] hash, EthECDSASignature sig)
 {
   return _ecKey.Verify(hash, sig.ECDSASignature);
 }
Ejemplo n.º 5
0
 public static EthECKey RecoverFromSignature(EthECDSASignature signature, byte[] hash, BigInteger chainId)
 {
   return new EthECKey(ECKey.RecoverFromSignature(GetRecIdFromVChain(signature.V, chainId),
       signature.ECDSASignature, hash, false));
 }
Ejemplo n.º 6
0
 public static EthECKey RecoverFromSignature(EthECDSASignature signature, int recId, byte[] hash)
 {
   return new EthECKey(ECKey.RecoverFromSignature(recId, signature.ECDSASignature, hash, false));
 }
Ejemplo n.º 7
0
 public static EthECKey RecoverFromSignature(EthECDSASignature signature, byte[] hash)
 {
   return new EthECKey(ECKey.RecoverFromSignature(GetRecIdFromV(signature.V), signature.ECDSASignature, hash,
       false));
 }
 public void Sign(EthECKey key, BigInteger chainId)
 {
     signature  = key.SignAndCalculateV(RawHash, chainId);
     rlpEncoded = null;
 }
 public void Sign(EthECKey key)
 {
     signature  = key.SignAndCalculateV(RawHash);
     rlpEncoded = null;
 }