PowerShell
PowerShell
Get the Entire Loaded JWE Structure
See more JSON Web Encryption (JWE) Examples
Demonstrates Jwe.GetHeader, which copies the entire currently loaded JWE structure into a JsonObject.
Background. This is the full JWE representation, not a decoded or merged JOSE header. It can contain the protected, unprotected, and per-recipient header material.
Chilkat PowerShell Downloads
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"
$success = $false
$jwe = New-Object Chilkat.Jwe
# Load the JWE.
$jweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
$success = $jwe.LoadJwe($jweCompact)
if ($success -eq $false) {
$($jwe.LastErrorText)
exit
}
# Copy the entire loaded JWE structure into a JsonObject. This is the full JWE representation, not a
# decoded or merged JOSE header.
$json = New-Object Chilkat.JsonObject
$success = $jwe.GetHeader($json)
if ($success -eq $false) {
$($jwe.LastErrorText)
exit
}
$json.EmitCompact = $false
$($json.Emit())