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

Handle for the session

fileid

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).

offset

Byte offset in the file

length

Number of bytes to be written to the file

buffer

Pointer to the data that is written

Return Values

HASP_STATUS_OK

HASP_INV_HND

HASP_BROKEN_SESSION

HASP_INV_FILEID

HASP_SCHAN_ERR

HASP_MEM_RANGE

HASP_IDENTITY_RATE_LIMIT_EXCEEDED

HASP_REMOTE_COMM_ERR

HASP_DEVICE_ERR

HASP_LOCAL_COMM_ERR

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.

Related Topics

GetSize Function

Read Function

hasp_write screen