mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-05-01 13:12:30 +02:00
clean code
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
07c5391b92
commit
5f45990dff
11 changed files with 567 additions and 574 deletions
|
@ -23,8 +23,8 @@ int main (int argc, char * argv[])
|
|||
std::ifstream inf;
|
||||
inf.open(fname);
|
||||
if (!inf.is_open()) {
|
||||
std::cout << "cannot open keys file " << fname << std::endl;
|
||||
return 2;
|
||||
std::cout << "cannot open keys file " << fname << std::endl;
|
||||
return 2;
|
||||
}
|
||||
inf.seekg(0, std::ios::end);
|
||||
const std::size_t len = inf.tellg();
|
||||
|
@ -32,13 +32,13 @@ int main (int argc, char * argv[])
|
|||
buff.resize(len);
|
||||
inf.read((char*)buff.data(), buff.size());
|
||||
if (!keys.FromBuffer(buff.data(), buff.size())) {
|
||||
std::cout << "bad keys file format" << std::endl;
|
||||
return 3;
|
||||
std::cout << "bad keys file format" << std::endl;
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i2p::data::SigningKeyType type = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519; // EdDSA by default
|
||||
if (argc > 3)
|
||||
if (argc > 3)
|
||||
{
|
||||
std::string str(argv[3]);
|
||||
type = NameToSigType(str);
|
||||
|
@ -46,10 +46,10 @@ int main (int argc, char * argv[])
|
|||
|
||||
int days = 365; // 1 year by default
|
||||
if (argc > 4)
|
||||
days = std::stoi (argv[4]);
|
||||
days = std::stoi (argv[4]);
|
||||
uint32_t expires = i2p::util::GetSecondsSinceEpoch () + days*24*60*60;
|
||||
|
||||
auto offlineKeys = keys.CreateOfflineKeys (type, expires);
|
||||
|
||||
auto offlineKeys = keys.CreateOfflineKeys (type, expires);
|
||||
std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out);
|
||||
if (f)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ int main (int argc, char * argv[])
|
|||
std::cout << "Offline keys for destination " << offlineKeys.GetPublic ()->GetIdentHash ().ToBase32 () << " created" << std::endl;
|
||||
}
|
||||
else
|
||||
std::cout << "Can't create file " << argv[1] << std::endl;
|
||||
std::cout << "Can't create file " << argv[1] << std::endl;
|
||||
|
||||
i2p::crypto::TerminateCrypto ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue