Top Description Inners Fields Constructors Methods
org.lwjgl.system.windows

public Class Crypt32

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.*, org.lwjgl.system.*

Native bindings to dpapi.h and crypt32.dll.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
Crypt32.Functions

Contains the function pointers loaded from the crypt32 SharedLibrary.

Field Summary

Modifier and TypeField and Description
private static final SharedLibrary
public static final int
CRYPTPROTECT_AUDIT

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

public static final int
CRYPTPROTECT_LOCAL_MACHINE

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

public static final int
CRYPTPROTECT_PROMPT_ON_PROTECT

Flags for the dwPromptFlags member of DATA_BLOB.

public static final int
CRYPTPROTECT_PROMPT_ON_UNPROTECT

Flags for the dwPromptFlags member of DATA_BLOB.

public static final int
CRYPTPROTECT_UI_FORBIDDEN

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

public static final int
CRYPTPROTECT_VERIFY_PROTECTION

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

public static final int
CRYPTPROTECTMEMORY_BLOCK_SIZE

The block size for data encrypted via CryptProtectMemory.

public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static boolean
CryptProtectData(DATA_BLOB
a pointer to a DATA_BLOB structure that contains the plaintext to be encrypted
pDataIn
,
ByteBuffer
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.

szDataDescr
,
DATA_BLOB
a pointer to a DATA_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 to NULL for no additional entropy.

pOptionalEntropy
,
long
reserved for future use and must be set to NULL
pvReserved
,
CRYPTPROTECT_PROMPTSTRUCT
a pointer to a CRYPTPROTECT_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.

pPromptStruct
,
int dwFlags, DATA_BLOB
a pointer to a DATA_BLOB structure that receives the encrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

pDataOut
)

The CryptProtectData function performs encryption on the data in a DATA_BLOB structure.

public static boolean
CryptProtectData(DATA_BLOB
a pointer to a DATA_BLOB structure that contains the plaintext to be encrypted
pDataIn
,
CharSequence
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.

szDataDescr
,
DATA_BLOB
a pointer to a DATA_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 to NULL for no additional entropy.

pOptionalEntropy
,
long
reserved for future use and must be set to NULL
pvReserved
,
CRYPTPROTECT_PROMPTSTRUCT
a pointer to a CRYPTPROTECT_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.

pPromptStruct
,
int dwFlags, DATA_BLOB
a pointer to a DATA_BLOB structure that receives the encrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

pDataOut
)

The CryptProtectData function performs encryption on the data in a DATA_BLOB structure.

public static boolean
CryptProtectMemory(ByteBuffer
a pointer to the block of memory to encrypt
pDataIn
,
int
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_PROCESSCRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
dwFlags
)

Encrypts memory to prevent others from viewing sensitive information in your process.

public static boolean
CryptUnprotectData(DATA_BLOB
a pointer to a DATA_BLOB structure that holds the encrypted data
pDataIn
,
PointerBuffer
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 using ppszDataDescr, free it by calling the WinBase#LocalFree function.

ppszDataDescr
,
DATA_BLOB
a pointer to a DATA_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 entropy DATA_BLOB structure was used in the encryption phase, that same DATA_BLOB structure must be used for the decryption phase.

pOptionalEntropy
,
long
reserved for future use and must be set to NULL
pvReserved
,
CRYPTPROTECT_PROMPTSTRUCT
a pointer to a CRYPTPROTECT_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.

pPromptStruct
,
int dwFlags, DATA_BLOB
a pointer to a DATA_BLOB structure where the function stores the decrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

pDataOut
)

The CryptUnprotectData function decrypts and does an integrity check of the data in a DATA_BLOB structure.

public static boolean
CryptUnprotectMemory(ByteBuffer
a pointer to the block of memory to decrypt
pDataIn
,
int
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_PROCESSCRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
dwFlags
)

The CryptUnprotectMemory function decrypts memory that was encrypted using the CryptProtectMemory function.

public static SharedLibrary
getLibrary()

Returns the crypt32 SharedLibrary.

public static native int
nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress)

Unsafe version of: CryptProtectData

public static int
nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut)

Unsafe version of: CryptProtectData

public static native int
nCryptProtectMemory(long pDataIn, int
number of bytes of memory pointed to by the pData parameter to encrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

cbDataIn
,
int dwFlags, long __functionAddress)

Unsafe version of: CryptProtectMemory

public static int
nCryptProtectMemory(long pDataIn, int
number of bytes of memory pointed to by the pData parameter to encrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

cbDataIn
,
int dwFlags)

Unsafe version of: CryptProtectMemory

public static native int
nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress)

Unsafe version of: CryptUnprotectData

public static int
nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut)

Unsafe version of: CryptUnprotectData

