AutoIt
AutoIt
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 AutoIt Downloads
Local $bSuccess = False
$oJwe = ObjCreate("Chilkat.Jwe")
; Load the JWE.
Local $sJweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
$bSuccess = $oJwe.LoadJwe($sJweCompact)
If ($bSuccess = False) Then
ConsoleWrite($oJwe.LastErrorText & @CRLF)
Exit
EndIf
; Copy the entire loaded JWE structure into a JsonObject. This is the full JWE representation, not a
; decoded or merged JOSE header.
$oJson = ObjCreate("Chilkat.JsonObject")
$bSuccess = $oJwe.GetHeader($oJson)
If ($bSuccess = False) Then
ConsoleWrite($oJwe.LastErrorText & @CRLF)
Exit
EndIf
$oJson.EmitCompact = False
ConsoleWrite($oJson.Emit() & @CRLF)