Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.18
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## iaik.pkcs.pkcs11.wrapper
Class Functions

    java.lang.Object
      |
      +--iaik.pkcs.pkcs11.wrapper.Functions

public class Functions
extends java.lang.Object

This class contains onyl static methods. It is the place for all functions that are used by several classes in this package.

Author:
  Karl Scheibelhofer , Martin Schl??????ffer

Field Summary
`protected static java.util.Hashtable` | `digestMechanisms_` This table contains the mechanisms that are digest mechanisms.
`protected static java.util.Hashtable` | `fullEncryptDecryptMechanisms_` This table contains the mechanisms that are full encrypt/decrypt mechanisms; i.e.
`protected static java.util.Hashtable` | `fullSignVerifyMechanisms_` This table contains the mechanisms that are full sign/verify mechanisms; i.e.
`protected static char[]` | `HEX_DIGITS` For converting numbers to their hex presentation.
`protected static java.util.Hashtable` | `keyDerivationMechanisms_` This table contains the mechanisms that are key derivation mechanisms.
`protected static java.util.Hashtable` | `keyGenerationMechanisms_` This table contains the mechanisms that key generation mechanisms; i.e.
`protected static java.util.Hashtable` | `keyPairGenerationMechanisms_` This table contains the mechanisms that key-pair generation mechanisms; i.e.
`protected static java.util.Hashtable` | `mechansimNames_` Maps mechanism codes as Long to their names as Strings.
`protected static java.util.Hashtable` | `signVerifyRecoverMechanisms_` This table contains the mechanisms that are sign/verify mechanisms with message recovery.
`protected static java.util.Hashtable` | `singleOperationEncryptDecryptMechanisms_` This table contains the mechanisms that are single-operation encrypt/decrypt mechanisms; i.e.
`protected static java.util.Hashtable` | `singleOperationSignVerifyMechanisms_` This table contains the mechanisms that are single-operation sign/verify mechanisms; i.e.
`protected static java.util.Hashtable` | `wrapUnwrapMechanisms_` This table contains the mechanisms that are wrap/unwrap mechanisms.

Constructor Summary
`Functions()`

