Get rid of DH_der_gen_hex and DH_der_load_hex.

This commit is contained in:
Arthur Britto
2012-06-16 12:17:40 -07:00
parent f774baefeb
commit 160c625216
3 changed files with 16 additions and 40 deletions

View File

@@ -53,13 +53,8 @@ bool Wallet::nodeIdentityLoad()
mNodePublicKey.setNodePublic(strPublicKey);
mNodePrivateKey.setNodePrivate(strPrivateKey);
std::string strDh512, strDh1024;
db->getStr("Dh512", strDh512);
db->getStr("Dh1024", strDh1024);
mDh512 = DH_der_load_hex(strDh512);
mDh1024 = DH_der_load_hex(strDh1024);
mDh512 = DH_der_load(db->getStrBinary("Dh512"));
mDh1024 = DH_der_load(db->getStrBinary("Dh1024"));
db->endIterRows();
bSuccess = true;
@@ -81,13 +76,11 @@ bool Wallet::nodeIdentityCreate() {
// Make new key.
std::string strDh512, strDh1024;
DH_der_gen_hex(strDh512, 512); // Using hex as db->escape in insufficient.
std::string strDh512 = DH_der_gen(512);
#if 1
strDh1024 = strDh512; // For testing and most cases 512 is fine.
std::string strDh1024 = strDh512; // For testing and most cases 512 is fine.
#else
DH_der_gen_hex(strDh1024, 1024);
std::string strDh1024 = DH_der_gen(1024);
#endif
//
@@ -96,11 +89,11 @@ bool Wallet::nodeIdentityCreate() {
Database* db = theApp->getWalletDB()->getDB();
ScopedLock sl(theApp->getWalletDB()->getDBLock());
db->executeSQL(str(boost::format("INSERT INTO NodeIdentity (PublicKey,PrivateKey,Dh512,Dh1024) VALUES (%s,%s,%s,%s);")
% db->escape(naNodePublic.humanNodePublic())
% db->escape(naNodePrivate.humanNodePrivate())
% db->escape(strDh512)
% db->escape(strDh1024)));
db->executeSQL(str(boost::format("INSERT INTO NodeIdentity (PublicKey,PrivateKey,Dh512,Dh1024) VALUES ('%s','%s',%s,%s);")
% naNodePublic.humanNodePublic()
% naNodePrivate.humanNodePrivate()
% sqlEscape(strDh512)
% sqlEscape(strDh1024)));
// XXX Check error result.
std::cerr << "NodeIdentity: Created." << std::endl;