### Full Licensing API Usage Example Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Demonstrates various licensing operations including login, session info retrieval, memory read/write, encryption/decryption, time retrieval, and logout. ```go L := licensingApi.NewLicenseApi() /* login to default feature (0) */ /* this default feature is available on any key */ /* search for local and remote HASP key */ handle, err := L.HaspLogin(HASP_DEFAULT_FID, vendor_code) if err != 0 { fmt.Printf("login to default feature failed, err code : %d\n", err) return } else { fmt.Printf("login to default feature success\n") } /* * hasp_get_sessioninfo * retrieve Sentinel key attributes * * Please note: In case of performing an activation we recommend to use * hasp_get_info() instead of hasp_get_sessioninfo(), as * demonstrated in the activation sample. hasp_get_info() * can be called without performing a login. */ format := "" info, err := L.HaspGetSessionInfo(handle, format) if err != 0 { fmt.Printf("get session info failed, err code : %d\n", err) } else { fmt.Printf("get session info success, %s\n", info) } /* * hasp_get_size * retrieve the memory size of the HASP key * you can also retrieve dynamic memory file size, * only need to pass the dynamic memory file id which * created in token */ var size uint err = L.HaspGetSize(handle, HASP_FILEID_RW, &size) if err != 0 { fmt.Printf("get size failed, err code : %d\n", err) } else { fmt.Printf("sentinel memory size is %d bytes\n", size) } /* * hasp_write * write to HASP memory * you can also write dynamic memory file, * only need to pass the dynamic memory file id which * created in token */ var data [64]byte size = 64 for i := 0; i < int(size); i++ { data[i] = byte(i) } err = L.HaspWrite(handle, HASP_FILEID_RW, 0, /* offset */ size, /* length */ &data[0]) if err != 0 { fmt.Printf("write memory failed, err code : %d\n", err) } else { fmt.Printf("write memory success, data = %v\n", data) } /* * hasp_read * read from HASP memory * you can also read dynamic memory file, * only need to pass the dynamic memory file id which * created in token */ err = L.HaspRead(handle, HASP_FILEID_RW, /* read/write file ID */ 0, /* offset */ size, /* length */ &data[0]) /* file data */ if err != 0 { fmt.Printf("read memory failed, err code : %d\n", err) } else { fmt.Printf("read memory success, data = %v\n", data) } /* * hasp_encrypt * encrypts a block of data using the HASP key * (minimum buffer size is 16 bytes) */ size = 64 err = L.HaspEncrypt(handle, &data[0], size) if err != 0 { fmt.Printf("encrypt failed, err code : %d\n", err) } else { fmt.Printf("encrypt success, encrypted data = %v\n", data) } /* * hasp_decrypt * decrypts a block of data using the HASP key * (minimum buffer size is 16 bytes) */ size = 64 err = L.HaspDecrypt(handle, &data[0], size) if err != 0 { fmt.Printf("decrypt failed, err code : %d\n", err) } else { fmt.Printf("decrypt success, decrypted data = %v\n", data) } /* * hasp_get_rtc * read current time from HASP Time key */ var time uint64 err = L.HaspGetRtc(handle, &time) if err != 0 { fmt.Printf("get rtc failed, err code : %d\n", err) } else { fmt.Printf("get rtc success, time: %d\n", time) } /* * hasp_logout * closes established session and releases allocated memory */ err = L.HaspLogout(handle) if err != 0 { fmt.Printf("logout failed, err code : %d\n", err) } else { fmt.Printf("logout success\n") } ``` -------------------------------- ### Set up LDK environment variables Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Configure CGO_LDFLAGS and LD_LIBRARY_PATH for Sentinel LDK on Linux. Ensure the folder path is correctly specified. ```shell go env -w CGO_LDFLAGS="-g -O2 -L" export LD_LIBRARY_PATH= ``` -------------------------------- ### Import Licensing API Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Import the native licensing API package for use in your Go application. ```go import licensingApi "github.com/thalesgroupsm/ldk-golang-licensing-native-api" ``` -------------------------------- ### LicensingApi HaspGetInfo Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Retrieves general information about the licensing system. ```APIDOC ## HaspGetInfo ### Description Retrieves general information about the licensing system. ### Method GET ### Endpoint /hasp/get_info ### Parameters #### Query Parameters - **scope** (string) - Required - The scope for which to retrieve information. - **format** (string) - Required - The desired format for the information. - **vendor_code** (string) - Required - The vendor code for authentication. ### Response #### Success Response (200) - **info** (string) - The requested information. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### AdminApi SntlAdminContextNewScope Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Creates a new administrative context with a specified scope. ```APIDOC ## SntlAdminContextNewScope ### Description Creates a new administrative context. ### Method POST ### Endpoint /admin/context/new_scope ### Parameters #### Query Parameters - **scope** (string) - Required - The scope for the new context. ### Response #### Success Response (200) - **context** (uintptr) - A handle to the new administrative context. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspRead Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Reads data from a file within the licensing system. ```APIDOC ## HaspRead ### Description Reads data from a specified file. ### Method GET ### Endpoint /hasp/read ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **file_id** (uint) - Required - The ID of the file. - **offset** (uint) - Required - The offset within the file to start reading. - **len** (uint) - Required - The number of bytes to read. - **data** (*byte) - Required - A pointer to store the read data. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspLoginScope Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Logs into the licensing system with a given feature ID, scope, and vendor code. ```APIDOC ## HaspLoginScope ### Description Logs into the licensing system with a specified scope. ### Method POST ### Endpoint /hasp/login_scope ### Parameters #### Query Parameters - **feature_id** (int) - Required - The ID of the feature to log in. - **scope** (string) - Required - The scope for the login. - **vendor_code** (string) - Required - The vendor code for authentication. ### Response #### Success Response (200) - **handle** (uintptr) - A handle to the logged-in session. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspWrite Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Writes data to a file within the licensing system. ```APIDOC ## HaspWrite ### Description Writes data to a specified file. ### Method POST ### Endpoint /hasp/write ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **file_id** (uint) - Required - The ID of the file. - **offset** (uint) - Required - The offset within the file to start writing. - **len** (uint) - Required - The number of bytes to write. - **data** (*byte) - Required - A pointer to the byte data to write. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspLogin Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Logs into the licensing system with a given feature ID and vendor code. ```APIDOC ## HaspLogin ### Description Logs into the licensing system. ### Method POST ### Endpoint /hasp/login ### Parameters #### Query Parameters - **feature_id** (int) - Required - The ID of the feature to log in. - **vendor_code** (string) - Required - The vendor code for authentication. ### Response #### Success Response (200) - **handle** (uintptr) - A handle to the logged-in session. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspLogout Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Logs out of the licensing system using a provided handle. ```APIDOC ## HaspLogout ### Description Logs out of the licensing system. ### Method POST ### Endpoint /hasp/logout ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session to log out. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### AdminApi SntlAdminSet Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Sets an administrative parameter within a given context. ```APIDOC ## SntlAdminSet ### Description Sets an administrative parameter. ### Method POST ### Endpoint /admin/set ### Parameters #### Query Parameters - **context** (uintptr) - Required - The administrative context handle. - **input** (string) - Required - The input string containing the parameter to set. ### Response #### Success Response (200) - **status** (string) - The status of the operation. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspUpdate Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Applies an update to the licensing system. ```APIDOC ## HaspUpdate ### Description Applies an update to the licensing system. ### Method POST ### Endpoint /hasp/update ### Parameters #### Query Parameters - **update_data** (string) - Required - The update data. ### Response #### Success Response (200) - **info** (string) - Information about the update process. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspGetSessionInfo Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Retrieves session information in a specified format. ```APIDOC ## HaspGetSessionInfo ### Description Retrieves session information. ### Method GET ### Endpoint /hasp/get_session_info ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **format** (string) - Required - The desired format for the information. ### Response #### Success Response (200) - **info** (string) - The session information. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspGetSize Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Retrieves the size of a file within the licensing system. ```APIDOC ## HaspGetSize ### Description Retrieves the size of a specified file. ### Method GET ### Endpoint /hasp/get_size ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **file_id** (int) - Required - The ID of the file. - **size** (*uint) - Required - A pointer to store the file size. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspGetRtc Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Retrieves the real-time clock value from the licensing system. ```APIDOC ## HaspGetRtc ### Description Retrieves the real-time clock value. ### Method GET ### Endpoint /hasp/get_rtc ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **time** (*uint64) - Required - A pointer to store the real-time clock value. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### AdminApi SntlAdminGet Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Retrieves administrative information within a given context and scope. ```APIDOC ## SntlAdminGet ### Description Retrieves administrative information. ### Method GET ### Endpoint /admin/get ### Parameters #### Query Parameters - **context** (uintptr) - Required - The administrative context handle. - **scope** (string) - Required - The scope for which to retrieve information. - **format** (string) - Required - The desired format for the information. ### Response #### Success Response (200) - **info** (string) - The requested administrative information. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspEncrypt Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Encrypts data using the provided handle and data buffer. ```APIDOC ## HaspEncrypt ### Description Encrypts data using the provided session handle. ### Method POST ### Endpoint /hasp/encrypt ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **data** (*byte) - Required - A pointer to the byte data to encrypt. - **size** (uint) - Required - The size of the data buffer. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspTransfer Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Performs a license transfer operation. ```APIDOC ## HaspTransfer ### Description Performs a license transfer operation. ### Method POST ### Endpoint /hasp/transfer ### Parameters #### Query Parameters - **action** (string) - Required - The action to perform (e.g., 'transfer_out', 'transfer_in'). - **scope** (string) - Required - The scope of the transfer. - **vendor_code** (string) - Required - The vendor code for authentication. - **recipient** (string) - Required - The recipient of the transfer. ### Response #### Success Response (200) - **output** (string) - The result of the transfer operation. - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### AdminApi SntlAdminContextDelete Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Deletes an administrative context. ```APIDOC ## SntlAdminContextDelete ### Description Deletes an administrative context. ### Method POST ### Endpoint /admin/context/delete ### Parameters #### Query Parameters - **context** (uintptr) - Required - The administrative context handle to delete. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` -------------------------------- ### LicensingApi HaspDecrypt Source: https://github.com/thalesgroupsm/ldk-golang-licensing-native-api/blob/main/README.md Decrypts data using the provided handle and data buffer. ```APIDOC ## HaspDecrypt ### Description Decrypts data using the provided session handle. ### Method POST ### Endpoint /hasp/decrypt ### Parameters #### Query Parameters - **handle** (uintptr) - Required - The handle of the session. - **data** (*byte) - Required - A pointer to the byte data to decrypt. - **size** (uint) - Required - The size of the data buffer. ### Response #### Success Response (200) - **err** (int) - An error code indicating success (0) or failure. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.