diff --git a/Kryptos/Kryptos/WireUpBase64Extensions.cs b/Kryptos/Kryptos/WireUpBase64Extensions.cs index 7a2b7ec..81dff70 100644 --- a/Kryptos/Kryptos/WireUpBase64Extensions.cs +++ b/Kryptos/Kryptos/WireUpBase64Extensions.cs @@ -16,18 +16,10 @@ public static RootCommand WireUpBase64Commands(this RootCommand rootCommand) var base64Command = new Command("base64", "Base64"); var base64EncCommand = new Command("encode", "Encode"); base64EncCommand.AddAlias("enc"); - base64EncCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - base64EncCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - base64EncCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + base64EncCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + base64EncCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + base64EncCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + base64EncCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpBase64UrlExtensions.cs b/Kryptos/Kryptos/WireUpBase64UrlExtensions.cs index 72d2ce6..57c18a4 100644 --- a/Kryptos/Kryptos/WireUpBase64UrlExtensions.cs +++ b/Kryptos/Kryptos/WireUpBase64UrlExtensions.cs @@ -16,18 +16,10 @@ public static RootCommand WireUpBase64UrlCommands(this RootCommand rootCommand) var base64UrlCommand = new Command("base64url", "Base64 URL"); var base64UrlEncCommand = new Command("encode", "Encode"); base64UrlEncCommand.AddAlias("enc"); - base64UrlEncCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - base64UrlEncCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - base64UrlEncCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + base64UrlEncCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + base64UrlEncCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + base64UrlEncCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + base64UrlEncCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { try diff --git a/Kryptos/Kryptos/WireUpHmacMd5Extensions.cs b/Kryptos/Kryptos/WireUpHmacMd5Extensions.cs index b27c747..cef724f 100644 --- a/Kryptos/Kryptos/WireUpHmacMd5Extensions.cs +++ b/Kryptos/Kryptos/WireUpHmacMd5Extensions.cs @@ -15,26 +15,12 @@ public static RootCommand WireUpHmacMd5Commands(this RootCommand rootCommand) { var hmacmd5Command = new Command("hmacmd5", "Hash based Message Authentication Code - MD5"); var hmacmd5HashCommand = new Command("hash", "Hash"); - hmacmd5HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - hmacmd5HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - hmacmd5HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text") - { - Argument = new Argument("text") - }); - hmacmd5HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path") - { - Argument = new Argument("input") - }); - hmacmd5HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + hmacmd5HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + hmacmd5HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + hmacmd5HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text")); + hmacmd5HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path")); + hmacmd5HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + hmacmd5HashCommand.Handler = CommandHandler.Create(async (text, input, keytext, keyinput, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpHmacSha1Extensions.cs b/Kryptos/Kryptos/WireUpHmacSha1Extensions.cs index ce498f6..6d58507 100644 --- a/Kryptos/Kryptos/WireUpHmacSha1Extensions.cs +++ b/Kryptos/Kryptos/WireUpHmacSha1Extensions.cs @@ -15,26 +15,12 @@ public static RootCommand WireUpHmacSha1Commands(this RootCommand rootCommand) { var hmacsha1Command = new Command("hmacsha1", "Hash based Message Authentication Code - SHA1"); var hmacsha1HashCommand = new Command("hash", "Hash"); - hmacsha1HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - hmacsha1HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - hmacsha1HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text") - { - Argument = new Argument("text") - }); - hmacsha1HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path") - { - Argument = new Argument("input") - }); - hmacsha1HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + hmacsha1HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + hmacsha1HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + hmacsha1HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text")); + hmacsha1HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path")); + hmacsha1HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + hmacsha1HashCommand.Handler = CommandHandler.Create(async (text, input, keytext, keyinput, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpHmacSha256Extensions.cs b/Kryptos/Kryptos/WireUpHmacSha256Extensions.cs index b2696ae..b1ea880 100644 --- a/Kryptos/Kryptos/WireUpHmacSha256Extensions.cs +++ b/Kryptos/Kryptos/WireUpHmacSha256Extensions.cs @@ -15,26 +15,12 @@ public static RootCommand WireUpHmacSha256Commands(this RootCommand rootCommand) { var hmacsha256Command = new Command("hmacsha256", "Hash based Message Authentication Code - SHA256"); var hmacsha256HashCommand = new Command("hash", "Hash"); - hmacsha256HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - hmacsha256HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - hmacsha256HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text") - { - Argument = new Argument("text") - }); - hmacsha256HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path") - { - Argument = new Argument("input") - }); - hmacsha256HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + hmacsha256HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + hmacsha256HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + hmacsha256HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text")); + hmacsha256HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path")); + hmacsha256HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + hmacsha256HashCommand.Handler = CommandHandler.Create(async (text, input, keytext, keyinput, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpHmacSha384Extensions.cs b/Kryptos/Kryptos/WireUpHmacSha384Extensions.cs index f206b8c..df28d3c 100644 --- a/Kryptos/Kryptos/WireUpHmacSha384Extensions.cs +++ b/Kryptos/Kryptos/WireUpHmacSha384Extensions.cs @@ -15,26 +15,12 @@ public static RootCommand WireUpHmacSha384Commands(this RootCommand rootCommand) { var hmacsha384Command = new Command("hmacsha384", "Hash based Message Authentication Code - SHA384"); var hmacsha384HashCommand = new Command("hash", "Hash"); - hmacsha384HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - hmacsha384HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - hmacsha384HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text") - { - Argument = new Argument("text") - }); - hmacsha384HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path") - { - Argument = new Argument("input") - }); - hmacsha384HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + hmacsha384HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + hmacsha384HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + hmacsha384HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text")); + hmacsha384HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path")); + hmacsha384HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + hmacsha384HashCommand.Handler = CommandHandler.Create(async (text, input, keytext, keyinput, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpHmacSha512Extensions.cs b/Kryptos/Kryptos/WireUpHmacSha512Extensions.cs index c85e152..55358cc 100644 --- a/Kryptos/Kryptos/WireUpHmacSha512Extensions.cs +++ b/Kryptos/Kryptos/WireUpHmacSha512Extensions.cs @@ -15,26 +15,12 @@ public static RootCommand WireUpHmacSha512Commands(this RootCommand rootCommand) { var hmacsha512Command = new Command("hmacsha512", "Hash based Message Authentication Code - SHA512"); var hmacsha512HashCommand = new Command("hash", "Hash"); - hmacsha512HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - hmacsha512HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - hmacsha512HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text") - { - Argument = new Argument("text") - }); - hmacsha512HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path") - { - Argument = new Argument("input") - }); - hmacsha512HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + hmacsha512HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + hmacsha512HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + hmacsha512HashCommand.AddOption(new Option(new string[] { "--keytext", "-kt" }, "Key Text")); + hmacsha512HashCommand.AddOption(new Option(new string[] { "--keyinput", "-ki" }, "Key file path")); + hmacsha512HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + hmacsha512HashCommand.Handler = CommandHandler.Create(async (text, input, keytext, keyinput, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpJwtExtensions.cs b/Kryptos/Kryptos/WireUpJwtExtensions.cs index 9df2a6a..2b37134 100644 --- a/Kryptos/Kryptos/WireUpJwtExtensions.cs +++ b/Kryptos/Kryptos/WireUpJwtExtensions.cs @@ -17,18 +17,10 @@ public static RootCommand WireUpJwtCommands(this RootCommand rootCommand) var jwtDecCommand = new Command("decode", "Decode"); jwtDecCommand.AddAlias("dec"); - jwtDecCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - jwtDecCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - jwtDecCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + jwtDecCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + jwtDecCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + jwtDecCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + jwtDecCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { try diff --git a/Kryptos/Kryptos/WireUpMd5Extensions.cs b/Kryptos/Kryptos/WireUpMd5Extensions.cs index 0f1c8da..f5cc47d 100644 --- a/Kryptos/Kryptos/WireUpMd5Extensions.cs +++ b/Kryptos/Kryptos/WireUpMd5Extensions.cs @@ -15,18 +15,10 @@ public static RootCommand WireUpMd5Commands(this RootCommand rootCommand) { var md5Command = new Command("md5", "Message Digest 5"); var md5HashCommand = new Command("hash", "Hash"); - md5HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - md5HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - md5HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + md5HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + md5HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + md5HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + md5HashCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpSha1Extensions.cs b/Kryptos/Kryptos/WireUpSha1Extensions.cs index ce1dbbd..26c6751 100644 --- a/Kryptos/Kryptos/WireUpSha1Extensions.cs +++ b/Kryptos/Kryptos/WireUpSha1Extensions.cs @@ -15,18 +15,10 @@ public static RootCommand WireUpSha1Commands(this RootCommand rootCommand) { var sha1Command = new Command("sha1", "Secure Hash Algorithm 1"); var sha1HashCommand = new Command("hash", "Hash"); - sha1HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - sha1HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - sha1HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + sha1HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + sha1HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + sha1HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + sha1HashCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpSha256Extensions.cs b/Kryptos/Kryptos/WireUpSha256Extensions.cs index 583b7f6..1cf8fa5 100644 --- a/Kryptos/Kryptos/WireUpSha256Extensions.cs +++ b/Kryptos/Kryptos/WireUpSha256Extensions.cs @@ -15,18 +15,10 @@ public static RootCommand WireUpSha256Commands(this RootCommand rootCommand) { var sha256Command = new Command("sha256", "Secure Hash Algorithm 2 - 256"); var sha256HashCommand = new Command("hash", "Hash"); - sha256HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - sha256HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - sha256HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + sha256HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + sha256HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + sha256HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + sha256HashCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpSha384Extensions.cs b/Kryptos/Kryptos/WireUpSha384Extensions.cs index e21aa5e..66b7152 100644 --- a/Kryptos/Kryptos/WireUpSha384Extensions.cs +++ b/Kryptos/Kryptos/WireUpSha384Extensions.cs @@ -15,18 +15,10 @@ public static RootCommand WireUpSha384Commands(this RootCommand rootCommand) { var sha384Command = new Command("sha384", "Secure Hash Algorithm 2 - 384"); var sha384HashCommand = new Command("hash", "Hash"); - sha384HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - sha384HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - sha384HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + sha384HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + sha384HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + sha384HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + sha384HashCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpSha512Extensions.cs b/Kryptos/Kryptos/WireUpSha512Extensions.cs index 11f5e3a..4142fc1 100644 --- a/Kryptos/Kryptos/WireUpSha512Extensions.cs +++ b/Kryptos/Kryptos/WireUpSha512Extensions.cs @@ -15,18 +15,10 @@ public static RootCommand WireUpSha512Commands(this RootCommand rootCommand) { var sha512Command = new Command("sha512", "Secure Hash Algorithm 2 - 512"); var sha512HashCommand = new Command("hash", "Hash"); - sha512HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text") - { - Argument = new Argument("text") - }); - sha512HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path") - { - Argument = new Argument("input") - }); - sha512HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + sha512HashCommand.AddOption(new Option(new string[] { "--text", "-t" }, "Input Text")); + sha512HashCommand.AddOption(new Option(new string[] { "--input", "-i" }, "Input file path")); + sha512HashCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + sha512HashCommand.Handler = CommandHandler.Create(async (text, input, output, console) => { Stream outputStream = null; diff --git a/Kryptos/Kryptos/WireUpUuidExtensions.cs b/Kryptos/Kryptos/WireUpUuidExtensions.cs index 5a0d135..c0fe763 100644 --- a/Kryptos/Kryptos/WireUpUuidExtensions.cs +++ b/Kryptos/Kryptos/WireUpUuidExtensions.cs @@ -14,14 +14,9 @@ public static class WireUpUuidExtensions public static RootCommand WireUpUuidCommands(this RootCommand rootCommand) { var guidCommand = new Command("uuid", "Universally Unique Identifier"); - guidCommand.AddOption(new Option(new string[] { "--no-hyphens", "--no-dash", "-n" }, "No Hyphens") - { - Argument = new Argument("noHyphens") - }); - guidCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path") - { - Argument = new Argument("output") - }); + guidCommand.AddOption(new Option(new string[] { "--no-hyphens", "--no-dash", "-n" }, "No Hyphens")); + guidCommand.AddOption(new Option(new string[] { "--output", "-o" }, "Output file path")); + guidCommand.Handler = CommandHandler.Create(async (noHyphens, output, console) => { try diff --git a/README.md b/README.md index 3c1cffa..5fc1167 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ A .NET core tool for cryptography. - SHA-1, SHA-256, SHA-384, SHA-512 Hash - JWT decoding - HMAC-SHA1, HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, HMAC-MD5 +- Subresource Integrity ## Installation @@ -64,6 +65,10 @@ kryptos --help ``` kryptos jwt dec -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlZpamF5c2hpbnZhIEthcm51cmUiLCJpYXQiOjE1MTYyMzkwMjIsImF1ZCI6Imh0dHBzOi8vZ2l0aHViLmNvbS92aWpheXNoaW52YS9rcnlwdG9zIn0.ufklYra5bLYKM-FWnmxI0Tsw_ILmTIDK0cJ7ZkPfwfE ``` +5. Generate Subresource Integrity + ``` + kryptos sri hash -u https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css + ``` ## Contributing - Fork the repo on [GitHub][git-repo]