com.ibm.crypto.pkcs11impl.provider

Class SessionManager

  • java.lang.Object
    • com.ibm.crypto.pkcs11impl.provider.SessionManager


  • public class SessionManager
    extends java.lang.Object
    Manages 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 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()

© Portions Copyright 2003, 2017 IBM Corporation. All rights reserved.
© Portions Copyright 2003, 2017, Oracle and/or its affiliates. All rights reserved.