-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
vijayshinva
committed
Nov 21, 2020
1 parent
3838657
commit ecebeed
Showing
4 changed files
with
53 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.CommandLine; | ||
using System.CommandLine.Invocation; | ||
using System.CommandLine.IO; | ||
using System.IO; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
|
||
namespace Kryptos | ||
{ | ||
public static class WireUpOidExtensions | ||
{ | ||
public static RootCommand WireUpOidCommands(this RootCommand rootCommand) | ||
{ | ||
Command oidCommand = new Command("oid", "Cryptographic object identifier"); | ||
oidCommand.AddOption(new Option<string>(new string[] { "--text", "-t" }, "Input Text")); | ||
|
||
oidCommand.Handler = CommandHandler.Create<string, IConsole>((text, console) => | ||
{ | ||
try | ||
{ | ||
var oid = new Oid(text); | ||
|
||
console.Out.WriteLine($"{oid.FriendlyName} : {oid.Value}"); | ||
} | ||
catch (Exception ex) | ||
{ | ||
console.Out.WriteLine(ex.Message); | ||
return 22; | ||
} | ||
return 0; | ||
}); | ||
|
||
rootCommand.AddCommand(oidCommand); | ||
|
||
return rootCommand; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,27 +49,28 @@ kryptos --help | |
``` | ||
|
||
## Examples | ||
1. Generate Base64 encoded string | ||
``` | ||
kryptos base64 enc -t "The quick brown fox jumps over the lazy dog." | ||
``` | ||
2. Decode Base64 encoded string | ||
|
||
1. Decode Base64 encoded string | ||
``` | ||
kryptos base64 dec -t "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4=" | ||
``` | ||
3. Generate SHA-256 hash of file | ||
2. Generate SHA-256 hash of file | ||
``` | ||
kryptos sha256 hash -i .\ubuntu-20.04-desktop-amd64.iso | ||
``` | ||
4. Decode a JWT token | ||
3. Decode a JWT token | ||
``` | ||
kryptos jwt dec -t eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IlZpamF5c2hpbnZhIEthcm51cmUiLCJpYXQiOjE1MTYyMzkwMjIsImF1ZCI6Imh0dHBzOi8vZ2l0aHViLmNvbS92aWpheXNoaW52YS9rcnlwdG9zIn0.ufklYra5bLYKM-FWnmxI0Tsw_ILmTIDK0cJ7ZkPfwfE | ||
``` | ||
5. Generate Subresource Integrity | ||
4. Generate Subresource Integrity | ||
``` | ||
kryptos sri hash -u https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css | ||
``` | ||
5. Look up Cryptographic Object Identifier | ||
``` | ||
kryptos oid -t 1.3.6.1.5.5.7.3.1 | ||
``` | ||
## Contributing | ||
- Fork the repo on [GitHub][git-repo] | ||
- Clone the project to your own machine | ||
|