Rate This Document
Findability
Accuracy
Completeness
Readability

KdcTrustedRequest

Unified API of kdc_proxy, supporting the query of multiple trusted attributes.

Prototype

uint32_t KdcTrustedRequest(
uint32_t requestType,
const char *input,
uint32_t inputLen,
char **output,
uint32_t *outputLen
);

Parameters

Parameter

Type

Required (Yes/No)

Description

requestType

uint32_t

Yes

Query type, which specifies the type of trusted attribute requested.

input

const char*

Yes

Input parameter, which is a JSON-formatted string.

inputLen

uint32_t

Yes

Input parameter length.

output

char**

Yes (output)

Output parameter, which is a JSON-formatted string and must be released by calling KdcFreePtr.

outputLen

uint32_t*

Yes (output)

Output parameter length.

Return Values

Return Value

Description

0

Success

Non-zero

Failure (error code returned)

RequestType Definition

Value

Description

0x0010

Obtaining a trusted environment token

0x0011

Verifying the token of the trusted environment

0x0021

Generating a CSR

0x0022

Signing data

0x0030

Querying the trusted time status

0x0032

Obtaining the log public key

0x0033

Signing log data

0x0034

Reporting file access information

0x0035

Querying the file access count

For details about the input and output formats of specific services, see the data object of the internal service RESTful API.

  • In the trusted log signature and verification scenario, you need to obtain the log public key (0x0032) and then request the log data signature (0x0033).
  • In the trusted identity authentication scenario, you need to generate a CSR (0x0021) and then request the data signature (0x0022).

Input Format Example (Querying File Access Count)

{
"filename": "file1"
}

Output Format Example

{
"times": 5
}

Examples

const char *input = "{\"filename\":\"file1\"}";
char *output = NULL;
uint32_t outputLen = 0;
uint32_t ret = KdcTrustedRequest(0x0035, input, strlen(input), &output, &outputLen);
if (ret == 0){
printf("Result: %s\n", output);
KdcFreePtr(output);
}