Opens a session on this token
Namespace:
Cryptware.NCryptokiAssembly: NCryptoki (in NCryptoki.dll)
Syntax
Visual Basic (Declaration) |
---|
<ComVisibleAttribute(False)> _ Public Function OpenSession ( _ flags As Integer, _ app As Object, _ notify As Delegate _ ) As Session |
C# |
---|
[ComVisibleAttribute(false)] public Session OpenSession( int flags, Object app, Delegate notify ) |
Visual C++ |
---|
[ComVisibleAttribute(false)] public: Session^ OpenSession( int flags, Object^ app, Delegate^ notify ) |
JavaScript |
---|
function openSession(flags, app, notify); |
Parameters
- flags
- Type: System..::..Int32
Flags for this session
- app
- Type: System..::..Object
Application Object
- notify
- Type: System..::..Delegate
Delegate for notification
Return Value
a new Session Object
Remarks
OpenSession opens a session between an application and a token in a particular slot.
When opening a session with OpenSession, the flags parameter consists of the logical
OR of zero or more bit flags defined in the CK_SESSION_INFO data type. For legacy
reasons, the CKF_SERIAL_SESSION bit must always be set; if a call to
OpenSession does not have this bit set, the call should return unsuccessfully with the
error code CKR_PARALLEL_NOT_SUPPORTED.
There may be a limit on the number of concurrent sessions an application may have with
the token, which may depend on whether the session is “read-only” or “read/write”. An
attempt to open a session which does not succeed because there are too many existing
sessions of some type should return CKR_SESSION_COUNT.
If the token is write-protected (as indicated in the CK_TOKEN_INFO structure), then
only read-only sessions may be opened with it.
If the application calling C_OpenSession already has a R/W SO session open with the
token, then any attempt to open a R/O session with the token fails with error code
CKR_SESSION_READ_WRITE_SO_EXISTS (see Section 6.7.7 of PKCS#11 v.2.20 specificatins).