Delphi DLL
Delphi DLL
Set the JWS Payload from a StringBuilder
See more JSON Web Signatures (JWS) Examples
Demonstrates Jws.SetPayloadSb, which sets the payload to be signed from a StringBuilder.
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 Delphi DLL Downloads
var
success: Boolean;
jws: HCkJws;
sbPayload: HCkStringBuilder;
bIncludeBom: Boolean;
begin
success := False;
jws := CkJws_Create();
// Set the payload from a StringBuilder.
sbPayload := CkStringBuilder_Create();
CkStringBuilder_Append(sbPayload,'This is the content to sign.');
bIncludeBom := False;
success := CkJws_SetPayloadSb(jws,sbPayload,'utf-8',bIncludeBom);
if (success = False) then
begin
Memo1.Lines.Add(CkJws__lastErrorText(jws));
Exit;
end;
Memo1.Lines.Add('Payload set.');
CkJws_Dispose(jws);
CkStringBuilder_Dispose(sbPayload);