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
16
regaddr.cpp
16
regaddr.cpp
|
@ -12,22 +12,22 @@ int main (int argc, char * argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
i2p::crypto::InitCrypto (false, true, true, false);
|
||||
i2p::crypto::InitCrypto (false, true, true, false);
|
||||
|
||||
i2p::data::PrivateKeys keys;
|
||||
std::ifstream s(argv[1], std::ifstream::binary);
|
||||
if (s.is_open ())
|
||||
{
|
||||
if (s.is_open ())
|
||||
{
|
||||
s.seekg (0, std::ios::end);
|
||||
size_t len = s.tellg();
|
||||
s.seekg (0, std::ios::beg);
|
||||
uint8_t * buf = new uint8_t[len];
|
||||
s.read ((char *)buf, len);
|
||||
if(keys.FromBuffer (buf, len))
|
||||
{
|
||||
{
|
||||
auto signatureLen = keys.GetPublic ()->GetSignatureLen ();
|
||||
uint8_t * signature = new uint8_t[signatureLen];
|
||||
char * sig = new char[signatureLen*2];
|
||||
char * sig = new char[signatureLen*2];
|
||||
std::stringstream out;
|
||||
out << argv[2] << "="; // address
|
||||
out << keys.GetPublic ()->ToBase64 ();
|
||||
|
@ -37,12 +37,12 @@ int main (int argc, char * argv[])
|
|||
out << "#!sig=" << sig;
|
||||
delete[] signature;
|
||||
delete[] sig;
|
||||
std::cout << out.str () << std::endl;
|
||||
std::cout << out.str () << std::endl;
|
||||
}
|
||||
else
|
||||
else
|
||||
std::cout << "Failed to load keyfile " << argv[1] << std::endl;
|
||||
delete[] buf;
|
||||
}
|
||||
}
|
||||
|
||||
i2p::crypto::TerminateCrypto ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue