Sample code for 30+ languages & platforms
Visual FoxPro

Set the JWS Payload from BinData

See more JSON Web Signatures (JWS) Examples

Demonstrates Jws.SetPayloadBd, which sets the payload to be signed from the binary bytes in a BinData.

Background. JWS (JSON Web Signature) integrity-protects a payload with a signature or MAC. The header alg names the algorithm; this example uses HMAC-SHA256 (HS256) with a symmetric MAC key.

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loJws
LOCAL loBdPayload

lnSuccess = 0

loJws = CreateObject('Chilkat.Jws')

*  Set the payload from the binary bytes in a BinData.
loBdPayload = CreateObject('Chilkat.BinData')
loBdPayload.AppendString("Binary content to sign.","utf-8")

lnSuccess = loJws.SetPayloadBd(loBdPayload)
IF (lnSuccess = 0) THEN
    ? loJws.LastErrorText
    RELEASE loJws
    RELEASE loBdPayload
    CANCEL
ENDIF

? "Payload set."

RELEASE loJws
RELEASE loBdPayload