Git Product home page Git Product logo

Comments (2)

anthonyg-1 avatar anthonyg-1 commented on May 28, 2024

Can you share your code that isn't working as well as what operating system? Are you trying to create a JSON Web Token or JSON Web Key? If you're trying to create a RS256 signed JWT you'll need a PFX file. Here's how that's done (per the readme and comment-based help for New-JsonWebToken):

# Create an RSA-SHA256 signed JWT with a five minute lifetime
$cert = Get-PfxCertificate -FilePath "~/certs/cert.pfx"
$jwt = New-JsonWebToken -Claims @{sub="[email protected]"} -HashAlgorithm SHA256 -Certificate $cert -TimeToLive 300

If you're trying to create a JWK (JSON Web Key) or JWK set, here's how that's done:

# Certificate to be used for all examples below:
$cert = Get-PfxCertificate -FilePath "~/certs/cert.pfx"

# 1. Generate JWK set from certificate with thumbprint A80260EBE2E455429A702E9E6A0FD01C3F902C6B:
$cert | New-JsonWebKeySet

# 2. Generate JSON Web Key from certificate with thumbprint A80260EBE2E455429A702E9E6A0FD01C3F902C6B:
$cert | New-JsonWebKey

# 3. Generate JWK set from certificate with thumbprint A80260EBE2E455429A702E9E6A0FD01C3F902C6B and compress the output:
$cert | New-JsonWebKeySet -Compress

# Create an RSA-SHA256 signed JWT with a five minute lifetime
$cert = Get-PfxCertificate -FilePath "~/certs/cert.pfx"

from psjsonwebtoken.

Mindless999 avatar Mindless999 commented on May 28, 2024

It might be that I have misinterpreted the use of the JWK / JWT. For now it seems that we will be dropping this. Thank you for explaining

from psjsonwebtoken.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.