DataProtectionProtect Method

Encrypts the data in a specified byte array and returns a byte array that contains the encrypted data.

Definition

Namespace: Gemstone.Security.Cryptography
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.177 -- Release Build+17e3a8c30c12a6a5a57ad4af156d7b83be281c33
public static byte[] Protect(
	byte[] unencryptedData,
	byte[]? optionalEntropy = null,
	bool protectToLocalMachine = true,
	string settingsCategory = "CryptographyServices"
)

Parameters

unencryptedData  Byte
A byte array that contains data to encrypt.
optionalEntropy  Byte  (Optional)
An optional additional byte array used to increase the complexity of the encryption, or null for no additional complexity.
protectToLocalMachine  Boolean  (Optional)
Set to true to protect data to the local machine; otherwise, set to false to protect data to the current user.
settingsCategory  String  (Optional)
The config file settings category under which the settings are defined.

Return Value

Byte
A byte array representing the encrypted data.

Exceptions

ArgumentNullExceptionThe unencryptedData parameter is null.
CryptographicExceptionThe encryption failed.

See Also