org.opensc.pkcs11.wrap
Class PKCS11Slot
java.lang.Object
org.opensc.util.DestroyableChild
org.opensc.util.DestroyableHolder
org.opensc.pkcs11.wrap.PKCS11Slot
- All Implemented Interfaces:
- Destroyable, DestroyableParent
public class PKCS11Slot
- extends DestroyableHolder
|
Constructor Summary |
PKCS11Slot(PKCS11Provider provider,
long id)
This contructor constructs an instance of an individual slot. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PKCS11Slot
public PKCS11Slot(PKCS11Provider provider,
long id)
throws PKCS11Exception
- This contructor constructs an instance of an individual slot.
The slots a usually label starting with an Id of 0 and onwards.
So, if you have just one device attached to your computer you
should usually done by calling new PKCS11Slot(provider,0).
- Parameters:
id - The Id of the slot.
- Throws:
PKCS11Exception - Upon errors when retrieving the slot information.
enumerateSlots
public static List<PKCS11Slot> enumerateSlots(PKCS11Provider provider)
throws PKCS11Exception
- Enumeraate all available slots of a given PKCS11 provider.
- Parameters:
provider - The PKCS11 provider to retrieve the slots for.
- Returns:
- A list of all available slots.
- Throws:
PKCS11Exception - Upon errors when retrieving the slot information.
waitForSlot
public static PKCS11Slot waitForSlot(PKCS11Provider provider)
throws PKCS11Exception
- Enumerate all available slots of a given PKCS11 provider.
- Parameters:
provider - The PKCS11 provider to retrieve the slots for.
- Returns:
- A list of all available slots.
- Throws:
PKCS11Exception - Upon errors when retrieving the slot information.
isTokenPresent
public boolean isTokenPresent()
throws PKCS11Exception
- Returns:
- Whether a token is present in this slot.
- Throws:
PKCS11Exception
isRemovableDevice
public boolean isRemovableDevice()
throws PKCS11Exception
- Returns:
- Whether a token is present in this slot.
- Throws:
PKCS11Exception
isHardwareDevice
public boolean isHardwareDevice()
throws PKCS11Exception
- Returns:
- Whether a token is present in this slot.
- Throws:
PKCS11Exception
getManufaturer
public String getManufaturer()
throws PKCS11Exception
- Returns:
- The manufacturer of the slot.
- Throws:
PKCS11Exception
getDescription
public String getDescription()
throws PKCS11Exception
- Returns:
- A description of the slot.
- Throws:
PKCS11Exception
getHardwareVersion
public double getHardwareVersion()
throws PKCS11Exception
- Returns:
- The hardware verion of the slot.
- Throws:
PKCS11Exception
getFirmwareVersion
public double getFirmwareVersion()
throws PKCS11Exception
- Returns:
- The Firmware verion of the slot.
- Throws:
PKCS11Exception
getMechanisms
public PKCS11Mechanism[] getMechanisms()
throws PKCS11Exception
- Returns:
- A list of mechanisms supported by this slot.
- Throws:
PKCS11Exception
getTokenLabel
public String getTokenLabel()
throws PKCS11Exception
- Returns:
- The label of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
getTokenManufacturer
public String getTokenManufacturer()
throws PKCS11Exception
- Returns:
- The manufacturer of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
getTokenModel
public String getTokenModel()
throws PKCS11Exception
- Returns:
- The model of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
getTokenSerialNumber
public String getTokenSerialNumber()
throws PKCS11Exception
- Returns:
- The serial number of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
getTokenMinPinLen
public int getTokenMinPinLen()
throws PKCS11Exception
- Returns:
- The minimal PIN length of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
getTokenMaxPinLen
public int getTokenMaxPinLen()
throws PKCS11Exception
- Returns:
- The maximal PIN length of the token.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent()
hasTokenProtectedAuthPath
public boolean hasTokenProtectedAuthPath()
throws PKCS11Exception
- Checks, if the token has an protected authentication path via a PINpad
or another hardware authentication method.
- Returns:
- Whether the token has a protected authentication path.
If
true, PIN parameters passed to the login
functions of an associated session may be null.
- Throws:
PKCS11Exception - When no token is in the slot or another
error of the underlying PKCS#11 engine occurrs.- See Also:
isTokenPresent(),
PKCS11Session.loginUser(char[]),
PKCS11Session.loginSO(char[])
getId
public long getId()
- Returns:
- Returns the id of this slot.
destroy
public void destroy()
throws DestroyFailedException
- Specified by:
destroy in interface Destroyable- Overrides:
destroy in class DestroyableHolder
- Throws:
DestroyFailedException
getPvh
protected long getPvh()
- Returns:
- Returns the C handle of the underlying provider.
getHandle
protected long getHandle()
- Returns:
- Returns the C handle of the slot.