APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.security.pkcs11.wrapper

public Class Functions

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.util.*

This class contains only static methods. It is the place for all functions that are used by several classes in this package.
Authors
Karl Scheibelhofer , Martin Schlaeffer

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Map<String, Long>
private static final char[]
HEX_DIGITS

For converting numbers to their hex presentation.

private static final Functions.Flags
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Functions.Flags
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Map<String, Integer>
private static final Map<Integer, String>
private static final Functions.Flags
private static final Functions.Flags
private static final Functions.Flags

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
addAttribute(long id, String name)

private static void
addHashMech(long id, String... names)

private static void
addKeyType(long id, String name)

private static void
addMapping(Map<Integer, String> nameMap, Map<String, Integer> idMap, long id, String name)

private static void
addMech(long id, String name)

private static void
addMGF(long id, String name)

private static void
addObjectClass(long id, String name)

private static void
addParamSources(long id, String name)

private static void
addPrf(long id, String name)

private static boolean

Returns:

True, if both arrays are null or both have the same length and contain exactly the same char values. False, otherwise.
equals
(char[]
The first array.
array1
,
char[]
The second array.
array2
)

Check the given arrays for equalitiy.

public static boolean

Returns:

True, if both dates are null or both contain the same char values. False, otherwise.
equals
(CK_DATE
The first date.
date1
,
CK_DATE
The second date.
date2
)

Check the given dates for equalitiy.

public static long
public static String
public static long
public static long
getId(Map<String, Integer> idMap, String name)

public static long
public static String
getKeyName(long id)

public static int

Returns:

the byte array length as int or 0 if null
getLength
(byte[]
the byte array to get its length
value
)

get a byte array length as int

public static long
public static String
public static long
public static String
getMGFName(long id)

private static String
getName(Map<Integer, String> nameMap, long id)

public static long
public static String
public static long
public static String
public static long
public static String
getPrfName(long id)

public static int

Returns:

A hash code for the given array.
hashCode
(byte[]
The byte array.
array
)

Calculate a hash code for the given byte array.

public static int

Returns:

A hash code for the given array.
hashCode
(char[]
The char array.
array
)

Calculate a hash code for the given char array.

public static int

Returns:

A hash code for the given date.
hashCode
(CK_DATE
The date object.
date
)

Calculate a hash code for the given date object.

public static String

Returns:

the MechanismInfoFlag string representation of the flags
mechanismInfoFlagsToString
(long
the flags to be converted
flags
)

converts the long value flags to a MechanismInfoFlag string

public static String

Returns:

the HKDF salt type string representation
saltTypeToString
(long
the HKDF salt type to be converted
ulSaltType
)

converts a long value to a HKDF salt type string

public static String

Returns:

the SessionInfoFlag string representation of the flags
sessionInfoFlagsToString
(long
the flags to be converted
flags
)

converts the long value flags to a SessionInfoFlag string

public static String

Returns:

the SessionState string representation of the state
sessionStateToString
(long
the state to be converted
state
)

converts the long value state to a SessionState string

public static String

Returns:

the SlotInfoFlag string representation of the flags
slotInfoFlagsToString
(long
the flags to be converted
flags
)

converts the long value flags to a SlotInfoFlag string

public static String

Returns:

the binary string representation of the long value
toBinaryString
(long
the long value to be converted
value
)

converts a long value to a binary String

public static String

Returns:

the binary string representation of the byte array
toBinaryString
(byte[]
the byte array to be converted
value
)

converts a byte array to a binary String

public static String

Returns:

The hexadecimal string representation of the long value.
toFullHexString
(long
The long value to be converted.
value
)

Converts a long value to a hexadecimal String of length 16.

public static String

Returns:

The hexadecimal string representation of the int value.
toFullHexString
(int
The int value to be converted.
value
)

Converts a int value to a hexadecimal String of length 8.

public static String

Returns:

the hexadecimal string representation of the long value
toHexString
(long
the long value to be converted
value
)

converts a long value to a hexadecimal String

public static String

Returns:

the hexadecimal string representation of the byte array
toHexString
(byte[]
the byte array to be converted
value
)

Converts a byte array to a hexadecimal String.

public static String

Returns:

the TokenInfoFlag string representation of the flags
tokenInfoFlagsToString
(long
the flags to be converted
flags
)

