Class Crypt32
dpapi.h
and crypt32.dll
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Contains the function pointers loaded from the crypt32SharedLibrary
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Flags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.static final int
Flags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.static final int
Flags for thedwPromptFlags
member ofDATA_BLOB
.static final int
Flags for thedwPromptFlags
member ofDATA_BLOB
.static final int
Flags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.static final int
Flags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.static final int
The block size for data encrypted viaCryptProtectMemory(java.nio.ByteBuffer, int)
.static final int
Flags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
.static final int
Flags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
.static final int
Flags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
CryptProtectData
(DATA_BLOB pDataIn, CharSequence szDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptProtectData
function performs encryption on the data in aDATA_BLOB
structure.static boolean
CryptProtectData
(DATA_BLOB pDataIn, ByteBuffer szDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptProtectData
function performs encryption on the data in aDATA_BLOB
structure.static boolean
CryptProtectMemory
(ByteBuffer pDataIn, int dwFlags) Encrypts memory to prevent others from viewing sensitive information in your process.static boolean
CryptUnprotectData
(DATA_BLOB pDataIn, org.lwjgl.PointerBuffer ppszDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptUnprotectData
function decrypts and does an integrity check of the data in aDATA_BLOB
structure.static boolean
CryptUnprotectMemory
(ByteBuffer pDataIn, int dwFlags) TheCryptUnprotectMemory
function decrypts memory that was encrypted using theCryptProtectMemory(java.nio.ByteBuffer, int)
function.static org.lwjgl.system.SharedLibrary
Returns the crypt32SharedLibrary
.static int
nCryptProtectData
(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut) static int
nCryptProtectData
(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress) static int
nCryptProtectMemory
(long pDataIn, int cbDataIn, int dwFlags) Unsafe version of:CryptProtectMemory(java.nio.ByteBuffer, int)
static int
nCryptProtectMemory
(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress) Unsafe version of:CryptProtectMemory(java.nio.ByteBuffer, int)
static int
nCryptUnprotectData
(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut) static int
nCryptUnprotectData
(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress) static int
nCryptUnprotectMemory
(long pDataIn, int cbDataIn, int dwFlags) Unsafe version of:CryptUnprotectMemory(java.nio.ByteBuffer, int)
static int
nCryptUnprotectMemory
(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress) Unsafe version of:CryptUnprotectMemory(java.nio.ByteBuffer, int)
-
Field Details
-
CRYPTPROTECT_UI_FORBIDDEN
public static final int CRYPTPROTECT_UI_FORBIDDENFlags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.- See Also:
-
CRYPTPROTECT_LOCAL_MACHINE
public static final int CRYPTPROTECT_LOCAL_MACHINEFlags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.- See Also:
-
CRYPTPROTECT_AUDIT
public static final int CRYPTPROTECT_AUDITFlags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.- See Also:
-
CRYPTPROTECT_VERIFY_PROTECTION
public static final int CRYPTPROTECT_VERIFY_PROTECTIONFlags for thedwFlags
parameter ofCryptProtectData(org.lwjgl.system.windows.DATA_BLOB, java.nio.ByteBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
and/orCryptUnprotectData(org.lwjgl.system.windows.DATA_BLOB, org.lwjgl.PointerBuffer, org.lwjgl.system.windows.DATA_BLOB, long, org.lwjgl.system.windows.CRYPTPROTECT_PROMPTSTRUCT, int, org.lwjgl.system.windows.DATA_BLOB)
.- See Also:
-
CRYPTPROTECTMEMORY_SAME_PROCESS
public static final int CRYPTPROTECTMEMORY_SAME_PROCESSFlags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
.- See Also:
-
CRYPTPROTECTMEMORY_CROSS_PROCESS
public static final int CRYPTPROTECTMEMORY_CROSS_PROCESSFlags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
.- See Also:
-
CRYPTPROTECTMEMORY_SAME_LOGON
public static final int CRYPTPROTECTMEMORY_SAME_LOGONFlags for thedwFlags
parameter ofCryptProtectMemory(java.nio.ByteBuffer, int)
andCryptUnprotectMemory(java.nio.ByteBuffer, int)
.- See Also:
-
CRYPTPROTECT_PROMPT_ON_UNPROTECT
public static final int CRYPTPROTECT_PROMPT_ON_UNPROTECTFlags for thedwPromptFlags
member ofDATA_BLOB
.- See Also:
-
CRYPTPROTECT_PROMPT_ON_PROTECT
public static final int CRYPTPROTECT_PROMPT_ON_PROTECTFlags for thedwPromptFlags
member ofDATA_BLOB
.- See Also:
-
CRYPTPROTECTMEMORY_BLOCK_SIZE
public static final int CRYPTPROTECTMEMORY_BLOCK_SIZEThe block size for data encrypted viaCryptProtectMemory(java.nio.ByteBuffer, int)
.- See Also:
-
-
Method Details
-
getLibrary
public static org.lwjgl.system.SharedLibrary getLibrary()Returns the crypt32SharedLibrary
. -
nCryptProtectData
public static int nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress) -
nCryptProtectData
public static int nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut) -
CryptProtectData
public static boolean CryptProtectData(DATA_BLOB pDataIn, @Nullable ByteBuffer szDataDescr, @Nullable DATA_BLOB pOptionalEntropy, long pvReserved, @Nullable CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptProtectData
function performs encryption on the data in aDATA_BLOB
structure.Typically, only a user with the same logon credential as the user who encrypted the data can decrypt the data. In addition, the encryption and decryption usually must be done on the same computer.
- Parameters:
pDataIn
- a pointer to aDATA_BLOB
structure that contains the plaintext to be encryptedszDataDescr
- a string with a readable description of the data to be encrypted.This description string is included with the encrypted data. This parameter is optional and can be set to
NULL
.pOptionalEntropy
- a pointer to aDATA_BLOB
structure that contains a password or other additional entropy used to encrypt the data.The
DATA_BLOB
structure used in the encryption phase must also be used in the decryption phase. This parameter can be set toNULL
for no additional entropy.pvReserved
- reserved for future use and must be set toNULL
pPromptStruct
- a pointer to aCRYPTPROTECT_PROMPTSTRUCT
structure that provides information about where and when prompts are to be displayed and what the content of those prompts should be.This parameter can be set to
NULL
in both the encryption and decryption phases.dwFlags
- one or more of:CRYPTPROTECT_LOCAL_MACHINE
,CRYPTPROTECT_UI_FORBIDDEN
,CRYPTPROTECT_AUDIT
pDataOut
- a pointer to aDATA_BLOB
structure that receives the encrypted data.When you have finished using the
DATA_BLOB
structure, free itspbData
member by calling theWinBase.LocalFree(long)
function.
-
CryptProtectData
public static boolean CryptProtectData(DATA_BLOB pDataIn, @Nullable CharSequence szDataDescr, @Nullable DATA_BLOB pOptionalEntropy, long pvReserved, @Nullable CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptProtectData
function performs encryption on the data in aDATA_BLOB
structure.Typically, only a user with the same logon credential as the user who encrypted the data can decrypt the data. In addition, the encryption and decryption usually must be done on the same computer.
- Parameters:
pDataIn
- a pointer to aDATA_BLOB
structure that contains the plaintext to be encryptedszDataDescr
- a string with a readable description of the data to be encrypted.This description string is included with the encrypted data. This parameter is optional and can be set to
NULL
.pOptionalEntropy
- a pointer to aDATA_BLOB
structure that contains a password or other additional entropy used to encrypt the data.The
DATA_BLOB
structure used in the encryption phase must also be used in the decryption phase. This parameter can be set toNULL
for no additional entropy.pvReserved
- reserved for future use and must be set toNULL
pPromptStruct
- a pointer to aCRYPTPROTECT_PROMPTSTRUCT
structure that provides information about where and when prompts are to be displayed and what the content of those prompts should be.This parameter can be set to
NULL
in both the encryption and decryption phases.dwFlags
- one or more of:CRYPTPROTECT_LOCAL_MACHINE
,CRYPTPROTECT_UI_FORBIDDEN
,CRYPTPROTECT_AUDIT
pDataOut
- a pointer to aDATA_BLOB
structure that receives the encrypted data.When you have finished using the
DATA_BLOB
structure, free itspbData
member by calling theWinBase.LocalFree(long)
function.
-
nCryptProtectMemory
public static int nCryptProtectMemory(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress) Unsafe version of:CryptProtectMemory(java.nio.ByteBuffer, int)
- Parameters:
cbDataIn
- number of bytes of memory pointed to by thepData
parameter to encrypt.The number of bytes must be a multiple of the
CRYPTPROTECTMEMORY_BLOCK_SIZE
constant.
-
nCryptProtectMemory
public static int nCryptProtectMemory(long pDataIn, int cbDataIn, int dwFlags) Unsafe version of:CryptProtectMemory(java.nio.ByteBuffer, int)
- Parameters:
cbDataIn
- number of bytes of memory pointed to by thepData
parameter to encrypt.The number of bytes must be a multiple of the
CRYPTPROTECTMEMORY_BLOCK_SIZE
constant.
-
CryptProtectMemory
Encrypts memory to prevent others from viewing sensitive information in your process.For example, use the
CryptProtectMemory
function to encrypt memory that contains a password. Encrypting the password prevents others from viewing it when the process is paged out to the swap file. Otherwise, the password is in plaintext and viewable by others.- Parameters:
pDataIn
- a pointer to the block of memory to encryptdwFlags
- this parameter can be one of the following flags. You must specify the same flag when encrypting and decrypting the memory. One of:CRYPTPROTECTMEMORY_SAME_PROCESS
CRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
-
nCryptUnprotectData
public static int nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress) -
nCryptUnprotectData
public static int nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut) -
CryptUnprotectData
public static boolean CryptUnprotectData(DATA_BLOB pDataIn, @Nullable org.lwjgl.PointerBuffer ppszDataDescr, @Nullable DATA_BLOB pOptionalEntropy, long pvReserved, @Nullable CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut) TheCryptUnprotectData
function decrypts and does an integrity check of the data in aDATA_BLOB
structure.Usually, the only user who can decrypt the data is a user with the same logon credentials as the user who encrypted the data. In addition, the encryption and decryption must be done on the same computer.
- Parameters:
pDataIn
- a pointer to aDATA_BLOB
structure that holds the encrypted datappszDataDescr
- a pointer to a string-readable description of the encrypted data included with the encrypted data.This parameter can be set to
NULL
. When you have finished usingppszDataDescr
, free it by calling theWinBase.LocalFree(long)
function.pOptionalEntropy
- a pointer to aDATA_BLOB
structure that contains a password or other additional entropy used when the data was encrypted.This parameter can be set to
NULL
; however, if an optional entropyDATA_BLOB
structure was used in the encryption phase, that sameDATA_BLOB
structure must be used for the decryption phase.pvReserved
- reserved for future use and must be set toNULL
pPromptStruct
- a pointer to aCRYPTPROTECT_PROMPTSTRUCT
structure that provides information about where and when prompts are to be displayed and what the content of those prompts should be.This parameter can be set to
NULL
.dwFlags
- one or more of:CRYPTPROTECT_UI_FORBIDDEN
CRYPTPROTECT_VERIFY_PROTECTION
pDataOut
- a pointer to aDATA_BLOB
structure where the function stores the decrypted data.When you have finished using the
DATA_BLOB
structure, free itspbData
member by calling theWinBase.LocalFree(long)
function.
-
nCryptUnprotectMemory
public static int nCryptUnprotectMemory(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress) Unsafe version of:CryptUnprotectMemory(java.nio.ByteBuffer, int)
- Parameters:
cbDataIn
- number of bytes of memory pointed to by thepData
parameter to decrypt.The number of bytes must be a multiple of the
CRYPTPROTECTMEMORY_BLOCK_SIZE
constant.
-
nCryptUnprotectMemory
public static int nCryptUnprotectMemory(long pDataIn, int cbDataIn, int dwFlags) Unsafe version of:CryptUnprotectMemory(java.nio.ByteBuffer, int)
- Parameters:
cbDataIn
- number of bytes of memory pointed to by thepData
parameter to decrypt.The number of bytes must be a multiple of the
CRYPTPROTECTMEMORY_BLOCK_SIZE
constant.
-
CryptUnprotectMemory
TheCryptUnprotectMemory
function decrypts memory that was encrypted using theCryptProtectMemory(java.nio.ByteBuffer, int)
function.- Parameters:
pDataIn
- a pointer to the block of memory to decryptdwFlags
- this parameter can be one of the following flags. You must specify the same flag when encrypting and decrypting the memory. One of:CRYPTPROTECTMEMORY_SAME_PROCESS
CRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
-