Hasp.Encrypt Method

Namespace: Aladdin.Hasp

Description

Encrypts a buffer.

Syntax

HaspStatus Encrypt ( Byte[] buffer )

Parameters

buffer

Bytes to be encrypted

Return Values

A HaspStatus status code.

Usage Notes

Encrypts data using the encryption engine in the Sentinel protection key. The session established with the Login method controls which Sentinel protection key and which Feature ID encrypt the data buffer. The encryption key remains in the Sentinel protection key. If the encryption fails, the data buffer is not modified. To decrypt the data buffer, use the Decrypt method.

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 method does not detect a remote broken session). Instead, use one of the following methods: Encrypt, Decrypt, Read, Write. These methods will return HASP_BROKEN_SESSION if a session for the protection key does not exist.

You can call the Encrypt or Decrypt method to check whether the license for the current Feature has expired. See Checking the License Expiration Date of a Feature.

Overloaded Methods

The following overloaded methods are provided. They differ from the method above only in the argument type that they accept.

HaspStatus Encrypt ( Char[] data )

HaspStatus Encrypt ( Double[] data )

HaspStatus Encrypt ( Int16[] data )

HaspStatus Encrypt ( Int32[] data )

HaspStatus Encrypt ( Int64[] data )

HaspStatus Encrypt ( Single[] data )

HaspStatus Encrypt ( ref String data )

Related Topics

Hasp.Decrypt Method