RW7.DotNetSecurityTools.JsonWebKeyCreator 2.1.0

dotnet tool install --global RW7.DotNetSecurityTools.JsonWebKeyCreator --version 2.1.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local RW7.DotNetSecurityTools.JsonWebKeyCreator --version 2.1.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=RW7.DotNetSecurityTools.JsonWebKeyCreator&version=2.1.0                
nuke :add-package RW7.DotNetSecurityTools.JsonWebKeyCreator --version 2.1.0                

.NET Main

dotnet-security-tools

A collection of convenient security related .NET tools.

JSON Web Keys (JWKs)

Library and Tooling for creating Json Web Keys (JWKs)

JsonWebKeyCreator.Core (Library/Package)

Installation

dotnet add package RW7.DotNetSecurityTools.JsonWebKeyCreator.Core --version 1.0.0

Usage

// Create a new instance using the default ctor -
var jsonWebKeyCreator = new JsonWebKeyCreator();

// Create a new JWK -
var jsonWebKeyOutput = jsonWebKeyCreator.Create();

The JsonWebKeyOutput type looks like this -

public class JsonWebKeyOutput
{
    // Internal .NET JsonWebKey type
    public JsonWebKey JsonWebKey { get; }

    // JSON serialized representation of the .NET JsonWebKey type
    public string JsonWebKeyString { get; }

    // Base64 encoded representation of the JSON serialized string
    public string Base64JsonWebKey { get; }

    // PEM Encoded RSA Public Key used to create the JWK
    public string RsaPublicKey { get; }

    // PEM Encoded RSA Private Key used to create the JWK
    public string RsaPrivateKey { get; }
}

JsonWebKeyCreator (Tooling)

Installation

dotnet tool install --global RW7.DotNetSecurityTools.JsonWebKeyCreator

Once installed, simply run the following command -

create-jwk

By default, this will outputs the following to the console -

  • The full JsonWebKey itself (including private key parts)

Additional command line are as follows -

-t | --output-types

Where the JWK should be output to. Supported options are -

  • Console
  • File

Multiple can be specified (values are case-insensitive), comma separated and in quotes.

For example -

--output-type "console, file"

If not specified, then defaults to Console.


-d | --directory

If File is specified as an output type, this is the directory the files will be created in.

If not specified (and File is), then the value will default to [user temp folder]/[current ticks]. The resulting directory will be written in the log entries.

N.B. The directory structure will be created if it doesn't currently exist.

The following files will be written -

  • JsonWebKey.jwk - the contents of the JsonWebKey in indentended Json format.
  • RsaPublicKey.pem - the PEM encoded RSA Public Key for the JsonWebKey.
  • RsaPrivateKey.pem - the PEM encoded RSA Private Key used for the JsonWebKey.
-b | --output-base64

Whether to output the JWK Base64 encoded representation

-r | --output-rsa-keys

Whether to output the PEM encoded RSA Keys used to create the JWK


Client Credentials

Library and Tooling for creating Client Credentials (ID and Secret), for use with, for example, OIDC or OAuth2.0 clients.

ClientCredentialsCreator.Core (Library/Package)

Installation

dotnet add package RW7.DotNetSecurityTools.ClientCredentialsCreator.Core

Usage

// Create a new instance using the default ctor -
var clientCredentialsCreator = new ClientCredentialsCreator();

// Create a new Client Credentials set -
var clientCredentials = clientCredentialsCreator.Create();

The JsonWebKeyOutput type looks like this -

public class JsonWebKeyOutput
{
public class ClientCredentialsOutput
{
    // The Client Id
    public string ClientId { get; }
    
    // the Client Secret
    public string ClientSecret { get; }
}

ClientCredentialsCreator (Tooling)

Installation

dotnet tool install --global RW7.DotNetSecurityTools.ClientCredentialsCreator

Usage

create-client-credentials

By default, this will outputs the following to the console -

  • The Client ID
  • The Client Secret

Additional command line are as follows -

-t | --output-types

Where the JWK should be output to. Supported options are -

  • Console
  • File

Multiple can be specified (values are case-insensitive), comma separated and in quotes.

For example -

--output-type "console, file"

If not specified, then defaults to Console.


-d | --directory

If File is specified as an output type, this is the directory the files will be created in.

If not specified (and File is), then the value will default to [user temp folder]/[current ticks]. The resulting directory will be written in the log entries.

N.B. The directory structure will be created if it doesn't currently exist.

The following files will be written -

  • ClientCredentials.txt - the Client ID and Client Secert, in clear text.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.1.0 188 3/10/2024
2.0.0 156 3/9/2024
1.1.0 487 11/22/2021
1.0.0 696 11/21/2021
0.6.0 510 2/28/2021
0.5.0 505 2/21/2021
0.4.0 497 2/20/2021
0.3.0 480 2/19/2021
0.2.0 460 2/15/2021
0.1.0 439 2/14/2021