Method Summary
`static java.lang.String` | `classTypeToString(long classType)` Converts the long value classType to a string representation of it.
`static boolean` | `equals(byte[] array1, byte[] array2)` Check the given arrays for equalitiy.
`static boolean` | `equals(char[] array1, char[] array2)` Check the given arrays for equalitiy.
`static boolean` | `equals(CK_DATE date1, CK_DATE date2)` Check the given dates for equalitiy.
`static boolean` | `equals(long[] array1, long[] array2)` Check the given arrays for equality.
`static int` | `hashCode(byte[] array)` Calculate a hash code for the given byte array.
`static int` | `hashCode(char[] array)` Calculate a hash code for the given char array.
`static int` | `hashCode(CK_DATE date)` Calculate a hash code for the given date object.
`static int` | `hashCode(long[] array)` Calculate a hash code for the given long array.
`static boolean` | `isDigestMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a digest mechanism.
`static boolean` | `isFullEncryptDecryptMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a full encrypt/decrypt mechanism; i.e.
`static boolean` | `isFullSignVerifyMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a full sign/verify mechanism; i.e.
`static boolean` | `isKeyDerivationMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a key derivation mechanism.
`static boolean` | `isKeyGenerationMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a key generation mechanism for generating symmetric keys.
`static boolean` | `isKeyPairGenerationMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a key-pair generation mechanism for generating key-pairs.
`static boolean` | `isSignVerifyRecoverMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a sign/verify mechanism with message recovery.
`static boolean` | `isSingleOperationEncryptDecryptMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a single-operation encrypt/decrypt mechanism; i.e.
`static boolean` | `isSingleOperationSignVerifyMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a single-operation sign/verify mechanism; i.e.
`static boolean` | `isWrapUnwrapMechanism(long mechanismCode)` This method checks, if the mechanism with the given code is a wrap/unwrap mechanism; i.e.
`static java.lang.String` | `mechanismCodeToString(long mechansimCode)` Converts the long value code of a mechanism to a name.
`static java.lang.String` | `mechanismInfoFlagsToString(long flags)` Converts the long value flags to a MechanismInfoFlag string.
`static java.lang.String` | `sessionInfoFlagsToString(long flags)` Converts the long value flags to a SessionInfoFlag string.
`static java.lang.String` | `sessionStateToString(long state)` Converts the long value state to a SessionState string.
`static java.lang.String` | `slotInfoFlagsToString(long flags)` Converts the long value flags to a SlotInfoFlag string.
`static java.lang.String` | `toBinaryString(byte[] value)` Converts a byte array to a binary String.
`static java.lang.String` | `toBinaryString(long value)` Converts a long value to a binary String.
`static java.lang.String` | `toFullHexString(int value)` Converts a int value to a hexadecimal String of length 8.
`static java.lang.String` | `toFullHexString(long value)` Converts a long value to a hexadecimal String of length 16.
`static java.lang.String` | `toHexString(byte[] value)` Converts a byte array to a hexadecimal String.
`static java.lang.String` | `toHexString(long value)` Converts a long value to a hexadecimal String.
`static java.lang.String` | `tokenInfoFlagsToString(long flags)` Converts long value flags to a TokenInfoFlag string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### mechansimNames_

    protected static java.util.Hashtable mechansimNames_

  Maps mechanism codes as Long to their names as Strings.

### fullEncryptDecryptMechanisms_

    protected static java.util.Hashtable fullEncryptDecryptMechanisms_

  This table contains the mechanisms that are full encrypt/decrypt mechanisms; i.e. mechanisms that support the update functoins. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### singleOperationEncryptDecryptMechanisms_

    protected static java.util.Hashtable singleOperationEncryptDecryptMechanisms_

  This table contains the mechanisms that are single-operation encrypt/decrypt mechanisms; i.e. mechanisms that do not support the update functoins. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### fullSignVerifyMechanisms_

    protected static java.util.Hashtable fullSignVerifyMechanisms_

  This table contains the mechanisms that are full sign/verify mechanisms; i.e. mechanisms that support the update functoins. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### singleOperationSignVerifyMechanisms_

    protected static java.util.Hashtable singleOperationSignVerifyMechanisms_

  This table contains the mechanisms that are single-operation sign/verify mechanisms; i.e. mechanisms that do not support the update functoins. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### signVerifyRecoverMechanisms_

    protected static java.util.Hashtable signVerifyRecoverMechanisms_

  This table contains the mechanisms that are sign/verify mechanisms with message recovery. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### digestMechanisms_

    protected static java.util.Hashtable digestMechanisms_

  This table contains the mechanisms that are digest mechanisms. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### keyGenerationMechanisms_

    protected static java.util.Hashtable keyGenerationMechanisms_

  This table contains the mechanisms that key generation mechanisms; i.e. mechanisms for generating symmetric keys. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### keyPairGenerationMechanisms_

    protected static java.util.Hashtable keyPairGenerationMechanisms_

  This table contains the mechanisms that key-pair generation mechanisms; i.e. mechanisms for generating key-pairs. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### wrapUnwrapMechanisms_

    protected static java.util.Hashtable wrapUnwrapMechanisms_

  This table contains the mechanisms that are wrap/unwrap mechanisms. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### keyDerivationMechanisms_

    protected static java.util.Hashtable keyDerivationMechanisms_

  This table contains the mechanisms that are key derivation mechanisms. The Long values of the mechanisms are the keys, and the mechanism names are the values.

### HEX_DIGITS

    protected static final char[] HEX_DIGITS

  For converting numbers to their hex presentation.

Constructor Detail

### Functions

    public Functions()

Method Detail

### toFullHexString

    public static java.lang.String toFullHexString(long value)

  Converts a long value to a hexadecimal String of length 16. Includes leading zeros if necessary.
  Parameters:
    `value` - The long value to be converted.
  Returns:
    The hexadecimal string representation of the long value.

### toFullHexString

    public static java.lang.String toFullHexString(int value)

  Converts a int value to a hexadecimal String of length 8. Includes leading zeros if necessary.
  Parameters:
    `value` - The int value to be converted.
  Returns:
    The hexadecimal string representation of the int value.

### toHexString

    public static java.lang.String toHexString(long value)

  Converts a long value to a hexadecimal String.
  Parameters:
    `value` - The long value to be converted.
  Returns:
    The hexadecimal string representation of the long value.

### toHexString

    public static java.lang.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` - the byte array to be converted
  Returns:
    the hexadecimal string representation of the byte array

