Visual FoxPro
Visual FoxPro
Get a JWS Unprotected Header
See more JSON Web Signatures (JWS) Examples
Demonstrates Jws.GetUnprotectedH, which copies the optional unprotected header of a signature into a JsonObject.
Background. The unprotected header is present only in JSON serialization forms that carry one. It is not covered by the signature.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loJws
LOCAL lcJwsCompact
LOCAL loJson
lnSuccess = 0
loJws = CreateObject('Chilkat.Jws')
* Load the JWS compact serialization.
lcJwsCompact = "eyJhbGciOiJIUzI1NiJ9.VGhpcyBpcyB0aGUgY29udGVudCB0byBzaWduLg.<signature>"
lnSuccess = loJws.LoadJws(lcJwsCompact)
IF (lnSuccess = 0) THEN
? loJws.LastErrorText
RELEASE loJws
CANCEL
ENDIF
* Copy the optional unprotected header of signature 0 into a JsonObject. This applies to JWS in a
* JSON serialization form that carries an unprotected header.
loJson = CreateObject('Chilkat.JsonObject')
lnSuccess = loJws.GetUnprotectedH(0,loJson)
IF (lnSuccess = 0) THEN
? loJws.LastErrorText
RELEASE loJws
RELEASE loJson
CANCEL
ENDIF
loJson.EmitCompact = 0
? loJson.Emit()
RELEASE loJws
RELEASE loJson