AutoIt
AutoIt
Get the JWS Payload into BinData
See more JSON Web Signatures (JWS) Examples
Demonstrates Jws.GetPayloadBd, which writes the payload of a loaded JWS as raw bytes into a BinData.
Background. This is used when the payload is binary. In practice, validate the signature before trusting the payload.
Chilkat AutoIt Downloads
Local $bSuccess = False
$oJws = ObjCreate("Chilkat.Jws")
; Load the JWS compact serialization.
Local $sJwsCompact = "eyJhbGciOiJIUzI1NiJ9.VGhpcyBpcyB0aGUgY29udGVudCB0byBzaWduLg.<signature>"
$bSuccess = $oJws.LoadJws($sJwsCompact)
If ($bSuccess = False) Then
ConsoleWrite($oJws.LastErrorText & @CRLF)
Exit
EndIf
; Get the JWS payload as raw bytes into a BinData.
$oBdPayload = ObjCreate("Chilkat.BinData")
$bSuccess = $oJws.GetPayloadBd($oBdPayload)
If ($bSuccess = False) Then
ConsoleWrite($oJws.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Payload is " & $oBdPayload.NumBytes & " bytes." & @CRLF)