### toBinaryString

    public static java.lang.String toBinaryString(long value)

  Converts a long value to a binary String.
  Parameters:
    `value` - the long value to be converted.
  Returns:
    the binary string representation of the long value.

### toBinaryString

    public static java.lang.String toBinaryString(byte[] value)

  Converts a byte array to a binary String.
  Parameters:
    `value` - The byte array to be converted.
  Returns:
    The binary string representation of the byte array.

### slotInfoFlagsToString

    public static java.lang.String slotInfoFlagsToString(long flags)

  Converts the long value flags to a SlotInfoFlag string.
  Parameters:
    `flags` - The flags to be converted.
  Returns:
    The SlotInfoFlag string representation of the flags.

### tokenInfoFlagsToString

    public static java.lang.String tokenInfoFlagsToString(long flags)

  Converts long value flags to a TokenInfoFlag string.
  Parameters:
    `flags` - The flags to be converted.
  Returns:
    The TokenInfoFlag string representation of the flags.

### sessionInfoFlagsToString

    public static java.lang.String sessionInfoFlagsToString(long flags)

  Converts the long value flags to a SessionInfoFlag string.
  Parameters:
    `flags` - The flags to be converted.
  Returns:
    The SessionInfoFlag string representation of the flags.

### sessionStateToString

    public static java.lang.String sessionStateToString(long state)

  Converts the long value state to a SessionState string.
  Parameters:
    `state` - The state to be converted.
  Returns:
    The SessionState string representation of the state.

### mechanismInfoFlagsToString

    public static java.lang.String mechanismInfoFlagsToString(long flags)

  Converts the long value flags to a MechanismInfoFlag string.
  Parameters:
    `flags` - The flags to be converted to a string representation.
  Returns:
    The MechanismInfoFlag string representation of the flags.

### mechanismCodeToString

    public static java.lang.String mechanismCodeToString(long mechansimCode)

  Converts the long value code of a mechanism to a name.
  Parameters:
    `mechansimCode` - The code of the mechanism to be converted to a string.
  Returns:
    The string representation of the mechanism.

### classTypeToString

    public static java.lang.String classTypeToString(long classType)

  Converts the long value classType to a string representation of it.
  Parameters:
    `classType` - The classType to be converted.
  Returns:
    The string representation of the classType.

