diff options
author | Jack Lloyd <[email protected]> | 2016-10-20 20:51:39 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-20 20:51:39 -0400 |
commit | 4b554a36b81b1a67987b6e32456c54c2ff4b6b49 (patch) | |
tree | 1674f4091d9636d8f952541de114d12107b17055 /src/cli | |
parent | 709aad063e72a1cd157ee0768e6677bc1cadfd6d (diff) |
cli: Add dl_group_info cmdlet
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/pubkey.cpp | 24 |
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: |