converts long value flags to a TokenInfoFlag string

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributeIdsback to summary
private static final Map<String, Integer> attributeIds
attributeNamesback to summary
private static final Map<Integer, String> attributeNames
hashMechIdsback to summary
private static final Map<String, Long> hashMechIds
HEX_DIGITSback to summary
private static final char[] HEX_DIGITS

For converting numbers to their hex presentation.

hkdfSaltTypesback to summary
private static final Functions.Flags hkdfSaltTypes
keyIdsback to summary
private static final Map<String, Integer> keyIds
keyNamesback to summary
private static final Map<Integer, String> keyNames
mechanismInfoFlagsback to summary
private static final Functions.Flags mechanismInfoFlags
mechIdsback to summary
private static final Map<String, Integer> mechIds
mechNamesback to summary
private static final Map<Integer, String> mechNames
mgfIdsback to summary
private static final Map<String, Integer> mgfIds
mgfNamesback to summary
private static final Map<Integer, String> mgfNames
objectClassIdsback to summary
private static final Map<String, Integer> objectClassIds
objectClassNamesback to summary
private static final Map<Integer, String> objectClassNames
paramSourcesIdsback to summary
private static final Map<String, Integer> paramSourcesIds
paramSourcesNamesback to summary
private static final Map<Integer, String> paramSourcesNames
prfIdsback to summary
private static final Map<String, Integer> prfIds
prfNamesback to summary
private static final Map<Integer, String> prfNames
sessionInfoFlagsback to summary
private static final Functions.Flags sessionInfoFlags
slotInfoFlagsback to summary
private static final Functions.Flags slotInfoFlags
tokenInfoFlagsback to summary
private static final Functions.Flags tokenInfoFlags

Constructor Detail

Functionsback to summary
public Functions()

Method Detail

addAttributeback to summary
private static void addAttribute(long id, String name)
addHashMechback to summary
private static void addHashMech(long id, String... names)
addKeyTypeback to summary
private static void addKeyType(long id, String name)
addMappingback to summary
private static void addMapping(Map<Integer, String> nameMap, Map<String, Integer> idMap, long id, String name)
addMechback to summary
private static void addMech(long id, String name)
addMGFback to summary
private static void addMGF(long id, String name)
addObjectClassback to summary
private static void addObjectClass(long id, String name)
addParamSourcesback to summary
private static void addParamSources(long id, String name)
addPrfback to summary
private static void addPrf(long id, String name)
equalsback to summary
private static boolean equals(char[] array1, char[] array2)

Check the given arrays for equalitiy. This method considers both arrays as equal, if both are null or both have the same length and contain exactly the same char values.

Parameters
array1:char[]

The first array.

array2:char[]

The second array.

Returns:boolean

True, if both arrays are null or both have the same length and contain exactly the same char values. False, otherwise.

equalsback to summary
public static boolean equals(CK_DATE date1, CK_DATE date2)

Check the given dates for equalitiy. This method considers both dates as equal, if both are null or both contain exactly the same char values.

Parameters
date1:CK_DATE

The first date.

date2:CK_DATE

The second date.

Returns:boolean

True, if both dates are null or both contain the same char values. False, otherwise.

getAttributeIdback to summary
public static long getAttributeId(String name)
getAttributeNameback to summary
public static String getAttributeName(long id)
getHashMechIdback to summary
public static long getHashMechId(String name)
getIdback to summary
public static long getId(Map<String, Integer> idMap, String name)
getKeyIdback to summary
public static long getKeyId(String name)
getKeyNameback to summary
public static String getKeyName(long id)
getLengthback to summary
public static int getLength(byte[] value)

get a byte array length as int

Parameters
value:byte[]

the byte array to get its length

Returns:int

the byte array length as int or 0 if null

getMechanismIdback to summary
public static long getMechanismId(String name)
getMechanismNameback to summary
public static String getMechanismName(long id)
getMGFIdback to summary
public static long getMGFId(String name)
getMGFNameback to summary
public static String getMGFName(long id)
getNameback to summary
private static String getName(Map<Integer, String> nameMap, long id)
getObjectClassIdback to summary
public static long getObjectClassId(String name)
getObjectClassNameback to summary
public static String getObjectClassName(long id)
getParamSourcesIdback to summary
public static long getParamSourcesId(String name)
getParamSourcesNameback to summary
public static String getParamSourcesName(long id)
getPrfIdback to summary
public static long getPrfId(String name)
getPrfNameback to summary
public static String getPrfName(long id)
hashCodeback to summary
public static int hashCode(byte[] array)

