com.ibm.crypto.pkcs11impl.provider
Class SessionManager
- java.lang.Object
-
- com.ibm.crypto.pkcs11impl.provider.SessionManager
-
public class SessionManager extends java.lang.ObjectManages Sessions for a crypto token. Each token can have multiple pkcs11 sessions. An application must use session to access the token's crypto functions. As each session can only perform one crypto operation at a time, SessionManager maintains two internal Session queues. One for sessions that only do crypto functions, one for sessions that can also create session objects. A session can not be closed if there are session objects in it. Closing it would destroy the objects. Objects in one session is accessible to other sessions, so it is fine for other sessions to perform crypto functions with this session's object. A Session is polled from the queue to perform a crypto operation. To reduce the overhead of open/close pkcs11 session, a Session object will return to the queue once it is done with the operation.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidcloseAllSessions()voidcloseSession(Session session)voiddemoteObjSession(Session objSession)static SessionManagergetInstance(com.ibm.pkcs11.PKCS11Slot tokenSlot)SessiongetObjSession()Returns a session that may be used to create new session objects.SessiongetOpSession()Returns an operation session..com.ibm.pkcs11.PKCS11TokenInfogetToken()Returns the token associated with this SessionManager.com.ibm.pkcs11.PKCS11SlotgetTokenSlot()voidreleaseSession(Session session)Once a session is no longer being used, session manager puts it back to the session Queue.
-
-
-
Method Detail
-
getInstance
public static SessionManager getInstance(com.ibm.pkcs11.PKCS11Slot tokenSlot)
-
getOpSession
public Session getOpSession() throws com.ibm.pkcs11.PKCS11Exception
Returns an operation session.. It will not return null.- Throws:
com.ibm.pkcs11.PKCS11Exception
-
getObjSession
public Session getObjSession() throws com.ibm.pkcs11.PKCS11Exception
Returns a session that may be used to create new session objects. It will not return null.- Throws:
com.ibm.pkcs11.PKCS11Exception
-
getToken
public com.ibm.pkcs11.PKCS11TokenInfo getToken()
Returns the token associated with this SessionManager. Each token has only one SessionManager to manager the token's session.
-
getTokenSlot
public com.ibm.pkcs11.PKCS11Slot getTokenSlot()
-
releaseSession
public void releaseSession(Session session)
Once a session is no longer being used, session manager puts it back to the session Queue.
-
demoteObjSession
public void demoteObjSession(Session objSession)
-
closeSession
public void closeSession(Session session)
-
closeAllSessions
public void closeAllSessions()
-
-