DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoJws
Variant vBdPayload
Handle hoBdPayload
String sTemp1
Move False To iSuccess
Get Create (RefClass(cComChilkatJws)) To hoJws
If (Not(IsComObjectCreated(hoJws))) Begin
Send CreateComObject of hoJws
End
// Set the payload from the binary bytes in a BinData.
Get Create (RefClass(cComChilkatBinData)) To hoBdPayload
If (Not(IsComObjectCreated(hoBdPayload))) Begin
Send CreateComObject of hoBdPayload
End
Get ComAppendString Of hoBdPayload "Binary content to sign." "utf-8" To iSuccess
Get pvComObject of hoBdPayload to vBdPayload
Get ComSetPayloadBd Of hoJws vBdPayload To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoJws To sTemp1
Showln sTemp1
Procedure_Return
End
Showln "Payload set."
End_Procedure