|   | DataProtectionProtect Method | 
        
        
            Encrypts the data in a specified byte array and returns a byte array that contains the encrypted data.
            
        
        Namespace: GSF.Security.CryptographyAssembly: GSF.Core (in GSF.Core.dll) Version: 2.4.257-beta+00aa2366fbb9ec75f636ebc7cfa610e3826a727c
 Syntax
Syntaxpublic static byte[] Protect(
	byte[] userData,
	byte[] optionalEntropy,
	DataProtectionScope scope
)
Public Shared Function Protect ( 
	userData As Byte(),
	optionalEntropy As Byte(),
	scope As DataProtectionScope
) As Byte()
public:
static array<unsigned char>^ Protect(
	array<unsigned char>^ userData, 
	array<unsigned char>^ optionalEntropy, 
	DataProtectionScope scope
)
static member Protect : 
        userData : byte[] * 
        optionalEntropy : byte[] * 
        scope : DataProtectionScope -> byte[] GSF.Security.Cryptography.DataProtection.Protect = function(userData, optionalEntropy, scope);
Parameters
- userData  Byte
- A byte array that contains data to encrypt.
- optionalEntropy  Byte
- An optional additional byte array used to increase the complexity of the encryption, or null for no additional complexity.
- scope  DataProtectionScope
- One of the enumeration values that specifies the scope of encryption.
Return Value
ByteA byte array representing the encrypted data.
 Exceptions
Exceptions| Exception | Condition | 
|---|
| ArgumentNullException | The userData parameter is null. | 
| CryptographicException | The encryption failed. | 
| NotSupportedException | The operating system does not support this method. | 
| OutOfMemoryException | The system ran out of memory while encrypting the data. | 
 See Also
See Also