예제 #1
0
        protected override void LoadKernelDefaultConfigurationDataObjects(TransactionTypeEnum transactionTypeEnum, IConfigurationProvider configProvider)
        {
            Logger.Log("Using Global Kernel 3 Values:");
            Kernel3Configuration = XMLUtil <Kernel3Configuration> .Deserialize(configProvider.GetKernel3GlobalConfigurationDataXML());

            #region 3.3.4.2 and 3.3.4.3
            TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN ttq = new TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN(this);
            if (Kernel3Configuration.FDDAForOnlineSupported)
            {
                ttq.Value.OfflineDataAuthenticationForOnlineAuthorizationsSupported = true;
            }
            else
            {
                ttq.Value.OfflineDataAuthenticationForOnlineAuthorizationsSupported = false;
            }
            #endregion

            Logger.Log("Using Kernel 3 Defaults:");
            KernelConfigurationDataForTransactionType kcdott = new KernelConfigurationDataForTransactionType()
            {
                TransactionTypeEnum            = transactionTypeEnum,
                KernelConfigurationDataObjects = TLVListXML.XmlDeserialize(configProvider.GetKernel3ConfigurationDataXML(Formatting.ByteArrayToHexString(new byte[] { (byte)transactionTypeEnum })))
            };

            int depth = 0;
            Logger.Log("Transaction Type: " + transactionTypeEnum + " Using Kernel3 Defaults: \n" + kcdott.KernelConfigurationDataObjects.ToPrintString(ref depth));

            KernelConfigurationData.Add(kcdott);
        }
예제 #2
0
        protected override void LoadKernelDefaultConfigurationDataObjects(TransactionTypeEnum transactionTypeEnum, IConfigurationProvider configProvider)
        {
            Logger.Log("Using Global Kernel 1 Values:");
            Kernel1Configuration = XMLUtil <Kernel1Configuration> .Deserialize(configProvider.GetKernel1GlobalConfigurationDataXML());

            Logger.Log("Using Kernel 1 Defaults:");
            KernelConfigurationDataForTransactionType kcdott = new KernelConfigurationDataForTransactionType()
            {
                TransactionTypeEnum            = transactionTypeEnum,
                KernelConfigurationDataObjects = TLVListXML.XmlDeserialize(configProvider.GetKernel3ConfigurationDataXML(Formatting.ByteArrayToHexString(new byte[] { (byte)transactionTypeEnum })))
            };

            int depth = 0;

            Logger.Log("Transaction Type: " + transactionTypeEnum + " Using Kernel1 Defaults: \n" + kcdott.KernelConfigurationDataObjects.ToPrintString(ref depth));

            KernelConfigurationData.Add(kcdott);
        }
예제 #3
0
        public static void LoadContactlessSupportedCombination(IConfigurationProvider configProvider, TransactionTypeEnum tt)
        {
            Logger.Log("Contactless Terminal Supported AIDs:");
            SupportedContactlessCombinations = XMLUtil <List <TerminalSupportedContactlessKernelAidTransactionTypeCombination> > .Deserialize(configProvider.GetContactlessTerminalSupportedRIDsXML());

            SupportedContactlessCombinations = SupportedContactlessCombinations.Where(x => x.TransactionTypeEnum == tt).ToList();

            SupportedContactlessCombinations
            .ForEach((x) =>
            {
                if (x.TTQAsBytes != null)
                {
                    x.TTQ   = new TERMINAL_TRANSACTION_QUALIFIERS_9F66_KRN();
                    int pos = 0;
                    x.TTQ.Value.Deserialize(TLV.Create(x.TTQAsBytes, ref pos).Val.Serialize(), 0);
                }
            });
        }
예제 #4
0
 public static void LoadContactSupportedCombination(IConfigurationProvider configProvider, TransactionTypeEnum tt)
 {
     Logger.Log("Contact Terminal Supported AIDs:");
     SupportedContactCombinations = XMLUtil <List <TerminalSupportedContactKernelAidTransactionTypeCombination> > .Deserialize(configProvider.GetContactTerminalSupportedAIDsXML());
 }
예제 #5
0
 public void LoadCAPublicKeyCertificates(IConfigurationProvider configProvider)
 {
     Logger.Log("CA Public Key Certificates:");
     CAPublicKeyCertificates = XMLUtil <List <CAPublicKeyCertificate> > .Deserialize(configProvider.GetPublicKeyCertificatesXML());
 }
예제 #6
0
 public void LoadTerminalExceptionFile(IConfigurationProvider configProvider)
 {
     Logger.Log("Terminal Exception File:");
     TerminalExceptionFile = XMLUtil <List <HotCard> > .Deserialize(configProvider.GetExceptionFileXML());
 }
예제 #7
0
 public static TLVList XmlDeserialize(string list)
 {
     return(DeserList(XMLUtil <List <TLVXML> > .Deserialize(list)));
 }
