Obtaining a Trusted Environment Token
The connector calls this API to obtain a trusted environment token, which is used for subsequent environment report verification. Ensure that the scheduled challenge task is enabled.
Item |
Description |
|---|---|
API path |
/rest/kdc_agent/v1/proxy |
Request method |
POST |
requestType |
0x0010 |
Request Header
Parameter |
Value |
|---|---|
Content-Type |
application/json |
Accept |
application/json |
Request Body
The input parameter in the request is an empty JSON string.
Parameter |
Type |
Specification |
Required (Yes/No) |
Description |
|---|---|---|---|---|
input |
String |
- |
Yes |
Empty JSON string "{}" |
Request Body Example
{}
Response Header
Parameter |
Value |
|---|---|
Content-Type |
application/json |
Response Body
Parameter |
Type |
Specification |
Required (Yes/No) |
Description |
|---|---|---|---|---|
retCode |
Int |
32 |
Yes |
Error code |
retMsg |
String |
64 |
Yes |
Error message |
data |
Object |
- |
Yes |
Custom service data |
data.token |
String |
8192 |
Yes |
Trusted environment token (in JWT format) |
Response Body Example
{
"retCode": 0,
"retMsg": "Success",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
}
Examples
const char *input = "{}";
char *output = NULL;
uint32_t outputLen = 0;
uint32_t ret = KdcTrustedRequest(0x0010, input, strlen(input), &output, &outputLen);
if (ret == 0 && output != NULL) {
// Parse the output to obtain the token.
// Send the token to the connector for report verification.
KdcFreePtr(output);
}
Parent topic: Trusted Environment API