Sample code for 30+ languages & platforms
Xojo Plugin

Get the JWE Protected Header

See more JSON Web Encryption (JWE) Examples

Demonstrates Jwe.GetProtectedHeader, which copies the decoded shared JWE protected header into a JsonObject.

Background. Only the protected header is returned; it is not merged with the shared unprotected header or any per-recipient header.

Chilkat Xojo Plugin Downloads

Xojo Plugin
Dim success As Boolean
success = False

Dim jwe As New Chilkat.Jwe

//  Load the JWE.
Dim jweCompact As String
jweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
success = jwe.LoadJwe(jweCompact)
If (success = False) Then
    System.DebugLog(jwe.LastErrorText)
    Return
End If

//  Copy the decoded shared JWE protected header into a JsonObject.  Only the protected header is
//  returned; it is not merged with the unprotected or per-recipient headers.
Dim json As New Chilkat.JsonObject
success = jwe.GetProtectedHeader(json)
If (success = False) Then
    System.DebugLog(jwe.LastErrorText)
    Return
End If

json.EmitCompact = False
System.DebugLog(json.Emit())