コード例 #1
0
ファイル: Slot.cs プロジェクト: arkkadin/pkcs11Interop
 /// <summary>
 /// Opens a session between an application and a token in a particular slot
 /// </summary>
 /// <param name="sessionType">Type of session to be opened</param>
 /// <returns>Session</returns>
 public Session OpenSession(SessionType sessionType)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         return((Platform.StructPackingSize == 0) ? new Session(_slot40.OpenSession(sessionType)) : new Session(_slot41.OpenSession(sessionType)));
     }
     else
     {
         return((Platform.StructPackingSize == 0) ? new Session(_slot80.OpenSession(sessionType)) : new Session(_slot81.OpenSession(sessionType)));
     }
 }
コード例 #2
0
 /// <summary>
 /// Opens a session between an application and a token in a particular slot
 /// </summary>
 /// <param name="readOnly">Flag indicating whether session should be read only</param>
 /// <returns>Session</returns>
 public Session OpenSession(bool readOnly)
 {
     if (Platform.UnmanagedLongSize == 4)
     {
         return((Platform.StructPackingSize == 0) ? new Session(_slot40.OpenSession(readOnly)) : new Session(_slot41.OpenSession(readOnly)));
     }
     else
     {
         return((Platform.StructPackingSize == 0) ? new Session(_slot80.OpenSession(readOnly)) : new Session(_slot81.OpenSession(readOnly)));
     }
 }