CryptEncrypt (advapi32)
Last changed: Hannibal-74.92.133.141

.
Summary
Encrypts the data in pbData using the encryption key pointed to by hKey which contains the encryption algorithm that is used.

C# Signature:

[DllImport(@"advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool CryptEncrypt(IntPtr hKey, IntPtr hHash, int Final, uint dwFlags, byte[] pbData, ref uint pdwDataLen, uint dwBufLen);

VB Signature:

Declare Function CryptEncrypt Lib "advapi32.dll" (ByVal hkey As IntPtr, _
ByVal hHash As IntPtr, <MarshalAs(UnmanagedType.Bool)> ByVal final As Boolean, ByVal flags As Integer, _
ByVal data As Byte(), ByRef dataLen As Integer, ByVal bufferlen As Integer) _
As <MarshalAs(UnmanagedType.Bool)> Boolean

User-Defined Types:

None.

Alternative Managed API:

Do you know one? Please contribute it!

Notes:

The key's handle may be obtained by calling either of the CryptGenKey or CryptImportKey methods.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Documentation