int main(int argc,char **argv) { if(argc != 5) { fprintf(stderr,"%s <bank public info> <private coin request> <signed coin request> <coin>\n", argv[0]); exit(1); } const char *szBankFile=argv[1]; const char *szPrivateRequestFile=argv[2]; const char *szSignatureFile=argv[3]; const char *szCoinFile=argv[4]; SetDumper(stderr); BIO *bioBank=BIO_new_file(szBankFile,"r"); BIO *bioPrivateRequest=BIO_new_file(szPrivateRequestFile,"r"); BIO *bioSignature=BIO_new_file(szSignatureFile,"r"); BIO *bioCoin=BIO_new_file(szCoinFile,"w"); PublicBank bank(bioBank); CoinRequest req(bioPrivateRequest); ReadNumber(bioSignature,"request="); BIGNUM *bnSignature=ReadNumber(bioSignature,"signature="); DumpNumber("signature=",bnSignature); Coin coin; req.ProcessResponse(&coin,bank,bnSignature); coin.WriteBIO(bioCoin); }
// Todo: need to be saving these BIOs somewhere, and freeing them at // the end of the run of the application. // void SetMonitor(const char *filepathexact) { BIO *out = new BIO; out = BIO_new_file(filepathexact,"r"); assert(out); SetDumper(out); }
void SetDumper(FILE *f) { BIO *out=BIO_new(BIO_s_file()); assert(out); BIO_set_fp(out,f,BIO_NOCLOSE); SetDumper(out); }
// Open-Transactions // NOTE: review this in security audit... // This is da2ce7's fix for the problems that appeared from removing // Lucre from the OT source and linking it separately. (Without applink.c // which causes cross-boundary issues with file handles.) // void SetDumper(const char *filepathexact) { // lets clear the last time we used this file. CleanupDumpFile(filepathexact); BIO *out = new BIO; out = BIO_new_file(filepathexact,"w"); assert(out); SetDumper(out); }
// We don't need this for release builds _OT_Lucre_Dumper::_OT_Lucre_Dumper() { #ifdef _WIN32 #ifdef _DEBUG OTString strOpenSSLDumpFilename("openssl.dumpfile"),strOpenSSLDumpFilePath, strDataPath; // todo security. We shouldn't necessarily be dumping this info to file AT ALL. bool bGetDataFolderSuccess = OTDataFolder::Get(strDataPath); OT_ASSERT_MSG(bGetDataFolderSuccess,"_OT_Lucre_Dumper(): Failed to Get Data Path"); bool bRelativeToCanonicalSuccess = OTPaths::RelativeToCanonical(strOpenSSLDumpFilePath,strDataPath,strOpenSSLDumpFilename); OT_ASSERT_MSG(bRelativeToCanonicalSuccess,"_OT_Lucre_Dumper(): Unable To Build Full Path"); strOpenSSLDumpFilename.Set(""); strDataPath.Set(""); SetDumper(strOpenSSLDumpFilePath.Get()); // We are only dumping this way currently as a temporary solution to the applink.c openssl thing that can cause crashes in Lucre when withdrawing cash. (Caused by da2ce7 removing Lucre from OT and moving it into a dylib.) m_str_dumpfile = strOpenSSLDumpFilePath.Get(); strOpenSSLDumpFilePath.Set(""); #endif #else SetDumper(stderr); #endif }
int main(int argc,char **argv) { if(argc != 4) { fprintf(stderr,"%s <bank public info> <coin request> <public coin requet>\n",argv[0]); exit(1); } const char *szBankFile=argv[1]; const char *szCoinFile=argv[2]; const char *szPublicCoinFile=argv[3]; SetDumper(stderr); BIO *bioBank=BIO_new_file(szBankFile,"r"); BIO *bioCoin=BIO_new_file(szCoinFile,"w"); BIO *bioPublicCoin=BIO_new_file(szPublicCoinFile,"w"); PublicBank bank; bank.ReadBIO(bioBank); CoinRequest req(bank); req.WriteBIO(bioCoin); ((PublicCoinRequest *)&req)->WriteBIO(bioPublicCoin); }