Top Description Constructors Methods
com.sun.jna.platform.win32

public abstract Class Crypt32Util

extends Object
Class Inheritance
Imports
java.util.Arrays, com.sun.jna.Pointer, .Memory, .Native, com.sun.jna.platform.win32.WinCrypt.CRYPTPROTECT_PROMPTSTRUCT, .WinCrypt.DATA_BLOB, com.sun.jna.ptr.PointerByReference

Crypt32 utility API.
Author
dblock[at]dblock.org

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

Returns the retrieved string.
CertNameToStr
(int
The certificate encoding type that was used to encode the name. The message encoding type identifier, contained in the high WORD of this value, is ignored by this function.
dwCertEncodingType
,
int
This parameter specifies the format of the output string. This parameter also specifies other options for the contents of the string.
dwStrType
,
WinCrypt.DATA_BLOB
A pointer to the CERT_NAME_BLOB structure to be converted.
pName
)

Utility method to call to Crypt32's CertNameToStr that allocates the assigns the required memory for the psz parameter based on the type mapping used, calls to CertNameToStr, and returns the received string.

public static byte[]

Returns:

Protected data.
cryptProtectData
(byte[]
Data to protect.
data
)

Protect a blob of data.

public static byte[]

Returns:

Protected data.
cryptProtectData
(byte[]
Data to protect.
data
,
int
Optional flags, eg. CRYPTPROTECT_LOCAL_MACHINE | CRYPTPROTECT_UI_FORBIDDEN.
flags
)

Protect a blob of data with optional flags.

public static byte[]

Returns:

Protected bytes.
cryptProtectData
(byte[]
Data to protect.
data
,
byte[]
Optional entropy.
entropy
,
int
Optional flags.
flags
,
String
Optional description.
description
,
WinCrypt.CRYPTPROTECT_PROMPTSTRUCT
Prompt structure.
prompt
)

Protect a blob of data.

public static byte[]

Returns:

Unprotected blob of data.
cryptUnprotectData
(byte[]
Data to unprotect.
data
)

Unprotect a blob of data.

public static byte[]

Returns:

Unprotected blob of data.
cryptUnprotectData
(byte[]
Data to unprotect.
data
,
int
Optional flags, eg. CRYPTPROTECT_UI_FORBIDDEN.
flags
)

Unprotect a blob of data.

public static byte[]

Returns:

Unprotected blob of data.
cryptUnprotectData
(byte[]
Data to unprotect.
data
,
byte[]
Optional entropy.
entropy
,
int
Optional flags.
flags
,
WinCrypt.CRYPTPROTECT_PROMPTSTRUCT
Optional prompt structure.
prompt
)

Unprotect a blob of data.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Crypt32Utilback to summary
public Crypt32Util()

Method Detail

CertNameToStrback to summary
public static String CertNameToStr(int dwCertEncodingType, int dwStrType, WinCrypt.DATA_BLOB pName)

Utility method to call to Crypt32's CertNameToStr that allocates the assigns the required memory for the psz parameter based on the type mapping used, calls to CertNameToStr, and returns the received string.

Parameters
dwCertEncodingType:int

The certificate encoding type that was used to encode the name. The message encoding type identifier, contained in the high WORD of this value, is ignored by this function.

dwStrType:int

This parameter specifies the format of the output string. This parameter also specifies other options for the contents of the string.

pName:WinCrypt.DATA_BLOB

A pointer to the CERT_NAME_BLOB structure to be converted.

Returns:String

Returns the retrieved string.

cryptProtectDataback to summary
public static byte[] cryptProtectData(byte[] data)

Protect a blob of data.

Parameters
data:byte[]

Data to protect.

Returns:byte[]

Protected data.

cryptProtectDataback to summary
public static byte[] cryptProtectData(byte[] data, int flags)

Protect a blob of data with optional flags.

Parameters
data:byte[]

Data to protect.

flags:int

Optional flags, eg. CRYPTPROTECT_LOCAL_MACHINE | CRYPTPROTECT_UI_FORBIDDEN.

Returns:byte[]

Protected data.

cryptProtectDataback to summary
public static byte[] cryptProtectData(byte[] data, byte[] entropy, int flags, String description, WinCrypt.CRYPTPROTECT_PROMPTSTRUCT prompt)

Protect a blob of data.

Parameters
data:byte[]

Data to protect.

entropy:byte[]

Optional entropy.

flags:int

Optional flags.

description:String

Optional description.

prompt:WinCrypt.CRYPTPROTECT_PROMPTSTRUCT

Prompt structure.

Returns:byte[]

Protected bytes.

cryptUnprotectDataback to summary
public static byte[] cryptUnprotectData(byte[] data)

Unprotect a blob of data.

Parameters
data:byte[]

Data to unprotect.

Returns:byte[]

Unprotected blob of data.

cryptUnprotectDataback to summary
public static byte[] cryptUnprotectData(byte[] data, int flags)

Unprotect a blob of data.

Parameters
data:byte[]

Data to unprotect.

flags:int

Optional flags, eg. CRYPTPROTECT_UI_FORBIDDEN.

Returns:byte[]

Unprotected blob of data.

cryptUnprotectDataback to summary
public static byte[] cryptUnprotectData(byte[] data, byte[] entropy, int flags, WinCrypt.CRYPTPROTECT_PROMPTSTRUCT prompt)

Unprotect a blob of data.

Parameters
data:byte[]

Data to unprotect.

entropy:byte[]

Optional entropy.

flags:int

Optional flags.

prompt:WinCrypt.CRYPTPROTECT_PROMPTSTRUCT

Optional prompt structure.

Returns:byte[]

Unprotected blob of data.