LtoGenerateToken

Updated at:

Generates a data token for an IoT device.

Function prototype

int ltoGenerateToken(LtoInfo* ltoInfo);

Description

Generates a data token for an IoT device.

Parameters

typedef struct LtoInfo {
    IN char *userPlainData;                 // The user's plaintext data.
    IN int userPlainDataLen;                // The length of the user's plaintext data.
    IN char *userPrivacyData;               // The user's privacy data.
    IN int userPrivacyDataLen;              // The length of the user's privacy data.
    IN char *iotIdServiceProvider;          // For an IoT trusted device: The service provider identity, which is the product key (PK).
    IN int iotIdServiceProviderLen;         // For an IoT trusted device: The length of the service provider identity.
    IN char *iotIdSource;                   // For an IoT trusted device: The source of the service provider. Valid values: 1 for Open Platform and 2 for IoT Platform.
    IN int iotIdSourceLen;                  // For an IoT trusted device: The length of the service provider source.
    OUT char iotDataDID[64];                // For an IoT trusted device: The unique on-chain data identity.
    OUT int iotDataDIDLen;                  // For an IoT trusted device: The length of the unique on-chain data identity.
    OUT char iotId[64];                     // For an IoT trusted device: The unique identity.
    OUT int iotIdLen;                       // For an IoT trusted device: The length of the unique identity.
    OUT char iotAuthType[64];               // For an IoT trusted device: The authentication method.
    OUT int iotAuthTypeLen;                 // For an IoT trusted device: The length of the authentication method.
    OUT char iotDataDigest[65];             // For an IoT trusted device: The data digest.
    OUT int iotDataDigestLen;               // For an IoT trusted device: The length of the data digest.
    OUT char iotDataToken[256];             // For an IoT trusted device: The data token.
    OUT int iotDataTokenLen;                // For an IoT trusted device: The length of the data token.
} LtoInfo;

Return value

0: The operation was successful.

Other values: The operation failed.