/// <summary> /// Initializes a new <see cref="PaymentSystemEnvironment"/> instance. /// </summary> /// <param name="cardChannel"><see cref="ICardChannel">ICardChannel</see> object to use.</param> public PaymentSystemEnvironment(ICardChannel cardChannel) : base(cardChannel) { SearchTagAidInFci = false; _tlvRecords = new List <TlvData>(); Name = "1PAY.SYS.DDF01"; }
/// <summary> /// Initializes a new <see cref="EmvApplication"/> instance. /// </summary> /// <param name="cardChannel"><see cref="ICardChannel">ICardChannel</see> object to use</param> /// <param name="tlvFromPSE"><see cref="TlvData">TLVData</see> object coming from PSE records for this application</param> public EmvApplication(ICardChannel cardChannel, TlvData tlvFromPSE) : this(cardChannel) { _tlvFromPSE = tlvFromPSE; if (_tlvFromPSE.HasTag(0x4F)) { Aid = _tlvFromPSE.GetTag(0x4F).Value.ToHexa(); } }
static void Main(string[] args) { Func <ICardContext, ICardChannel> createCardChannel; Action processCommands; if (args.Length == 2) { switch (args[1]) { case "applet": createCardChannel = (context) => new CardChannel(context, context.Readers.Last(), new JavaCardApplet()); processCommands = ProcessTb100FakeCardCommands; break; case "javacard": default: createCardChannel = (context) => new CardChannel(context, context.Readers.Last(), new JavaCardT0ForTB100Adapter(new JavaCardApplet())); processCommands = ProcessJavaCardTb100FakeCardCommands; break; } } else { createCardChannel = (context) => new CardChannel(context, context.Readers.Last(), new JavaCardT0ForTB100Adapter(new JavaCardApplet())); processCommands = ProcessJavaCardTb100FakeCardCommands; } // Connect to Fake PC/SC var context = new CardContext(); context.Establish(); // Get installed readers context.ListReaderGroups(); context.ListReaders(""); PrintReadersAndReaderGroups(context); // Connect to an ISO7816-4 card in the last reader found var rawChannel = createCardChannel(context); channel = new CardChannelIso7816(rawChannel); channel.Connect(ShareMode.Exclusive, Protocol.Any); PrintAttribute(Attrib.AtrString); PrintAttribute(Attrib.DeviceFriendlyName); processCommands(); // Unpower the card channel.Disconnect(Disposition.UnpowerCard); // Disconnect from Fake PC/SC context.Release(); }
public void NotifyReconnect(ICardChannel cardChannel, ShareMode shareMode, Protocol preferedProtocol, Disposition initialization, ErrorCode errorCode) { if (errorCode == ErrorCode.Success) { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } else { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } }
public void NotifyDisconnect(ICardChannel cardChannel, Disposition disposition, ErrorCode errorCode) { if (errorCode == ErrorCode.Success) { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } else { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } }
public void NotifyTransmit(ICardChannel cardChannel, ICardCommand cardCommand, ICardResponse cardResponse, ErrorCode errorCode) { if (errorCode == ErrorCode.Success) { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); gui.guiDetailedLogs.AppendText(String.Format(header + ">> RAPDU: [{0}]\n", cardResponse)); } else { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } }
public void NotifyTransmit(ICardChannel cardChannel, ICardCommand cardCommand, byte[] recvBuffer, UInt32 recvSize, ErrorCode errorCode) { if (errorCode == ErrorCode.Success) { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); gui.guiDetailedLogs.AppendText(String.Format(header + ">> RAPDU: [{0}]\n", recvBuffer.ToHexa((int)recvSize))); } else { gui.guiDetailedLogs.AppendText(String.Format(header + ">> Error: {0}\n", errorCode)); } }
/// <summary> /// Creates a new <see cref="VisaContactlessApplication"/> instance. /// </summary> /// <param name="cardChannel"></param> public VisaContactlessApplication(ICardChannel cardChannel) : base(cardChannel) { }
/// <summary> /// Encapsulates an <see cref="ICardChannel"/> and add <see cref="ICardChannelObservable"/> behaviour. /// </summary> /// <param name="channel">Card channel to encapsulate.</param> /// <returns></returns> public static ICardChannelObservable ToObservable(this ICardChannel channel) { var observable = channel as ICardChannelObservable; return(observable ?? new CardChannelObservable(channel)); }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="channel"><c>ICardChannel</c> instance to wrap.</param> public CardChannelObservable(ICardChannel channel) { this.channel = channel; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="cardChannel"></param> /// <param name="protocolT"></param> public CardChannelIso7816(ICardChannel cardChannel, ProtocolT protocolT) { this.cardChannel = cardChannel; ProtocolT = protocolT; }
public void BeforeTransmit(ICardChannel cardChannel, ICardCommand cardCommand, ICardResponse cardResponse) { gui.guiDetailedLogs.SelectionColor = highlightColor; gui.guiDetailedLogs.AppendText(String.Format(header + "transmit({0})\n", cardCommand)); gui.guiDetailedLogs.SelectionColor = standardColor; }
public void BeforeTransmit(ICardChannel cardChannel, ICardCommand cardCommand, byte[] recvBuffer, UInt32 recvSize) { gui.guiDetailedLogs.SelectionColor = highlightColor; gui.guiDetailedLogs.AppendText(String.Format(header + "transmit({0})\n", cardCommand)); gui.guiDetailedLogs.SelectionColor = standardColor; }
public void BeforeReconnect(ICardChannel cardChannel, ShareMode shareMode, Protocol preferedProtocol, Disposition initialization) { gui.guiDetailedLogs.SelectionColor = highlightColor; gui.guiDetailedLogs.AppendText(String.Format(header + "reconnect({0},{1},{2})\n", shareMode, preferedProtocol, initialization)); gui.guiDetailedLogs.SelectionColor = standardColor; }
public void BeforeDisconnect(ICardChannel cardChannel, Disposition disposition) { gui.guiDetailedLogs.SelectionColor = highlightColor; gui.guiDetailedLogs.AppendText(String.Format(header + "disconnect({0})\n", disposition)); gui.guiDetailedLogs.SelectionColor = standardColor; }
/// <summary> /// Creates a new <see cref="EmvDefinitionFile"/> instance. /// </summary> /// <param name="cardChannel"><see cref="ICardChannel">ICardChannel</see> object to use</param> public EmvDefinitionFile(ICardChannel cardChannel) { _cardChannel = new CardChannelIso7816(new CardChannelTerminalTransportLayer(cardChannel)); TlvFci = null; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="cardChannel"></param> public CardChannelIso7816(ICardChannel cardChannel) : this(cardChannel, ProtocolT.T0) { }
/// <summary> /// Initializes a new <see cref="EmvApplication"/> instance. /// </summary> /// <param name="cardChannel"><see cref="ICardChannel">ICardChannel</see> object to use</param> public EmvApplication(ICardChannel cardChannel) : base(cardChannel) { _tlvRecords = new List <TlvData>(); _tlvOfflineRecords = new List <TlvData>(); }
/// <summary> /// Initializes a new <see cref="CardChannelTerminalTransportLayer"/> instance. /// </summary> /// <param name="cardChannel"></param> public CardChannelTerminalTransportLayer(ICardChannel cardChannel) { _cardChannel = cardChannel; }
/// <summary> /// /// </summary> /// <param name="cardChannel"></param> /// <returns></returns> public ErrorCode Transmit(ICardChannel cardChannel) { _errorCode = cardChannel.Transmit(CApdu, RApdu); return(ErrorCode); }