jwtAlgGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.70.00


jwtAlgGet returns the encryption algorithm used by the JWT object.

 

Should be used every time a JWT has been decoded with jwtDecodeAsym and jwtDecodeSym to validate that it was correctly signed.

Can also be used to get the value set with jwtAlgSetAsym and jwtAlgSetSym.

 

Input:

jwt : SYSHANDLE

The JWT object to check.

 

Returns: INT

The encryption algorithm used:

9

- ES512

8

- ES384

7

- ES256

6

- RS512

5

- RS384

4

- RS256

3

- HS512

2

- HS384

1

- HS256

0

- No encryption

-2

- Could not find JWT object.

 

 

Declaration:

FUNCTION jwtAlgGet : INT;
VAR_INPUT
  jwt   : SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc  : INT;
  jwt : SYSHANDLE;
END_VAR;
 
BEGIN
  ...
  // Get algorithm
  rc := jwtAlgGet(jwt := jwt);
  ...
END;
 
END_PROGRAM;