IAIK PKCS#11 Wrapper
version 1.5

iaik.pkcs.pkcs11
Class Slot

java.lang.Object
  |
  +--iaik.pkcs.pkcs11.Slot

public class Slot
extends java.lang.Object

Objects of this class represent slots that can accept tokens. The application can get a token object, if there is one present, by calling getToken. This may look like this:

 
   Token token = slot.getToken();
 
   // to ensure that there is a token present in the slot
   if (token != null) {
     // ... work with the token
   }
 
 

Version:
1.0
Author:
Karl Scheibelhofer
See Also:
SlotInfo, Token

Field Summary
protected  Module module_
          The module that created this slot object.
protected  long slotID_
          The identifier of the slot.
protected  boolean useUtf8Encoding_
          True, if UTF8 encoding is used as character encoding for character array attributes and PINs.
 
Constructor Summary
protected Slot(Module module, long slotID)
          The constructor that takes a reference to the module and the slot ID.
 
Method Summary
 boolean equals(java.lang.Object otherObject)
          Compares the slot ID and the module_ of this object with the slot ID and module_ of the other object.
 Module getModule()
          Get the module that created this Slot object.
 long getSlotID()
          Get the ID of this slot.
 SlotInfo getSlotInfo()
          Get information about this slot object.
 Token getToken()
          Get an object for handling the token that is currently present in this slot, or null, if there is no token present.
 int hashCode()
          The overriding of this method should ensure that the objects of this class work correctly in a hashtable.
 boolean isSetUtf8Encoding()
          Returns whether UTF8 encoding is set.
 void setUtf8Encoding(boolean useUtf8Encoding)
          Specify, whether UTF8 character encoding shall be used for character array attributes and PINs.
 java.lang.String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

module_

protected Module module_
The module that created this slot object.

slotID_

protected long slotID_
The identifier of the slot.

useUtf8Encoding_

protected boolean useUtf8Encoding_
True, if UTF8 encoding is used as character encoding for character array attributes and PINs.
Constructor Detail

Slot

protected Slot(Module module,
               long slotID)
The constructor that takes a reference to the module and the slot ID.
Parameters:
module - The reference to the module of this slot.
slotID - The identifier of the slot.
Method Detail

equals

public boolean equals(java.lang.Object otherObject)
Compares the slot ID and the module_ of this object with the slot ID and module_ of the other object. Returns only true, if both are equal.
Overrides:
equals in class java.lang.Object
Parameters:
otherObject - The other Slot object.
Returns:
True, if other is an instance of Slot and the slot ID and module_ of both objects are equal. False, otherwise.

setUtf8Encoding

public void setUtf8Encoding(boolean useUtf8Encoding)
Specify, whether UTF8 character encoding shall be used for character array attributes and PINs.
Parameters:
useUtf8Encoding - true, if UTF8 shall be used

isSetUtf8Encoding

public boolean isSetUtf8Encoding()
Returns whether UTF8 encoding is set.
Returns:
true, if UTF8 is used as character encoding for character array attributes and PINs.

getModule

public Module getModule()
Get the module that created this Slot object.
Returns:
The module of this slot.

getSlotID

public long getSlotID()
Get the ID of this slot. This is the ID returned by the PKCS#11 module.
Returns:
The ID of this slot.

getSlotInfo

public SlotInfo getSlotInfo()
                     throws TokenException
Get information about this slot object.
Returns:
An object that contains informatin about this slot.
Throws:
TokenException - If reading the information fails.

getToken

public Token getToken()
               throws TokenException
Get an object for handling the token that is currently present in this slot, or null, if there is no token present.
Returns:
The object for accessing the token. Or null, if none is present in this slot.
Throws:
TokenException - If determining if a token is present fails.

hashCode

public int hashCode()
The overriding of this method should ensure that the objects of this class work correctly in a hashtable.
Overrides:
hashCode in class java.lang.Object
Returns:
The hash code of this object. Gained from the slot ID.

toString

public java.lang.String toString()
Returns the string representation of this object.
Overrides:
toString in class java.lang.Object
Returns:
the string representation of this object

IAIK PKCS#11 Wrapper
version 1.5

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.5