private IsoReader GetReader(ref bool iSSecureElement) { IsoReader reader; // Establish SCard context SCardContext hContext = new SCardContext(); hContext.Establish(SCardScope.System); // Retrieve the list of Smartcard readers string[] szReaders = hContext.GetReaders(); // Create a reader object using the existing context reader = new IsoReader(hContext); // Connect to the card foreach (var sZReader in szReaders) { reader.Connect(sZReader, SCardShareMode.Shared, SCardProtocol.T0 | SCardProtocol.T1); var response = reader.Transmit(GetSelectAppBytes(reader)); if (response.SW1 == 0x90) { iSSecureElement = true; break; } } return(reader); }
public void OpenCard() { EnsureInitialized(); if (reader.Reader.IsConnected) { return; } TryPcsc(() => reader.Connect(name, shareMode, protocol)); }
public IsoReader TryConnect(String cardName) { try { IsoReader card = new IsoReader(this.reader); card.Connect(cardName, SCardShareMode.Shared, SCardProtocol.Any); return(card); } catch (PCSCException) { return(null); } }
public SmartCard(SCardContext context, string readerName) { reader = new IsoReader(context); reader.Connect(readerName, SCardShareMode.Exclusive, SCardProtocol.Any); }