Sample code for 30+ languages & platforms
VBScript

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 VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set jwe = CreateObject("Chilkat.Jwe")

'  Load the JWE.
jweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
success = jwe.LoadJwe(jweCompact)
If (success = 0) Then
    outFile.WriteLine(jwe.LastErrorText)
    WScript.Quit
End If

'  Copy the entire loaded JWE structure into a JsonObject.  This is the full JWE representation, not a
'  decoded or merged JOSE header.
set json = CreateObject("Chilkat.JsonObject")
success = jwe.GetHeader(json)
If (success = 0) Then
    outFile.WriteLine(jwe.LastErrorText)
    WScript.Quit
End If

json.EmitCompact = 0
outFile.WriteLine(json.Emit())

outFile.Close