AddHeaderParam Method
Adds additional header parameters.
procedure AddHeaderParam(name: String; value: String; dataType: Integer);
Remarks
This method is used to add additional header parameters before calling Sign.
The Name and Value parameters define the name and value of the parameter respectively. The DataType parameter specifies the JSON data type of the value. Possible values for DataType are:
- 0 (Object)
- 1 (Array)
- 2 (String)
- 3 (Number)
- 4 (Bool)
- 5 (Null)
{
"alg": "HS512",
"crit": [
"exp"
],
"exp": 12345687,
"kid": "myKeyId",
"type": "JWT"
}
The following code can be used:
jws.Algorithm = JwsAlgorithms.jwsHS512;
jws.KeyId = "myKeyId";
jws.KeyB = key;
jws.AddHeaderParam("type", "JWT", 2);
jws.AddHeaderParam("crit", "[\"exp\"]", 1);
jws.AddHeaderParam("exp", "12345687", 3);
jws.InputMessage = "test";
jws.Sign();
string signedData = jws.OutputMessage;
Note: when calling Sign the component will automatically add some headers based on properties that are set.
Parameters Automatically Set:
Header Param | Property |
alg | Algorithm |
kid | KeyId |