Visual FoxPro
Visual FoxPro
Set the JWS Protected Header
See more JSON Web Signatures (JWS) Examples
Demonstrates Jws.SetProtectedHeader, which sets the integrity-protected header for a signer from a JsonObject. The header specifies the signature algorithm (alg).
Background. The protected header is covered by the signature, so it cannot be altered without invalidating the JWS. It is configured before creating the JWS.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loJws
LOCAL loHeader
lnSuccess = 0
loJws = CreateObject('Chilkat.Jws')
* Build the JWS protected header. The "alg" member names the signature algorithm.
loHeader = CreateObject('Chilkat.JsonObject')
loHeader.UpdateString("alg","HS256")
* Set the protected header for signer index 0. The protected header is integrity-protected: it is
* covered by the signature.
lnSuccess = loJws.SetProtectedHeader(0,loHeader)
IF (lnSuccess = 0) THEN
? loJws.LastErrorText
RELEASE loJws
RELEASE loHeader
CANCEL
ENDIF
? "Protected header set."
RELEASE loJws
RELEASE loHeader