Browse Source

GOST R 34.10 added

pull/9/head
orignal 8 years ago
parent
commit
20e8513daf
  1. 6
      common/key.hpp
  2. 2
      i2pd
  3. 6
      keygen.cpp

6
common/key.hpp

@ -27,6 +27,8 @@ std::string SigTypeToName(uint16_t keytype)
return "RSA-4096-SHA512"; return "RSA-4096-SHA512";
case i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: case i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519:
return "ED25519-SHA512"; return "ED25519-SHA512";
case i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411:
return "GOSTR3410-A-GOSTR3411";
default: default:
std::stringstream ss; std::stringstream ss;
ss << "unknown: " << keytype; ss << "unknown: " << keytype;
@ -62,7 +64,9 @@ uint16_t NameToSigType(const std::string & keyname)
if(name.find("RSA-SHA512") != npos) return i2p::data::SIGNING_KEY_TYPE_RSA_SHA512_4096; if(name.find("RSA-SHA512") != npos) return i2p::data::SIGNING_KEY_TYPE_RSA_SHA512_4096;
if(name.find("ED25519") != npos) return i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519; if(name.find("ED25519") != npos) return i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519;
if(name.find("GOSTR3410") != npos) return i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411;
return -1; return -1;
} }

2
i2pd

@ -1 +1 @@
Subproject commit b3ab85f3b538d0fab9194e5a33632e0e694e7705 Subproject commit 6fc80e9b67c8ee0a4c2c82c9173d2c1fb56b0efb

6
keygen.cpp

@ -18,6 +18,8 @@ int main (int argc, char * argv[])
std::string str(argv[2]); std::string str(argv[2]);
type = NameToSigType(str); type = NameToSigType(str);
} }
if (type == i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411)
i2p::crypto::InitGost ();
auto keys = i2p::data::PrivateKeys::CreateRandomKeys (type); auto keys = i2p::data::PrivateKeys::CreateRandomKeys (type);
std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out); std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out);
if (f) if (f)
@ -32,6 +34,10 @@ int main (int argc, char * argv[])
else else
std::cout << "Can't create file " << argv[1] << std::endl; std::cout << "Can't create file " << argv[1] << std::endl;
if (type == i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411)
i2p::crypto::TerminateGost ();
i2p::crypto::TerminateCrypto ();
return 0; return 0;
} }

Loading…
Cancel
Save