Class 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
       }
     
    Author:
    Karl Scheibelhofer (SIC), Lijun Liao (xipki)
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Slot​(PKCS11Module module, long slotID)
      The constructor that takes a reference to the module and the slot ID.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PKCS11Module 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.
      boolean isUseUtf8Encoding()
      Returns whether UTF8 encoding is set.
      void setUseUtf8Encoding​(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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Slot

        protected Slot​(PKCS11Module 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

      • setUseUtf8Encoding

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

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

        public PKCS11Module 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 PKCS11Exception
        Get information about this slot object.
        Returns:
        An object that contains information about this slot.
        Throws:
        PKCS11Exception - If reading the information fails.
      • getToken

        public Token getToken()
                       throws PKCS11Exception
        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:
        PKCS11Exception - If determining whether a token is present fails.
      • 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