public static bool VerifySignature(scriptSig scriptSig, string strOpScript, string strOriginalTxt) { // string strDecodeTxt = rsaPubDecrySign(strSignature, strPubKey, false); // return string.Equals(strDecodeTxt, strOriginalTxt); string strDecodeTxt = string.Empty; Operation Oper = new Operation(scriptSig, strOpScript); bool bRet = Oper.RunScript(ref strDecodeTxt); if (bRet) { if (string.Equals(strDecodeTxt, strOriginalTxt)) { return(true); } else { return(false); } } else { return(false); } }
public void addSignature(scriptSig Sig) { if (this.ScriptSig == null) { ScriptSig = new scriptSig(); } this.ScriptSig = Sig; }
public void MultiSignTrans(string strmyPriKeyPath, string strmyPubkeyValue, int InputIndex) { string strRawdata = this.getRawDataToSign(InputIndex); scriptSig tempScriptSig = new scriptSig(); tempScriptSig.Signature = Cryptor.rsaPriSign(strRawdata, strmyPriKeyPath); tempScriptSig.PubKey = strmyPubkeyValue; listInputs[InputIndex].addMutiSignTolst(tempScriptSig); }
public Operation(scriptSig inputSig, string outputScript) { this.staData = new Stack <string>(); this.AddData(inputSig.Signature); this.AddData(inputSig.PubKey); this.lstPubOperate = new List <string>(); this.lstPubOperate = this.PubScri2list(outputScript); }
public void addMutiSignTolst(scriptSig Sig) { if (this.lstScriptSig == null) { this.lstScriptSig = new List <scriptSig>(); } if (!this.lstScriptSig.Contains(Sig)) { this.lstScriptSig.Add(Sig); } }
public void signTrans(string strmyPriKeyPath, string strmyPubkeyValue, int InputIndex) { string strRawdata = this.getRawDataToSign(InputIndex); scriptSig tempScriptSig = new scriptSig(); tempScriptSig.Signature = Cryptor.rsaPriSign(strRawdata, strmyPriKeyPath); tempScriptSig.PubKey = strmyPubkeyValue; // modified by fdp 190110 listInputs[InputIndex].addSignature(tempScriptSig); //listInputs[InputIndex].ScriptSig.Signature = Cryptor.rsaPriSign(strRawdata, strmyPriKeyPath); //listInputs[InputIndex].ScriptSig.PubKey = strmyPubkeyValue; }
public Input(string strHash, int index) { if (string.IsNullOrEmpty(strHash)) { PreTxHash = string.Empty; } else { PreTxHash = strHash; } OutputIndex = index; ScriptSig = new scriptSig(); }
public override bool Equals(Object other) { if (other == null) { return(false); } scriptSig otherSc = (scriptSig)other; // 直接对比hash是否一致 if (this.GetHashCode() != otherSc.GetHashCode()) { return(false); } else { return(true); } }
public Transaction CreatCoinBaseTX(string strAddress) { Transaction basecoinTrans = new Transaction(); string basecoinPrehash = "0000000000000000000000000000000000000000000000000000000000000000"; int basecoinIndex = -1; Input basecoinInput = new Input(basecoinPrehash, basecoinIndex); scriptSig bassecoinSS = new scriptSig(); string nowTime = DateTime.Now.ToString("yyyyMMddHHmmssfff"); bassecoinSS.Signature = Cryptor.SHA256(nowTime, nowTime.Length); bassecoinSS.PubKey = Cryptor.SHA256(bassecoinSS.Signature, bassecoinSS.Signature.Length); basecoinInput.addSignature(bassecoinSS); basecoinTrans.addInput(basecoinInput); basecoinTrans.addOutput(24, strAddress); basecoinTrans.FinalSetTrans(); return(basecoinTrans); //this.poolTx.Add(RewardTrans); }
public void addSignature(scriptSig signature, int index) { listInputs[index].addSignature(signature); }
public void addSignature(scriptSig Sig) { this.ScriptSig = Sig; }