Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loJwe
LOCAL lcJweCompact
LOCAL loJson
lnSuccess = 0
loJwe = CreateObject('Chilkat.Jwe')
* Load the JWE.
lcJweCompact = "eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2R0NNIn0.<...>.<iv>.<ciphertext>.<tag>"
lnSuccess = loJwe.LoadJwe(lcJweCompact)
IF (lnSuccess = 0) THEN
? loJwe.LastErrorText
RELEASE loJwe
CANCEL
ENDIF
* 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.
loJson = CreateObject('Chilkat.JsonObject')
lnSuccess = loJwe.GetProtectedHeader(loJson)
IF (lnSuccess = 0) THEN
? loJwe.LastErrorText
RELEASE loJwe
RELEASE loJson
CANCEL
ENDIF
loJson.EmitCompact = 0
? loJson.Emit()
RELEASE loJwe
RELEASE loJson