public static native int
nCryptUnprotectMemory(long pDataIn, int
number of bytes of memory pointed to by the pData parameter to decrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

cbDataIn
,
int dwFlags, long __functionAddress)

Unsafe version of: CryptUnprotectMemory

public static int
nCryptUnprotectMemory(long pDataIn, int
number of bytes of memory pointed to by the pData parameter to decrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

cbDataIn
,
int dwFlags)

Unsafe version of: CryptUnprotectMemory

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CRYPT32back to summary
private static final SharedLibrary CRYPT32
CRYPTPROTECT_AUDITback to summary
public static final int CRYPTPROTECT_AUDIT

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

CRYPTPROTECT_LOCAL_MACHINEback to summary
public static final int CRYPTPROTECT_LOCAL_MACHINE

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

CRYPTPROTECT_PROMPT_ON_PROTECTback to summary
public static final int CRYPTPROTECT_PROMPT_ON_PROTECT

Flags for the dwPromptFlags member of DATA_BLOB.

CRYPTPROTECT_PROMPT_ON_UNPROTECTback to summary
public static final int CRYPTPROTECT_PROMPT_ON_UNPROTECT

Flags for the dwPromptFlags member of DATA_BLOB.

CRYPTPROTECT_UI_FORBIDDENback to summary
public static final int CRYPTPROTECT_UI_FORBIDDEN

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

CRYPTPROTECT_VERIFY_PROTECTIONback to summary
public static final int CRYPTPROTECT_VERIFY_PROTECTION

Flags for the dwFlags parameter of CryptProtectData and/or CryptUnprotectData.

CRYPTPROTECTMEMORY_BLOCK_SIZEback to summary
public static final int CRYPTPROTECTMEMORY_BLOCK_SIZE

The block size for data encrypted via CryptProtectMemory.

CRYPTPROTECTMEMORY_CROSS_PROCESSback to summary
public static final int CRYPTPROTECTMEMORY_CROSS_PROCESS

Flags for the dwFlags parameter of CryptProtectMemory and CryptUnprotectMemory.

CRYPTPROTECTMEMORY_SAME_LOGONback to summary
public static final int CRYPTPROTECTMEMORY_SAME_LOGON

Flags for the dwFlags parameter of CryptProtectMemory and CryptUnprotectMemory.

CRYPTPROTECTMEMORY_SAME_PROCESSback to summary
public static final int CRYPTPROTECTMEMORY_SAME_PROCESS

Flags for the dwFlags parameter of CryptProtectMemory and CryptUnprotectMemory.

Constructor Detail

Crypt32back to summary
protected Crypt32()

Method Detail

CryptProtectDataback to summary
public static boolean CryptProtectData(DATA_BLOB pDataIn, ByteBuffer szDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut)

The CryptProtectData function performs encryption on the data in a DATA_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:DATA_BLOB

a pointer to a DATA_BLOB structure that contains the plaintext to be encrypted

szDataDescr:ByteBuffer

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:DATA_BLOB

a pointer to a DATA_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 to NULL for no additional entropy.

pvReserved:long

reserved for future use and must be set to NULL

pPromptStruct:CRYPTPROTECT_PROMPTSTRUCT

a pointer to a CRYPTPROTECT_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:int

one or more of:

CRYPTPROTECT_LOCAL_MACHINE,CRYPTPROTECT_UI_FORBIDDEN,CRYPTPROTECT_AUDIT
pDataOut:DATA_BLOB

a pointer to a DATA_BLOB structure that receives the encrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

Annotations
@NativeType:BOOL
CryptProtectDataback to summary
public static boolean CryptProtectData(DATA_BLOB pDataIn, CharSequence szDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut)

The CryptProtectData function performs encryption on the data in a DATA_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:DATA_BLOB

a pointer to a DATA_BLOB structure that contains the plaintext to be encrypted

szDataDescr:CharSequence

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:DATA_BLOB

a pointer to a DATA_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 to NULL for no additional entropy.

pvReserved:long

reserved for future use and must be set to NULL

pPromptStruct:CRYPTPROTECT_PROMPTSTRUCT

a pointer to a CRYPTPROTECT_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:int

one or more of:

CRYPTPROTECT_LOCAL_MACHINE,CRYPTPROTECT_UI_FORBIDDEN,CRYPTPROTECT_AUDIT
pDataOut:DATA_BLOB

a pointer to a DATA_BLOB structure that receives the encrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

Annotations
@NativeType:BOOL
CryptProtectMemoryback to summary
public static boolean CryptProtectMemory(ByteBuffer pDataIn, int dwFlags)

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:ByteBuffer

a pointer to the block of memory to encrypt

