public void _03_CloseSessionViaSlotTest() { using (IPkcs11 pkcs11 = Settings.Factories.Pkcs11Factory.CreatePkcs11(Settings.Factories, Settings.Pkcs11LibraryPath, Settings.AppType)) { // Find first slot with token present ISlot slot = Helpers.GetUsableSlot(pkcs11); // Open RO (read-only) session ISession session = slot.OpenSession(SessionType.ReadOnly); // Do something interesting in RO session // Alternatively session can be closed with CloseSession method of Slot class. slot.CloseSession(session); } }