public static KernelBase ActivateKernel( TransactionRequest tt, CardQProcessor cardInterface, PublicKeyCertificateManager publicKeyCertificateManager, EMVSelectApplicationResponse response, TerminalSupportedKernelAidTransactionTypeCombination terminalCombinationForSelected, CardKernelAidCombination cardCombinationForSelected, EntryPointPreProcessingIndicators processingIndicatorsForSelected, CardExceptionManager cardExceptionManager, IConfigurationProvider configProvider ) //the response from the selected aid command { return(new Kernel(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider, response)); }
public static KernelBase ActivateKernel( TransactionRequest tt, CardQProcessor cardInterface, TornTransactionLogManager tornTransactionLogManager, PublicKeyCertificateManager publicKeyCertificateManager, EMVSelectApplicationResponse response, TerminalSupportedKernelAidTransactionTypeCombination terminalCombinationForSelected, CardKernelAidCombination cardCombinationForSelected, EntryPointPreProcessingIndicators processingIndicatorsForSelected, CardExceptionManager cardExceptionManager, IConfigurationProvider configProvider ) //the response from the selected aid command { switch (((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum) { case KernelEnum.Kernel1: EMVTagsEnum.DataKernelID = DataKernelID.K1; return(new Kernel1(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider)); case KernelEnum.Kernel2: EMVTagsEnum.DataKernelID = DataKernelID.K2; return(new Kernel2(tt.GetTransactionType_9C(), tornTransactionLogManager, cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider)); case KernelEnum.Kernel3: EMVTagsEnum.DataKernelID = DataKernelID.K3; return(new Kernel3(tt.GetTransactionType_9C(), cardInterface, publicKeyCertificateManager, processingIndicatorsForSelected, cardExceptionManager, configProvider)); case KernelEnum.Kernel4: break; case KernelEnum.Kernel5: break; case KernelEnum.Kernel6: break; case KernelEnum.Kernel7: break; default: throw new EMVProtocolException("Unsupported kernel: " + ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum); } throw new EMVProtocolException("Unsupported kernel: " + ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)terminalCombinationForSelected).KernelEnum); }
FinalCombinationSelection_Step3_From_3_3_3_3(CardQProcessor cardInterfaceManager, TerminalSupportedKernelAidTransactionTypeCombination supportedKernelAidCombination, CardKernelAidCombination candidate, TLV iad, TLV scriptData) { string finalAdfName = Formatting.ByteArrayToHexString(candidate.AdfNameTag.Value); #region 3.3.3.3 if (candidate.ExtendedSelectionTag.IsPresent() && ((TerminalSupportedContactlessKernelAidTransactionTypeCombination)supportedKernelAidCombination).ExtendedSelectionSupportFlag != null && (bool)((TerminalSupportedContactlessKernelAidTransactionTypeCombination)supportedKernelAidCombination).ExtendedSelectionSupportFlag) { finalAdfName = finalAdfName + Formatting.ByteArrayToHexString(candidate.ExtendedSelectionTag.Get().Value); } #endregion #region 3.3.3.4 ApduResponse cardResponse = cardInterfaceManager.SendCommand(new EMVSelectApplicationRequest(finalAdfName)) as EMVSelectApplicationResponse; EMVSelectApplicationResponse response; if (cardResponse is EMVSelectApplicationResponse) { response = (EMVSelectApplicationResponse)cardResponse; } else { throw new EMVProtocolException("Pre-processing transmit error: try again"); } #endregion #region 3.3.3.5 if (!response.Succeeded) #endregion { if (iad != null || scriptData != null) { return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.EndProcess, UIRequestOnOutcomePresent = true, UserInterfaceRequest = new UserInterfaceRequest() { MessageIdentifier = MessageIdentifiersEnum.InsertSwipeOrTryAnotherCard, Status = StatusEnum.ReadyToRead }, UIRequestOnRestartPresent = false }, response, supportedKernelAidCombination)); } else { return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC }, response, supportedKernelAidCombination)); } } TLV ttqInPDOL = response.GetPDOLTags().Get(EMVTagsEnum.TERMINAL_TRANSACTION_QUALIFIERS_TTQ_9F66_KRN.Tag); #region 3.3.3.6 if (finalAdfName.StartsWith(Enum.GetName(typeof(RIDEnum), RIDEnum.A000000003))) #endregion { if (((TerminalSupportedContactlessKernelAidTransactionTypeCombination)supportedKernelAidCombination).KernelEnum == KernelEnum.Kernel3) { if (response.GetPDOLTags().Count == 0 || ttqInPDOL == null) { if (TerminalSupportedKernelAidTransactionTypeCombinations.SupportedContactlessCombinations.Where(x => x.KernelEnum == KernelEnum.Kernel1).ToList().Count > 0) { //switch kernel to enable to kernel 1 TerminalSupportedKernelAidTransactionTypeCombination val = TerminalSupportedKernelAidTransactionTypeCombinations.SupportedContactlessCombinations.Where(x => x.KernelEnum == KernelEnum.Kernel1).ElementAt(0); return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.KernelActivation_StartD }, response, val)); } else { return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC }, response, supportedKernelAidCombination)); } } } } //we will not support Application Selection Registered Proprietary Data (ASRPD) and continue as if the data was not present return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.KernelActivation_StartD }, response, supportedKernelAidCombination)); }
SelectAppChosen(CardQProcessor cardInterfaceManager, TerminalSupportedKernelAidTransactionTypeCombination supportedKernelAidCombination, CardKernelAidCombination candidate) { string finalAdfName = Formatting.ByteArrayToHexString(candidate.AdfNameTag.Value); ApduResponse cardResponse = cardInterfaceManager.SendCommand(new EMVSelectApplicationRequest(finalAdfName)) as EMVSelectApplicationResponse; EMVSelectApplicationResponse response; if (cardResponse is EMVSelectApplicationResponse) { response = (EMVSelectApplicationResponse)cardResponse; } else { throw new EMVProtocolException("Pre-processing transmit error: try again"); } if (!response.Succeeded) { return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.CombinationSelection_StartC }, response, supportedKernelAidCombination)); } //TLV ttqInPDOL = response.GetPDOLTags().Get(EMVTagsEnum.TERMINAL_TRANSACTION_QUALIFIERS_TTQ_9F66_KRN.Tag); return(Tuple.Create( new EMVTerminalProcessingOutcome() { NextProcessState = EMVTerminalPreProcessingStateEnum.KernelActivation_StartD }, response, supportedKernelAidCombination)); }