dwFlags:int

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_PROCESSCRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
Annotations
@NativeType:BOOL
CryptUnprotectDataback to summary
public static boolean CryptUnprotectData(DATA_BLOB pDataIn, PointerBuffer ppszDataDescr, DATA_BLOB pOptionalEntropy, long pvReserved, CRYPTPROTECT_PROMPTSTRUCT pPromptStruct, int dwFlags, DATA_BLOB pDataOut)

The CryptUnprotectData function decrypts and does an integrity check of the data in a DATA_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:DATA_BLOB

a pointer to a DATA_BLOB structure that holds the encrypted data

ppszDataDescr:PointerBuffer

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 using ppszDataDescr, free it by calling the WinBase#LocalFree function.

pOptionalEntropy:DATA_BLOB

a pointer to a DATA_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 entropy DATA_BLOB structure was used in the encryption phase, that same DATA_BLOB structure must be used for the decryption phase.

pvReserved:long

reserved for future use and must be set to NULL

pPromptStruct:CRYPTPROTECT_PROMPTSTRUCT

a pointer to a CRYPTPROTECT_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:int

one or more of:

CRYPTPROTECT_UI_FORBIDDENCRYPTPROTECT_VERIFY_PROTECTION
pDataOut:DATA_BLOB

a pointer to a DATA_BLOB structure where the function stores the decrypted data.

When you have finished using the DATA_BLOB structure, free its pbData member by calling the WinBase#LocalFree function.

Annotations
@NativeType:BOOL
CryptUnprotectMemoryback to summary
public static boolean CryptUnprotectMemory(ByteBuffer pDataIn, int dwFlags)

The CryptUnprotectMemory function decrypts memory that was encrypted using the CryptProtectMemory function.

Parameters
pDataIn:ByteBuffer

a pointer to the block of memory to decrypt

dwFlags:int

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_PROCESSCRYPTPROTECTMEMORY_CROSS_PROCESS
CRYPTPROTECTMEMORY_SAME_LOGON
Annotations
@NativeType:BOOL
getLibraryback to summary
public static SharedLibrary getLibrary()

Returns the crypt32 SharedLibrary.

nCryptProtectDataback to summary
public static native int nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress)

Unsafe version of: CryptProtectData

nCryptProtectDataback to summary
public static int nCryptProtectData(long pDataIn, long szDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut)

Unsafe version of: CryptProtectData

nCryptProtectMemoryback to summary
public static native int nCryptProtectMemory(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress)

Unsafe version of: CryptProtectMemory

Parameters
cbDataIn:int

number of bytes of memory pointed to by the pData parameter to encrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

nCryptProtectMemoryback to summary
public static int nCryptProtectMemory(long pDataIn, int cbDataIn, int dwFlags)

Unsafe version of: CryptProtectMemory

Parameters
cbDataIn:int

number of bytes of memory pointed to by the pData parameter to encrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

nCryptUnprotectDataback to summary
public static native int nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut, long __functionAddress)

Unsafe version of: CryptUnprotectData

nCryptUnprotectDataback to summary
public static int nCryptUnprotectData(long pDataIn, long ppszDataDescr, long pOptionalEntropy, long pvReserved, long pPromptStruct, int dwFlags, long pDataOut)

Unsafe version of: CryptUnprotectData

nCryptUnprotectMemoryback to summary
public static native int nCryptUnprotectMemory(long pDataIn, int cbDataIn, int dwFlags, long __functionAddress)

Unsafe version of: CryptUnprotectMemory

Parameters
cbDataIn:int

number of bytes of memory pointed to by the pData parameter to decrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

nCryptUnprotectMemoryback to summary
public static int nCryptUnprotectMemory(long pDataIn, int cbDataIn, int dwFlags)

Unsafe version of: CryptUnprotectMemory

Parameters
cbDataIn:int

number of bytes of memory pointed to by the pData parameter to decrypt.

The number of bytes must be a multiple of the CRYPTPROTECTMEMORY_BLOCK_SIZE constant.

org.lwjgl.system.windows back to summary

public final Class Crypt32.Functions

extends Object
Class Inheritance

Contains the function pointers loaded from the crypt32 SharedLibrary.

Field Summary

Modifier and TypeField and Description
public static final long
CryptProtectData

Function address.

public static final long
CryptProtectMemory

Function address.

public static final long
CryptUnprotectData

Function address.

public static final long
CryptUnprotectMemory

Function address.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CryptProtectDataback to summary
public static final long CryptProtectData

Function address.

CryptProtectMemoryback to summary
public static final long CryptProtectMemory

Function address.

CryptUnprotectDataback to summary
public static final long CryptUnprotectData

Function address.

CryptUnprotectMemoryback to summary
public static final long CryptUnprotectMemory

Function address.

Constructor Detail

Functionsback to summary
private Functions()