Calculate a hash code for the given byte array.

Parameters
array:byte[]

The byte array.

Returns:int

A hash code for the given array.

hashCodeback to summary
public static int hashCode(char[] array)

Calculate a hash code for the given char array.

Parameters
array:char[]

The char array.

Returns:int

A hash code for the given array.

hashCodeback to summary
public static int hashCode(CK_DATE date)

Calculate a hash code for the given date object.

Parameters
date:CK_DATE

The date object.

Returns:int

A hash code for the given date.

mechanismInfoFlagsToStringback to summary
public static String mechanismInfoFlagsToString(long flags)

converts the long value flags to a MechanismInfoFlag string

Parameters
flags:long

the flags to be converted

Returns:String

the MechanismInfoFlag string representation of the flags

saltTypeToStringback to summary
public static String saltTypeToString(long ulSaltType)

converts a long value to a HKDF salt type string

Parameters
ulSaltType:long

the HKDF salt type to be converted

Returns:String

the HKDF salt type string representation

sessionInfoFlagsToStringback to summary
public static String sessionInfoFlagsToString(long flags)

converts the long value flags to a SessionInfoFlag string

Parameters
flags:long

the flags to be converted

Returns:String

the SessionInfoFlag string representation of the flags

sessionStateToStringback to summary
public static String sessionStateToString(long state)

converts the long value state to a SessionState string

Parameters
state:long

the state to be converted

Returns:String

the SessionState string representation of the state

slotInfoFlagsToStringback to summary
public static String slotInfoFlagsToString(long flags)

converts the long value flags to a SlotInfoFlag string

Parameters
flags:long

the flags to be converted

Returns:String

the SlotInfoFlag string representation of the flags

toBinaryStringback to summary
public static String toBinaryString(long value)

converts a long value to a binary String

Parameters
value:long

the long value to be converted

Returns:String

the binary string representation of the long value

toBinaryStringback to summary
public static String toBinaryString(byte[] value)

converts a byte array to a binary String

Parameters
value:byte[]

the byte array to be converted

Returns:String

the binary string representation of the byte array

toFullHexStringback to summary
public static String toFullHexString(long value)

Converts a long value to a hexadecimal String of length 16. Includes leading zeros if necessary.

Parameters
value:long

The long value to be converted.

Returns:String

The hexadecimal string representation of the long value.

toFullHexStringback to summary
public static String toFullHexString(int value)

Converts a int value to a hexadecimal String of length 8. Includes leading zeros if necessary.

Parameters
value:int

The int value to be converted.

Returns:String

The hexadecimal string representation of the int value.

toHexStringback to summary
public static String toHexString(long value)

converts a long value to a hexadecimal String

Parameters
value:long

the long value to be converted

Returns:String

the hexadecimal string representation of the long value

toHexStringback to summary
public static String toHexString(byte[] value)

Converts a byte array to a hexadecimal String. Each byte is presented by its two digit hex-code; 0x0A -> "0a", 0x00 -> "00". No leading "0x" is included in the result.

Parameters
value:byte[]

the byte array to be converted

Returns:String

the hexadecimal string representation of the byte array

tokenInfoFlagsToStringback to summary
public static String tokenInfoFlagsToString(long flags)

converts long value flags to a TokenInfoFlag string

Parameters
flags:long

the flags to be converted

Returns:String

the TokenInfoFlag string representation of the flags

sun.security.pkcs11.wrapper back to summary

private Class Functions.Flags

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final long[]
private final String[]

Constructor Summary

AccessConstructor and Description
pack-priv
Flags(long[] flagIds, String[] flagNames)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
toString(long val)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

flagIdsback to summary
private final long[] flagIds
flagNamesback to summary
private final String[] flagNames

Constructor Detail

Flagsback to summary
pack-priv Flags(long[] flagIds, String[] flagNames)

Method Detail

toStringback to summary
pack-priv String toString(long val)