From 4b554a36b81b1a67987b6e32456c54c2ff4b6b49 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 20 Oct 2016 20:51:39 -0400 Subject: cli: Add dl_group_info cmdlet --- src/cli/pubkey.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/cli') diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp index 6c0ea8352..1c3f948d1 100644 --- a/src/cli/pubkey.cpp +++ b/src/cli/pubkey.cpp @@ -221,6 +221,30 @@ BOTAN_REGISTER_COMMAND("verify", PK_Verify); #if defined(BOTAN_HAS_DL_GROUP) +class DL_Group_Info final : public Command + { + public: + DL_Group_Info() : Command("dl_group_info --pem name") {} + + void go() override + { + Botan::DL_Group group(get_arg("name")); + + if(flag_set("pem")) + { + output() << group.PEM_encode(Botan::DL_Group::X942_DH_PARAMETERS); + } + else + { + output() << "P = " << std::hex << group.get_p() << "\n" + << "G = " << group.get_g() << "\n"; + } + + } + }; + +BOTAN_REGISTER_COMMAND("dl_group_info", DL_Group_Info); + class Gen_DL_Group final : public Command { public: -- cgit v1.2.3