From 897af615f9bdd536225941b3f0d64ce24ab5ce4c Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 13 Mar 2015 22:11:51 -0400 Subject: [PATCH] create persistent destinations with ECDSA --- ClientContext.cpp | 77 +---------------------------------------------- 1 file changed, 1 insertion(+), 76 deletions(-) diff --git a/ClientContext.cpp b/ClientContext.cpp index d0955c0c..cbc916fc 100644 --- a/ClientContext.cpp +++ b/ClientContext.cpp @@ -170,7 +170,7 @@ namespace client else { LogPrint ("Can't open file ", fullPath, " Creating new one"); - keys = i2p::data::PrivateKeys::CreateRandomKeys (i2p::data::SIGNING_KEY_TYPE_DSA_SHA1); + keys = i2p::data::PrivateKeys::CreateRandomKeys (i2p::data::SIGNING_KEY_TYPE_ECDSA_SHA256_P256); std::ofstream f (fullPath, std::ofstream::binary | std::ofstream::out); size_t len = keys.GetFullLen (); uint8_t * buf = new uint8_t[len]; @@ -253,81 +253,6 @@ namespace client return nullptr; } - /*void ClientContext::ReadTunnels () - { - std::ifstream ifs (i2p::util::filesystem::GetFullPath (TUNNELS_CONFIG_FILENAME)); - if (ifs.good ()) - { - boost::program_options::options_description params ("I2P tunnels parameters"); - params.add_options () - // client - (I2P_CLIENT_TUNNEL_NAME, boost::program_options::value >(), "tunnel name") - (I2P_CLIENT_TUNNEL_PORT, boost::program_options::value >(), "Local port") - (I2P_CLIENT_TUNNEL_DESTINATION, boost::program_options::value >(), "destination") - (I2P_CLIENT_TUNNEL_KEYS, boost::program_options::value >(), "keys") - // server - (I2P_SERVER_TUNNEL_NAME, boost::program_options::value >(), "tunnel name") - (I2P_SERVER_TUNNEL_HOST, boost::program_options::value >(), "host") - (I2P_SERVER_TUNNEL_PORT, boost::program_options::value >(), "port") - (I2P_SERVER_TUNNEL_KEYS, boost::program_options::value >(), "keys") - ; - - - boost::program_options::variables_map vm; - try - { - boost::program_options::store (boost::program_options::parse_config_file (ifs, params), vm); - boost::program_options::notify (vm); - } - catch (boost::program_options::error& ex) - { - LogPrint (eLogError, "Can't parse ", TUNNELS_CONFIG_FILENAME,": ", ex.what ()); - return; - } - - if (vm.count (I2P_CLIENT_TUNNEL_NAME) > 0) - { - auto names = vm[I2P_CLIENT_TUNNEL_NAME].as >(); - int numClientTunnels = names.size (); - auto ports = vm[I2P_CLIENT_TUNNEL_PORT].as >(); - auto destinations = vm[I2P_CLIENT_TUNNEL_DESTINATION].as >(); - auto keys = vm[I2P_CLIENT_TUNNEL_KEYS].as >(); - - for (int i = 0; i < numClientTunnels; i++) - { - std::shared_ptr localDestination = nullptr; - if (keys[i].length () > 0) - localDestination = LoadLocalDestination (keys[i], false); - auto clientTunnel = new I2PClientTunnel (destinations[i], ports[i], localDestination); - if (m_ClientTunnels.insert (std::make_pair (ports[i], std::unique_ptr(clientTunnel))).second) - clientTunnel->Start (); - else - LogPrint (eLogError, "I2P client tunnel with port ", ports[i], " already exists"); - } - LogPrint (eLogInfo, numClientTunnels, " I2P client tunnels created"); - } - - if (vm.count (I2P_SERVER_TUNNEL_NAME) > 0) - { - auto names = vm[I2P_SERVER_TUNNEL_NAME].as >(); - int numServerTunnels = names.size (); - auto hosts = vm[I2P_SERVER_TUNNEL_HOST].as >(); - auto ports = vm[I2P_SERVER_TUNNEL_PORT].as >(); - auto keys = vm[I2P_SERVER_TUNNEL_KEYS].as >(); - for (int i = 0; i < numServerTunnels; i++) - { - auto localDestination = LoadLocalDestination (keys[i], true); - auto serverTunnel = new I2PServerTunnel (hosts[i], ports[i], localDestination); - if (m_ServerTunnels.insert (std::make_pair (localDestination->GetIdentHash (), std::unique_ptr(serverTunnel))).second) - serverTunnel->Start (); - else - LogPrint (eLogError, "I2P server tunnel for destination ", m_AddressBook.ToAddress(localDestination->GetIdentHash ()), " already exists"); - } - LogPrint (eLogInfo, numServerTunnels, " I2P server tunnels created"); - } - } - }*/ - void ClientContext::ReadTunnels () { boost::property_tree::ptree pt;