Write Function
Description
Writes to the memory of a Sentinel protection key.
Syntax
hasp_status_t HASP_CALLCONV hasp_write(
hasp_handle_t handle,
hasp_fileid_t fileid,
hasp_size_t offset,
hasp_size_t length,
CONST void *buffer
)
Parameters
|
|
Handle for the session |
|
|
Identifier for the file to write. Possible values are: >For default read/write memory: HASP_FILEID_RW >For a dynamic memory file (read/write or read/write-once): The ID that was assigned to the file when the file was created. The ID is a value from 1 through 65471. NOTE Dynamic memory files are supported by Sentinel SL keys and Sentinel HL (Driverless configuration) keys (excluding HL Basic and HL Pro keys). |
|
|
Byte offset in the file |
|
|
Number of bytes to be written to the file |
|
|
Pointer to the data that is written |
Return Values
HASP_IDENTITY_RATE_LIMIT_EXCEEDED
Usage Notes
When this function is called, a write cycle is performed for the Sentinel protection key. Sentinel HL keys are certified to withstand a specific number of write cycles. For information on the number of write cycles for which Sentinel HL keys are certified, see the Sentinel HL Data Sheet.
NOTE To defeat a protection key emulator attempting to bypass software protection, you can check periodically that the protection key is available and that a session for the key exists. This should not be done using GetSessionInfo (this function does not detect a remote broken session). Instead, use one of the following functions: Encrypt, Decrypt, Read, Write. These functions will return HASP_BROKEN_SESSION if a session for the protection key does not exist.
High-Availability Memory Write Restriction
In high-availability configurations, write operations to protection key memory using hasp_write() are actively blocked by the Sentinel Licensing API.
When an application attempts to write data to any dynamic memory segment of a high-availability protection key, the API rejects the request and returns status code 121 (HASP_HA_WRITE_NOT_ALLOWED).
NOTE Pre-populated Read/Write and Write-Once memory files can still be created and deployed in high-availability products using Sentinel EMS. Applications can read this memory data without restriction using hasp_read(). For memory access boundaries and licensing rules, see the
Related Topics
hasp_write screen
