From e4058ddf1960dcc815776ceae7ef8c3bc9c8e353 Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:45:50 +1000 Subject: [PATCH 1/8] Update cli.h --- src/cli.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cli.h b/src/cli.h index 9c8c5c0..f2bc7a6 100644 --- a/src/cli.h +++ b/src/cli.h @@ -52,6 +52,7 @@ struct Options { int channelID; int serial; int numKeys; + bool upgrade; bool serialSet; bool verbose; bool help; From 8f685a022cc8695681f1707dbfad81fbab846b1d Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:49:57 +1000 Subject: [PATCH 2/8] Update cli.cpp --- src/cli.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli.cpp b/src/cli.cpp index e79a425..cc6e27d 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -71,6 +71,7 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { 640, 0, 1, + false, false, false, false, @@ -100,6 +101,8 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { options->numKeys = nKeys; } i++; + } else if (arg == "-u" || arg == "--upgrade") { + options->upgrade = true; } else if (arg == "-b" || arg == "--bink") { if (i == argc - 1) { options->error = true; From 216c9cdf9db6f7732219f128cf741db009c9c794 Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:51:53 +1000 Subject: [PATCH 3/8] Update cli.cpp --- src/cli.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli.cpp b/src/cli.cpp index cc6e27d..c8c237e 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -57,6 +57,7 @@ void CLI::showHelp(char *argv[]) { fmt::print("\t-l --list\tshow which products/binks can be loaded\n"); fmt::print("\t-c --channelid\tspecify which Channel Identifier to use (defaults to 640)\n"); fmt::print("\t-s --serial\tspecifies a serial to use in the product ID (defaults to random, BINK1998 only)\n"); + fmt::print("\t-u --upgrade\tspecifies the Product Key will be an \"Upgrade\" version\n"); fmt::print("\t-V --validate\tproduct key to validate signature\n"); fmt::print("\n"); } @@ -72,6 +73,7 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { 0, 1, false, + false, false, false, false, From 4b2ef7ac724f4f3c4337601bb8d50ee681606c4b Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:52:19 +1000 Subject: [PATCH 4/8] Update cli.cpp --- src/cli.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index c8c237e..14ccc40 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -73,7 +73,6 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { 0, 1, false, - false, false, false, false, From 859a21656c4d923eee262a1b4f5a2082e89f8426 Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:56:05 +1000 Subject: [PATCH 5/8] Update cli.cpp --- src/cli.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cli.cpp b/src/cli.cpp index 14ccc40..53c364b 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -385,6 +385,8 @@ int CLI::BINK1998Generate() { // Specify whether an upgrade version or not bool bUpgrade = false; + if (options->upgrade == true) + bUpgrade = true; for (int i = 0; i < this->total; i++) { PIDGEN3::BINK1998::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, nRaw, bUpgrade, this->pKey); @@ -436,6 +438,11 @@ int CLI::BINK2002Generate() { fmt::print("> AuthInfo: {}\n", pAuthInfo); } + // Specify whether an upgrade version or not + bool bUpgrade = false; + if (options->upgrade == true) + bUpgrade = true; + PIDGEN3::BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, false, this->pKey); bool isValid = PIDGEN3::BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); From 7c4bcdc8478916ce62eb291143f6e84cbca5a2fa Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 16:56:58 +1000 Subject: [PATCH 6/8] Update cli.cpp --- src/cli.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.cpp b/src/cli.cpp index 53c364b..ea73a68 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -443,7 +443,7 @@ int CLI::BINK2002Generate() { if (options->upgrade == true) bUpgrade = true; - PIDGEN3::BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, false, this->pKey); + PIDGEN3::BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, bUpgrade, this->pKey); bool isValid = PIDGEN3::BINK2002::Verify(this->eCurve, this->genPoint, this->pubPoint, this->pKey); if (isValid) { From de659846d4244a23ddcee38908f5f18a1710ac55 Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 17:16:24 +1000 Subject: [PATCH 7/8] Update cli.cpp --- src/cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index ea73a68..1e1c210 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -102,8 +102,6 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { options->numKeys = nKeys; } i++; - } else if (arg == "-u" || arg == "--upgrade") { - options->upgrade = true; } else if (arg == "-b" || arg == "--bink") { if (i == argc - 1) { options->error = true; @@ -141,6 +139,8 @@ int CLI::parseCommandLine(int argc, char* argv[], Options* options) { options->serial = serial_val; } i++; + } else if (arg == "-u" || arg == "--upgrade") { + options->upgrade = true; } else if (arg == "-f" || arg == "--file") { if (i == argc - 1) { options->error = true; From 63fbbd83eff7caadccea53009ca0f129be9c5482 Mon Sep 17 00:00:00 2001 From: pottzman Date: Thu, 10 Aug 2023 17:27:03 +1000 Subject: [PATCH 8/8] Update cli.cpp --- src/cli.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.cpp b/src/cli.cpp index 1e1c210..e150e61 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -385,7 +385,7 @@ int CLI::BINK1998Generate() { // Specify whether an upgrade version or not bool bUpgrade = false; - if (options->upgrade == true) + if (options.upgrade == true) bUpgrade = true; for (int i = 0; i < this->total; i++) { @@ -440,7 +440,7 @@ int CLI::BINK2002Generate() { // Specify whether an upgrade version or not bool bUpgrade = false; - if (options->upgrade == true) + if (options.upgrade == true) bUpgrade = true; PIDGEN3::BINK2002::Generate(this->eCurve, this->genPoint, this->genOrder, this->privateKey, pChannelID, pAuthInfo, bUpgrade, this->pKey);