< Summary - Kestrun — Combined Coverage

Information
Class: Public.JWT.Get-KrJwkThumbprint
Assembly: Kestrun.PowerShell.Public
File(s): /home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/JWT/Get-KrJwkThumbprint.ps1
Tag: Kestrun/Kestrun@0d738bf294e6281b936d031e1979d928007495ff
Line coverage
0%
Covered lines: 0
Uncovered lines: 5
Coverable lines: 5
Total lines: 46
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 11/19/2025 - 02:25:56 Line coverage: 0% (0/5) Total lines: 45 Tag: Kestrun/Kestrun@98ff905e5605a920343154665980a71211a03c6d12/12/2025 - 17:27:19 Line coverage: 0% (0/5) Total lines: 46 Tag: Kestrun/Kestrun@826bf9dcf9db118c5de4c78a3259bce9549f0dcd

Metrics

File(s)

/home/runner/work/Kestrun/Kestrun/src/PowerShell/Kestrun/Public/JWT/Get-KrJwkThumbprint.ps1

#LineLine coverage
 1<#
 2.SYNOPSIS
 3    Computes an RFC 7638 JWK thumbprint for an RSA key.
 4
 5.DESCRIPTION
 6    Returns the Base64Url-encoded SHA-256 hash of the canonical JWK (RSA) built from the key's n and e values.
 7    You can provide either an X509Certificate2 (preferred) or a JWK hashtable with kty='RSA', n and e.
 8
 9.PARAMETER Certificate
 10    X.509 certificate containing an RSA public key.
 11
 12.PARAMETER Jwk
 13    Hashtable representing an RSA JWK with keys: kty, n, e.
 14
 15.EXAMPLE
 16    Get-KrJwkThumbprint -Certificate $cert
 17
 18.EXAMPLE
 19    Get-KrJwkThumbprint -Jwk @{ kty='RSA'; n=$n; e=$e }
 20#>
 21function Get-KrJwkThumbprint {
 22    [KestrunRuntimeApi('Everywhere')]
 23    [CmdletBinding(DefaultParameterSetName = 'Certificate')]
 24    [OutputType([string])]
 25    param(
 26        [Parameter(Mandatory, ParameterSetName = 'Certificate', Position = 0)]
 27        [System.Security.Cryptography.X509Certificates.X509Certificate2]
 28        $Certificate,
 29
 30        [Parameter(Mandatory, ParameterSetName = 'Jwk', Position = 0)]
 31        [hashtable]
 32        $Jwk
 33    )
 34
 035    switch ($PSCmdlet.ParameterSetName) {
 36        'Certificate' {
 037            return [Kestrun.Jwt.JwkUtilities]::ComputeThumbprintFromCertificate($Certificate)
 38        }
 39        'Jwk' {
 040            if (-not $Jwk.kty -or $Jwk.kty -ne 'RSA' -or -not $Jwk.n -or -not $Jwk.e) {
 041                throw "JWK must include kty='RSA', n and e"
 42            }
 043            return [Kestrun.Jwt.JwkUtilities]::ComputeThumbprintRsa([string]$Jwk.n, [string]$Jwk.e)
 44        }
 45    }
 46}

Methods/Properties

Get-KrJwkThumbprint()