aboutsummaryrefslogtreecommitdiffstats
path: root/src/cli/pubkey.cpp
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2017-08-28 22:45:11 +0200
committerRenĂ© Korthaus <[email protected]>2018-01-04 18:18:22 +0100
commit5fb1cdfb5d7c6f854102ce33f8c7cad2a3b27153 (patch)
treea643600981c025985599c1a0ee13f1a516a9731e /src/cli/pubkey.cpp
parent5ac3d723d1be27098bc3a18204a07a5972a0e283 (diff)
Print a command description for cli help
Diffstat (limited to 'src/cli/pubkey.cpp')
-rw-r--r--src/cli/pubkey.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/cli/pubkey.cpp b/src/cli/pubkey.cpp
index a6f77fe0c..ec4dcab52 100644
--- a/src/cli/pubkey.cpp
+++ b/src/cli/pubkey.cpp
@@ -32,6 +32,16 @@ class PK_Fingerprint final : public Command
public:
PK_Fingerprint() : Command("fingerprint --algo=SHA-256 *keys") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Calculate a public key fingerprint";
+ }
+
void go() override
{
const std::string hash_algo = get_arg("algo");
@@ -52,6 +62,16 @@ class PK_Keygen final : public Command
public:
PK_Keygen() : Command("keygen --algo=RSA --params= --passphrase= --pbe= --pbe-millis=300 --der-out") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Generate a PKCS #8 private key";
+ }
+
void go() override
{
const std::string algo = get_arg("algo");
@@ -123,6 +143,16 @@ class PK_Sign final : public Command
public:
PK_Sign() : Command("sign --passphrase= --hash=SHA-256 --emsa= key file") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Sign arbitrary data";
+ }
+
void go() override
{
std::unique_ptr<Botan::Private_Key> key(
@@ -158,6 +188,16 @@ class PK_Verify final : public Command
public:
PK_Verify() : Command("verify --hash=SHA-256 --emsa= pubkey file signature") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Verify the authenticity of the given file with the provided signature";
+ }
+
void go() override
{
std::unique_ptr<Botan::Public_Key> key(Botan::X509::load_key(get_arg("pubkey")));
@@ -194,6 +234,16 @@ class EC_Group_Info final : public Command
public:
EC_Group_Info() : Command("ec_group_info --pem name") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Print raw elliptic curve domain parameters of the standarized curve name";
+ }
+
void go() override
{
Botan::EC_Group group(get_arg("name"));
@@ -225,6 +275,16 @@ class DL_Group_Info final : public Command
public:
DL_Group_Info() : Command("dl_group_info --pem name") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Print raw Diffie-Hellman parameters (p,g) of the standarized DH group name";
+ }
+
void go() override
{
Botan::DL_Group group(get_arg("name"));
@@ -249,6 +309,16 @@ class Gen_DL_Group final : public Command
public:
Gen_DL_Group() : Command("gen_dl_group --pbits=1024 --qbits=0 --type=subgroup") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Generate ANSI X9.42 encoded Diffie-Hellman group parameters";
+ }
+
void go() override
{
const size_t pbits = get_arg_sz("pbits");
@@ -281,6 +351,16 @@ class PKCS8_Tool final : public Command
public:
PKCS8_Tool() : Command("pkcs8 --pass-in= --pub-out --der-out --pass-out= --pbe= --pbe-millis=300 key") {}
+ std::string group() const override
+ {
+ return "pubkey";
+ }
+
+ std::string description() const override
+ {
+ return "Open a PKCS #8 formatted key";
+ }
+
void go() override
{
std::unique_ptr<Botan::Private_Key> key;