aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-10-20 20:51:39 -0400
committerJack Lloyd <[email protected]>2016-10-20 20:51:39 -0400
commit4b554a36b81b1a67987b6e32456c54c2ff4b6b49 (patch)
tree1674f4091d9636d8f952541de114d12107b17055 /src/cli
parent709aad063e72a1cd157ee0768e6677bc1cadfd6d (diff)
cli: Add dl_group_info cmdlet
Diffstat (limited to 'src/cli')
-rw-r--r--src/cli/pubkey.cpp24
1 files changed, 24 insertions, 0 deletions
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: