PowerBuilder
PowerBuilder
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 PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Jws
oleobject loo_BdPayload
li_Success = 0
loo_Jws = create oleobject
li_rc = loo_Jws.ConnectToNewObject("Chilkat.Jws")
if li_rc < 0 then
destroy loo_Jws
MessageBox("Error","Connecting to COM object failed")
return
end if
// Set the payload from the binary bytes in a BinData.
loo_BdPayload = create oleobject
li_rc = loo_BdPayload.ConnectToNewObject("Chilkat.BinData")
loo_BdPayload.AppendString("Binary content to sign.","utf-8")
li_Success = loo_Jws.SetPayloadBd(loo_BdPayload)
if li_Success = 0 then
Write-Debug loo_Jws.LastErrorText
destroy loo_Jws
destroy loo_BdPayload
return
end if
Write-Debug "Payload set."
destroy loo_Jws
destroy loo_BdPayload