From 20e8513daf058a6c3afcb7e849335ce52dbc57d3 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 20 Feb 2017 16:08:17 -0500 Subject: [PATCH] GOST R 34.10 added --- common/key.hpp | 6 +++++- i2pd | 2 +- keygen.cpp | 6 ++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/key.hpp b/common/key.hpp index d3358ad..09e0aa9 100644 --- a/common/key.hpp +++ b/common/key.hpp @@ -27,6 +27,8 @@ std::string SigTypeToName(uint16_t keytype) return "RSA-4096-SHA512"; case i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519: return "ED25519-SHA512"; + case i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411: + return "GOSTR3410-A-GOSTR3411"; default: std::stringstream ss; 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("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; } diff --git a/i2pd b/i2pd index b3ab85f..6fc80e9 160000 --- a/i2pd +++ b/i2pd @@ -1 +1 @@ -Subproject commit b3ab85f3b538d0fab9194e5a33632e0e694e7705 +Subproject commit 6fc80e9b67c8ee0a4c2c82c9173d2c1fb56b0efb diff --git a/keygen.cpp b/keygen.cpp index d99c2c3..069164d 100644 --- a/keygen.cpp +++ b/keygen.cpp @@ -18,6 +18,8 @@ int main (int argc, char * argv[]) std::string str(argv[2]); type = NameToSigType(str); } + if (type == i2p::data::SIGNING_KEY_TYPE_GOSTR3410_A_GOSTR3411) + i2p::crypto::InitGost (); auto keys = i2p::data::PrivateKeys::CreateRandomKeys (type); std::ofstream f (argv[1], std::ofstream::binary | std::ofstream::out); if (f) @@ -32,6 +34,10 @@ int main (int argc, char * argv[]) else 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; }