예제 #8
0
        public static void GPPersoFromXmlTest(string xml)
        {
            perso perso = XMLUtil <perso> .Deserialize(xml);

            perso.application.ToList().ForEach(app =>
            {
                installType it         = app.commands.install;
                INSTALL_PARAM_C9_GP ip = null;
                if (it.tokens != null)
                {
                    if (it.tokens.tlvxml != null)
                    {
                        ip             = new INSTALL_PARAM_C9_GP();
                        valueC9Type c9 = it.tokens.tlvxml.valueC9;
                        if (c9.C9_ApplicationInstanceSpecified)
                        {
                            ip.Value.ApplicationInstance = MapC9_ApplicationInstanceEnum(c9.C9_ApplicationInstance);
                        }
                        if (c9.C9_PinSharingSpecified)
                        {
                            ip.Value.PinSharing = MapC9_PinSharingEnum(c9.C9_PinSharing);
                        }
                        if (c9.C9_InterfacesAvailableSpecified)
                        {
                            ip.Value.InterfacesAvailable = MapC9_InterfacesAvailableEnum(c9.C9_InterfacesAvailable);
                        }
                    }
                }

                GPInstallRequestDataForInstall irfi = new GPInstallRequestDataForInstall()
                {
                    ExecutableLoadFileAID = it.ExecutableLoadFileAID,
                    ExecutableModuleAID   = it.ExecutableModuleAID,
                    ApplicationAID        = it.ApplicationAID,
                    Privileges            = Formatting.HexStringToByteArray(it.Privileges),
                    InstallToken          = Formatting.HexStringToByteArray(it.InstallToken),
                    InstallParamC9        = ip,
                };

                //select
                //auth
                GPInstallRequest ir = new GPInstallRequest((byte)InstallRequestP1Enum.LastOrOnlyCommand | (byte)InstallRequestP1Enum.ForMakeSelectable | (byte)InstallRequestP1Enum.ForInstall)
                {
                    CommandData = irfi.Serialize()
                };
                System.Diagnostics.Debug.WriteLine(ir.ToPrintString());

                //select
                //auth
                app.commands.storeData.ToList().ForEach(command =>
                {
                    GPStoreData sd = new GPStoreData
                    {
                        DGI = Formatting.HexStringToByteArray(command.DGI)
                    };
                    if (command.data != null)
                    {
                        sd.DataBytes = Formatting.HexStringToByteArray(command.data);
                    }
                    else
                    {
                        sd.Data = DeserList(command.tlvxml);
                    }
                    GPStoreDataReqest sdr = new GPStoreDataReqest
                    {
                        CommandData = sd.Serialize()
                    };
                    System.Diagnostics.Debug.WriteLine(sdr.ToPrintString());
                });
            });
        }
예제 #9
0
        public void PersoFromXml(string xml, string secDomainAID, string masterKey)
        {
            perso perso = XMLUtil <perso> .Deserialize(xml);

            byte[] masterKeyBytes = Formatting.HexStringToByteArray(masterKey);

            perso.application.ToList().ForEach(app =>
            {
                installType it         = app.commands.install;
                INSTALL_PARAM_C9_GP ip = null;
                if (it.tokens != null)
                {
                    if (it.tokens.tlvxml != null)
                    {
                        ip             = new INSTALL_PARAM_C9_GP();
                        valueC9Type c9 = it.tokens.tlvxml.valueC9;
                        if (c9.C9_ApplicationInstanceSpecified)
                        {
                            ip.Value.ApplicationInstance = MapC9_ApplicationInstanceEnum(c9.C9_ApplicationInstance);
                        }
                        if (c9.C9_PinSharingSpecified)
                        {
                            ip.Value.PinSharing = MapC9_PinSharingEnum(c9.C9_PinSharing);
                        }
                        if (c9.C9_InterfacesAvailableSpecified)
                        {
                            ip.Value.InterfacesAvailable = MapC9_InterfacesAvailableEnum(c9.C9_InterfacesAvailable);
                        }
                    }
                }

                GPInstallRequestDataForInstall irfi = new GPInstallRequestDataForInstall()
                {
                    ExecutableLoadFileAID = it.ExecutableLoadFileAID,
                    ExecutableModuleAID   = it.ExecutableModuleAID,
                    ApplicationAID        = it.ApplicationAID,
                    Privileges            = Formatting.HexStringToByteArray(it.Privileges),
                    InstallToken          = Formatting.HexStringToByteArray(it.InstallToken),
                    InstallParamC9        = ip,
                };

                persoAccessHandler.SelectApplication(Formatting.HexStringToByteArray(secDomainAID));
                //persoAccessHandler.AuthWithCard(masterKey);
                persoAccessHandler.AuthWithCard(masterKeyBytes, cardChallenge);

                persoAccessHandler.InstallForPerso(irfi.ApplicationAID);
                byte counter = 0;
                List <storeDataType> storeCommands = app.commands.storeData.ToList();
                storeCommands.ForEach(command =>
                {
                    bool isLast = (storeCommands.Count - 1) == counter;

                    GPStoreData sd = new GPStoreData
                    {
                        DGI         = Formatting.HexStringToByteArray(command.DGI),
                        DataBlock   = counter,
                        IsLastBlock = isLast,
                    };
                    if (command.data != null)
                    {
                        sd.DataBytes = Formatting.HexStringToByteArray(command.data);
                    }
                    else
                    {
                        sd.Data = DeserList(command.tlvxml);
                    }

                    persoAccessHandler.StoreDataToApplication(sd);
                    counter++;
                });
            });
        }
예제 #10
0
 public static NewRequest GetEntry <NewRequest>(string xml)
 {
     return((NewRequest)XMLUtil.Deserialize(typeof(NewRequest), xml));
 }