Sample code for 30+ languages & platforms
VB.NET

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 VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim jwe As New Chilkat.Jwe

'  Load the JWE.
Dim jweCompact As String = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
success = jwe.LoadJwe(jweCompact)
If (success = False) Then
    Debug.WriteLine(jwe.LastErrorText)
    Exit Sub
End If


'  Copy the entire loaded JWE structure into a JsonObject.  This is the full JWE representation, not a
'  decoded or merged JOSE header.
Dim json As New Chilkat.JsonObject
success = jwe.GetHeader(json)
If (success = False) Then
    Debug.WriteLine(jwe.LastErrorText)
    Exit Sub
End If


json.EmitCompact = False
Debug.WriteLine(json.Emit())