|
|
@ -1,4 +1,6 @@ |
|
|
|
#include <string.h> |
|
|
|
#include <string.h> |
|
|
|
|
|
|
|
#include <vector> |
|
|
|
|
|
|
|
#include <boost/algorithm/string.hpp> |
|
|
|
#include "Log.h" |
|
|
|
#include "Log.h" |
|
|
|
#include "ClientContext.h" |
|
|
|
#include "ClientContext.h" |
|
|
|
#include "util.h" |
|
|
|
#include "util.h" |
|
|
@ -434,7 +436,15 @@ namespace client |
|
|
|
void BOBCommandSession::NewkeysCommandHandler (const char * operand, size_t len) |
|
|
|
void BOBCommandSession::NewkeysCommandHandler (const char * operand, size_t len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint (eLogDebug, "BOB: newkeys"); |
|
|
|
LogPrint (eLogDebug, "BOB: newkeys"); |
|
|
|
m_Keys = i2p::data::PrivateKeys::CreateRandomKeys (); |
|
|
|
std::vector<std::string> params; |
|
|
|
|
|
|
|
boost::split (params, operand, boost::is_any_of(" "), boost::token_compress_on); |
|
|
|
|
|
|
|
i2p::data::SigningKeyType signatureType = i2p::data::SIGNING_KEY_TYPE_DSA_SHA1; |
|
|
|
|
|
|
|
i2p::data::CryptoKeyType cryptoType = i2p::data::CRYPTO_KEY_TYPE_ELGAMAL; |
|
|
|
|
|
|
|
if (params.size () > 0) |
|
|
|
|
|
|
|
signatureType = std::stoi(params[0]); |
|
|
|
|
|
|
|
if (params.size () > 1) |
|
|
|
|
|
|
|
cryptoType = std::stoi(params[1]); |
|
|
|
|
|
|
|
m_Keys = i2p::data::PrivateKeys::CreateRandomKeys (signatureType, cryptoType); |
|
|
|
SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); |
|
|
|
SendReplyOK (m_Keys.GetPublic ()->ToBase64 ().c_str ()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|