Sample code for 30+ languages & platforms
Visual Basic 6.0

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 Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

Dim jwe As New ChilkatJwe

'  Load the JWE.
Dim jweCompact As String
jweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
success = jwe.LoadJwe(jweCompact)
If (success = 0) Then
    Debug.Print 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 ChilkatJsonObject
success = jwe.GetHeader(json)
If (success = 0) Then
    Debug.Print jwe.LastErrorText
    Exit Sub
End If

json.EmitCompact = 0
Debug.Print json.Emit()