Exemplo n.º 1
0
        private void guiDoExplicitDiscoveryOfAID_Click(object sender, EventArgs e)
        {
            try
            {
                // Try to select AID known by the terminal and undiscovered in PSE
                foreach (var app in _pluginConfiguration.terminalConfiguration.TerminalCapabilities.SupportedApplications)
                {
                    var notFound = true;
                    foreach (var emvFound in _emvApplications)
                    {
                        if (emvFound.Aid == app.Aid)
                        {
                            notFound = false;
                        }
                    }
                    // If AID not discovered, try to select it
                    if (notFound)
                    {
                        var emv = new EmvApplication(SharedData.CardChannel, new TlvData());
                        emv.Aid = app.Aid;
                        _detailedLogs.ObserveEmv(emv);
                        ObserveEmv(emv);
                        // If success, add the EMV ApplicationID instance to the candidate list
                        if (emv.Select() == 0x9000)
                        {
                            _emvApplications.Add(emv);
                        }
                    }
                }

                // Enable next step
                ActivateEMVSelectAid();

                // Update GUI
                UpdateApplicationsList();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "PSE Selection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        private void guiDoSelectAID_Click(object sender, EventArgs e)
        {
            // Get the EMV ApplicationID instance
            _emv = (EmvApplication)guiApplicationAID.SelectedItem;

            // Check if it is a valid instance
            if (_emv == null)
            {
                MessageBox.Show("An EMV application must be first selected.", "EMV application missing", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // Set the Certification Authorities
            _emv.CertificationAuthorityRepository = _certificationAuthorityRepository;

            // Add default terminal data
            _emv.TlvTerminalData.AddRange(_pluginConfiguration.transactionContext.TlvDatas);

            // Select the PSE
            _emv.Select();

            // Enable next step
            ActivateEMVGetProcessingOptions();
        }