### equals

    public static boolean equals(byte[] array1,
                                 byte[] 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 byte values.
  Parameters:
    `array1` - The first array.
    `array2` - The second array.
  Returns:
    True, if both arrays are `null` or both have the same length and contain exactly the same byte values. False, otherwise.

### equals

    public 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` - The first array.
    `array2` - The second array.
  Returns:
    True, if both arrays are `null` or both have the same length and contain exactly the same char values. False, otherwise.

### equals

    public static boolean equals(long[] array1,
                                 long[] array2)

  Check the given arrays for equality. This method considers both arrays as equal, if both are `null` or both have the same length and contain exactly the same byte values.
  Parameters:
    `array1` - The first array.
    `array2` - The second array.
  Returns:
    True, if both arrays are `null` or both have the same length and contain exactly the same byte values. False, otherwise.

### equals

    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` - The first date.
    `date2` - The second date.
  Returns:
    True, if both dates are `null` or both contain the same char values. False, otherwise.

### hashCode

    public static int hashCode(byte[] array)

  Calculate a hash code for the given byte array.
  Parameters:
    `array` - The byte array.
  Returns:
    A hash code for the given array.

### hashCode

    public static int hashCode(char[] array)

  Calculate a hash code for the given char array.
  Parameters:
    `array` - The char array.
  Returns:
    A hash code for the given array.

### hashCode

    public static int hashCode(long[] array)

  Calculate a hash code for the given long array.
  Parameters:
    `array` - The long array.
  Returns:
    A hash code for the given array.

### hashCode

    public static int hashCode(CK_DATE date)

  Calculate a hash code for the given date object.
  Parameters:
    `date` - The date object.
  Returns:
    A hash code for the given date.

### isFullEncryptDecryptMechanism

    public static boolean isFullEncryptDecryptMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a full encrypt/decrypt mechanism; i.e. it supports the encryptUpdate() and decryptUpdate() functions. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the encrypt and decrypt functions including encryptUpdate and decryptUpdate.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a full encrypt/decrypt mechanism. False, otherwise.

### isSingleOperationEncryptDecryptMechanism

    public static boolean isSingleOperationEncryptDecryptMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a single-operation encrypt/decrypt mechanism; i.e. it does not support the encryptUpdate() and decryptUpdate() functions. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the encrypt and decrypt functions excluding encryptUpdate and decryptUpdate.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a single-operation encrypt/decrypt mechanism. False, otherwise.

### isFullSignVerifyMechanism

    public static boolean isFullSignVerifyMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a full sign/verify mechanism; i.e. it supports the signUpdate() and verifyUpdate() functions. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the sign and verify functions including signUpdate and verifyUpdate.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a full sign/verify mechanism. False, otherwise.

### isSingleOperationSignVerifyMechanism

    public static boolean isSingleOperationSignVerifyMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a single-operation sign/verify mechanism; i.e. it does not support the signUpdate() and encryptUpdate() functions. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the sign and verify functions excluding signUpdate and encryptUpdate.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a single-operation sign/verify mechanism. False, otherwise.

### isSignVerifyRecoverMechanism

    public static boolean isSignVerifyRecoverMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a sign/verify mechanism with message recovery. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the signRecover and verifyRecover functions.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a sign/verify mechanism with message recovery. False, otherwise.

### isDigestMechanism

    public static boolean isDigestMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a digest mechanism. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the digest functions.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a digest mechanism. False, otherwise.

### isKeyGenerationMechanism

    public static boolean isKeyGenerationMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a key generation mechanism for generating symmetric keys. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the generateKey function.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a key generation mechanism. False, otherwise.

### isKeyPairGenerationMechanism

    public static boolean isKeyPairGenerationMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a key-pair generation mechanism for generating key-pairs. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the generateKeyPair function.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a key-pair generation mechanism. False, otherwise.

### isWrapUnwrapMechanism

    public static boolean isWrapUnwrapMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a wrap/unwrap mechanism; i.e. it supports the wrapKey() and unwrapKey() functions. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the wrapKey and unwrapKey functions.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a wrap/unwrap mechanism. False, otherwise.

### isKeyDerivationMechanism

    public static boolean isKeyDerivationMechanism(long mechanismCode)

  This method checks, if the mechanism with the given code is a key derivation mechanism. This is the information as provided by the table on page 229 of the PKCS#11 v2.11 standard. If this method returns true, the mechanism can be used with the deriveKey function.
  Parameters:
    `mechanismCode` - The code of the mechanism to check.
  Returns:
    True, if the provided mechanism is a key derivation mechanism. False, otherwise.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| IAIK PKCS#11 Wrapper version 1.2.18
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. version 1.2.18