Example #1
0
        public void DoEntryPointBAll(String path, string secDomainAID, string masterKey, string packageAid, string execModuleAid, string instanceAid)
        {
            Task.Run(() =>
            {
                try
                {
                    ProtocolActivation_B().ContinueWith((parentTask) =>
                    {
                        try
                        {
                            if (cancellationTokenForPreProcessing.Token.IsCancellationRequested)
                            {
                                cancellationTokenForPreProcessing.Dispose();
                                return;
                            }

                            PersoProcessing pxml = new PersoProcessing(cardQProcessor);
                            pxml.RemoveApp(secDomainAID, masterKey, packageAid);

                            using (MemoryStream capFile = new MemoryStream())
                            {
                                using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
                                {
                                    byte[] data = new byte[fs.Length];
                                    fs.Read(data, 0, (int)fs.Length);
                                    capFile.Write(data, 0, (int)fs.Length);
                                }
                                pxml.LoadCapFile(capFile, secDomainAID, masterKey);
                            }

                            pxml.InstallAndMakeSelectable(secDomainAID, masterKey, packageAid, execModuleAid, instanceAid);

                            PersoProcessingOutcome processingOutcome = new PersoProcessingOutcome()
                            {
                                NextProcessState          = EMVPersoPreProcessingStateEnum.EndProcess,
                                UIRequestOnOutcomePresent = true,
                                UserInterfaceRequest      = new UserInterfaceRequest()
                                {
                                    MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead
                                },
                                UIRequestOnRestartPresent = false,
                            };

                            OnProcessCompleted(processingOutcome);
                        }
                        catch (Exception ex)
                        {
                            OnExceptionOccured(ex);
                        }
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                }
                catch (Exception ex)
                {
                    OnExceptionOccured(ex);
                }
            });
        }
Example #2
0
        private void DoEntryPointBGetCardData()
        {
            Task.Run(() =>
            {
                try
                {
                    ProtocolActivation_B().ContinueWith((parentTask) =>
                    {
                        try
                        {
                            if (cancellationTokenForPreProcessing.Token.IsCancellationRequested)
                            {
                                cancellationTokenForPreProcessing.Dispose();
                                return;
                            }

                            PersoProcessing pxml = new PersoProcessing(cardQProcessor);
                            String cardData      = pxml.GetCardData();

                            PersoProcessingOutcome processingOutcome = new PersoProcessingOutcome()
                            {
                                NextProcessState          = EMVPersoPreProcessingStateEnum.EndProcess,
                                UIRequestOnOutcomePresent = true,
                                UserInterfaceRequest      = new UserInterfaceRequest()
                                {
                                    MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead
                                },
                                UIRequestOnRestartPresent = false,
                                CardData = cardData,
                            };

                            OnProcessCompleted(processingOutcome);
                        }
                        catch (Exception ex)
                        {
                            OnExceptionOccured(ex);
                        }
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                }
                catch (Exception ex)
                {
                    OnExceptionOccured(ex);
                }
            });
        }
Example #3
0
        public void DoEntryPointBInstallApp(string secDomainAID, string masterKey, string packageAid, string execModuleAid, string instanceAid)
        {
            Task.Run(() =>
            {
                try
                {
                    ProtocolActivation_B().ContinueWith((parentTask) =>
                    {
                        try
                        {
                            if (cancellationTokenForPreProcessing.Token.IsCancellationRequested)
                            {
                                cancellationTokenForPreProcessing.Dispose();
                                return;
                            }

                            PersoProcessing pxml = new PersoProcessing(cardQProcessor);
                            pxml.InstallAndMakeSelectable(secDomainAID, masterKey, packageAid, execModuleAid, instanceAid);

                            PersoProcessingOutcome processingOutcome = new PersoProcessingOutcome()
                            {
                                NextProcessState          = EMVPersoPreProcessingStateEnum.EndProcess,
                                UIRequestOnOutcomePresent = true,
                                UserInterfaceRequest      = new UserInterfaceRequest()
                                {
                                    MessageIdentifier = MessageIdentifiersEnum.ClearDisplay, Status = StatusEnum.ReadyToRead
                                },
                                UIRequestOnRestartPresent = false,
                            };

                            OnProcessCompleted(processingOutcome);
                        }
                        catch (Exception ex)
                        {
                            OnExceptionOccured(ex);
                        }
                    }, TaskContinuationOptions.OnlyOnRanToCompletion);
                }
                catch (Exception ex)
                {
                    OnExceptionOccured(ex);
                }
            });
        }