Example #1
0
 internal static SignalsEnum PostOutcome(KernelDatabaseBase database, KernelQ qManager,
                                         KernelMessageidentifierEnum uiMessage,
                                         KernelStatusEnum uiStatus,
                                         byte[] holdTime,
                                         Kernel2OutcomeStatusEnum status,
                                         Kernel2StartEnum start,
                                         bool?isUIRequestOnOutcomePresent,
                                         KernelMessageidentifierEnum messageOnError,
                                         L1Enum l1Enum,
                                         byte[] SW12,
                                         L2Enum l2Enum,
                                         L3Enum l3Enum)
 {
     return(PostOutcome(database, qManager,
                        uiMessage,
                        uiStatus,
                        holdTime,
                        status,
                        start,
                        isUIRequestOnOutcomePresent,
                        messageOnError,
                        l1Enum,
                        SW12,
                        l2Enum,
                        l3Enum,
                        ValueQualifierEnum.NONE,
                        null,
                        null,
                        false,
                        KernelCVMEnum.N_A));
 }
Example #2
0
        public static byte[] PackRelatedDataTag(KernelDatabaseBase database, TLV tagListForPack)
        {
            List <byte[]> tlvRelatedDataBytes = new List <byte[]>();
            TLVList       tags = TLV.DeserializeChildrenWithNoV(tagListForPack.Value, 0);

            Logger.Log("Packing tag: " + tagListForPack.ToString());
            foreach (TLV tlv in tags)
            {
                TLV valForPackDb = database.Get(tlv.Tag.TagLable);
                TLV valForPack;
                if (valForPackDb == null)
                {
                    valForPack = TLV.Create(tlv.Tag.TagLable);
                }
                else
                {
                    byte[] copyVal = new byte[valForPackDb.Value.Length];
                    Array.Copy(valForPackDb.Value, copyVal, valForPackDb.Value.Length);
                    valForPack = TLV.Create(tlv.Tag.TagLable, copyVal);
                }
                valForPack.Val.PackValue(tlv.Val.GetLength());
                Logger.Log("Adding tag: " + valForPack.ToString());
                tlvRelatedDataBytes.Add(valForPack.Value);
            }
            return(tlvRelatedDataBytes.SelectMany(a => a).ToArray());
        }
Example #3
0
        private static CVMListIterationReturn IterateCVM(KernelDatabaseBase database, CardHolderVerificationRule cvrCurrentlySelected, long amountX, long amountY)
        {
            #region cvm.10
            if (cvrCurrentlySelected.IsConditionCodeUnderstood())
            #endregion
            {
                #region cvm.11
                if (cvrCurrentlySelected.AllDataRequiredIsAvailable(database))
                #endregion
                {
                    #region cvm.12
                    if (cvrCurrentlySelected.ConditionsSatisfied(database, amountX, amountY))
                    #endregion
                    {
                        #region cvm.15
                        return(CVMListIterationReturn.ConditionsMet);

                        #endregion
                    }
                    else
                    {
                        return(CVMListIterationReturn.ConditionNotMet);
                    }
                }
                else
                {
                    return(CVMListIterationReturn.Error);
                }
            }
            else
            {
                return(CVMListIterationReturn.Error);
            }
        }
Example #4
0
        internal static void UpdateUserInterfaceRequestData(KernelDatabaseBase database, byte[] languagePref)
        {
            USER_INTERFACE_REQUEST_DATA_DF8116_KRN2 kuir = new USER_INTERFACE_REQUEST_DATA_DF8116_KRN2(database);

            kuir.Value.LanguagePreference = languagePref;
            kuir.UpdateDB();
        }
Example #5
0
        internal static void UpdateOutcomeParameterSet(KernelDatabaseBase database, bool receipt)
        {
            OUTCOME_PARAMETER_SET_DF8129_KRN2 kops = new OUTCOME_PARAMETER_SET_DF8129_KRN2(database);

            kops.Value.Receipt = receipt;
            kops.UpdateDB();
        }
Example #6
0
 private static void AddDDEntry(EMVTagMeta tag, KernelDatabaseBase database)
 {
     if (database.IsPresent(tag.Tag))
     {
         database.Get(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2).Children.AddToList(TLV.Create(tag.Tag, database.Get(tag).Value));
     }
 }
Example #7
0
        internal static void UpdateOutcomeParameterSet(KernelDatabaseBase database, byte fieldOffRequest)
        {
            OUTCOME_PARAMETER_SET_DF8129_KRN2 kops = new OUTCOME_PARAMETER_SET_DF8129_KRN2(database);

            kops.Value.FieldOffRequest = fieldOffRequest;
            kops.UpdateDB();
        }
Example #8
0
        private static void Do22_25(KernelDatabaseBase database, CardHolderVerificationRule cvrCurrentlySelected)
        {
            CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN cvr = new CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN(database);
            TERMINAL_VERIFICATION_RESULTS_95_KRN tvr = new TERMINAL_VERIFICATION_RESULTS_95_KRN(database);
            KernelCVMEnum cvmEnum = KernelCVMEnum.N_A;

            #region cvm.22
            cvmEnum = KernelCVMEnum.NO_CVM;
            tvr.Value.CardholderVerificationWasNotSuccessful = true;
            CommonRoutines.UpdateOutcomeParameterSet(database, cvmEnum);
            tvr.UpdateDB();
            #endregion

            #region cvm.23
            if (((byte)cvrCurrentlySelected.CVMConditionCode & 0x3F) == 0x00)
            #endregion
            {
                #region cvm.24
                cvr.Value.CVMPerformed = cvrCurrentlySelected.CVMRule;
                cvr.Value.CVMCondition = (byte)cvrCurrentlySelected.CVMConditionCode;
                cvr.Value.CVMResult    = 0x01;//failed
                #endregion
            }
            else
            {
                #region cvm.25
                cvr.Value.CVMPerformed = 0x3F;
                cvr.Value.CVMCondition = 0x00;
                cvr.Value.CVMResult    = 0x01;//failed
                #endregion
            }
            cvr.UpdateDB();
        }
Example #9
0
        internal static void UpdateOutcomeParameterSet(KernelDatabaseBase database, KernelCVMEnum cvmEnum)
        {
            OUTCOME_PARAMETER_SET_DF8129_KRN2 kops = new OUTCOME_PARAMETER_SET_DF8129_KRN2(database);

            kops.Value.CVM = cvmEnum;
            kops.UpdateDB();
        }
Example #10
0
        public static SignalsEnum PostOutcomeWithError(KernelDatabaseBase database, KernelQ qManager,
                                                       Kernel2OutcomeStatusEnum status,
                                                       Kernel2StartEnum start,
                                                       L1Enum l1Enum,
                                                       L2Enum l2Enum,
                                                       L3Enum l3Enum)
        {
            if (l1Enum == L1Enum.NOT_SET && l2Enum == L2Enum.NOT_SET && l3Enum == L3Enum.NOT_SET)
            {
                throw new EMVProtocolException("Cannot post with all enum error not set");
            }

            return(PostOutcome(database, qManager,
                               KernelMessageidentifierEnum.N_A,
                               KernelStatusEnum.N_A,
                               null,
                               status,
                               start,
                               null,
                               KernelMessageidentifierEnum.N_A,
                               l1Enum,
                               null,
                               l2Enum,
                               l3Enum,
                               ValueQualifierEnum.NONE,
                               null,
                               null,
                               false,
                               KernelCVMEnum.N_A));
        }
Example #11
0
        public static void PackRelatedDataTag(KernelDatabaseBase database, EMVTagMeta tagToPack, TLVList tagListForPack)
        {
            TLV           tlvRelatedData      = database.Get(tagToPack);
            List <byte[]> tlvRelatedDataBytes = new List <byte[]>();

            Logger.Log("Packing tag: " + tagListForPack.ToString());
            foreach (TLV tlv in tagListForPack)
            {
                TLV valForPackDb = database.Get(tlv.Tag.TagLable);
                TLV valForPack;
                if (valForPackDb == null)
                {
                    valForPack = TLV.Create(tlv.Tag.TagLable);
                }
                else
                {
                    byte[] copyVal = new byte[valForPackDb.Value.Length];
                    Array.Copy(valForPackDb.Value, copyVal, valForPackDb.Value.Length);
                    valForPack = TLV.Create(tlv.Tag.TagLable, copyVal);
                }
                valForPack.Val.PackValue(tlv.Val.GetLength());
                Logger.Log("Adding tag: " + valForPack.ToString());
                tlvRelatedDataBytes.Add(valForPack.Value);
            }
            tlvRelatedData.Value = tlvRelatedDataBytes.SelectMany(a => a).ToArray();
        }
Example #12
0
        public static byte[] VerifySSAD(ICCDynamicDataType iccDDType, KernelDatabaseBase database, CAPublicKeyCertificate caPublicKey, byte[] sdadRaw)
        {
            //section 5.4 of EMV book 2 - SDA
            //1.If the Signed Static Application Data has a length different from the
            //length of the ICC Public Key Modulus, SDA has failed
            IssuerPublicKeyCertificate ipk = IssuerPublicKeyCertificate.BuildAndValidatePublicKey(database, caPublicKey.Modulus, caPublicKey.Exponent);

            if (ipk == null)
            {
                return(null);
            }

            if (sdadRaw.Length != ipk.Modulus.Length)
            {
                return(null);
            }

            //2.In order to obtain the Recovered Data specified in Table 7, apply the
            //recovery function specified in Annex A2.1 on the Signed Static Application
            //Data using the Issuer Public Key in conjunction with the corresponding
            //algorithm.If the Recovered Data Trailer is not equal to 'BC', SDA has
            //failed.
            byte[] decrypted = PublicKeyCertificate.DecryptRSA(sdadRaw, ipk.Modulus, ipk.Exponent);
            SSAD   ssad      = new SSAD(decrypted);

            //3.Check the Recovered Data Header. If it is not '6A', SDA has failed.
            if (ssad.DataHeader != 0x6A)
            {
                return(null);
            }
            //4.Check the Signed Data Format. If it is not '03', SDA has failed.
            //For Visa specialpurpose readers it may return 0x93 if offline data authentication is supported for online transactions (in the TTQ)
            if (ssad.SignedDataFormat != 0x03 && ssad.SignedDataFormat != 0x05 && ssad.SignedDataFormat != 0x95)
            {
                return(null);
            }

            //5.Concatenate from left to right the second to the fifth data elements in
            //Table 7(that is, Signed Data Format through Pad Pattern), followed by
            //the static data to be authenticated as specified in section 10.3 of Book 3.If
            //the Static Data Authentication Tag List is present and contains tags other
            //than '82', then SDA has failed
            byte[] dataForHash = ssad.Concat(database.StaticDataToBeAuthenticated.BuildStaticDataToBeAuthenticated());

            //6.Apply the indicated hash algorithm(derived from the Hash Algorithm
            //Indicator) to the result of the concatenation of the previous step to
            //produce the hash result.
            byte[] hash = SHA1.Create().ComputeHash(dataForHash);

            //7.Compare the calculated hash result from the previous step with the
            //recovered Hash Result.If they are not the same, SDA has failed.
            if (Formatting.ByteArrayToHexString(ssad.HashResult) != Formatting.ByteArrayToHexString(hash))
            {
                return(null);
            }

            return(ssad.DataAuthenticationCode);
        }
Example #13
0
        internal static void UpdateUserInterfaceRequestData(KernelDatabaseBase database, KernelMessageidentifierEnum messageId, KernelStatusEnum status)
        {
            USER_INTERFACE_REQUEST_DATA_DF8116_KRN2 uird = new USER_INTERFACE_REQUEST_DATA_DF8116_KRN2(database);

            uird.Value.KernelMessageidentifierEnum = messageId;
            uird.Value.KernelStatusEnum            = status;
            uird.Value.HoldTime = database.GetDefault(EMVTagsEnum.MESSAGE_HOLD_TIME_DF812D_KRN2).Value;
            uird.UpdateDB();
        }
Example #14
0
        internal static void UpdateErrorIndication(KernelDatabaseBase database, CardResponse cardResponse, L1Enum l1Enum, L2Enum l2Enum, L3Enum l3Enum)
        {
            ERROR_INDICATION_DF8115_KRN2 kei = new ERROR_INDICATION_DF8115_KRN2(database);

            kei.Value.L1Enum = l1Enum;
            kei.Value.L2Enum = l2Enum;
            kei.Value.L3Enum = l3Enum;
            kei.Value.SW12   = cardResponse.ApduResponse.SW12;
            kei.UpdateDB();
        }
Example #15
0
        public static TLV InitializeDiscretionaryData(KernelDatabaseBase database)
        {
            TLV disc = database.Get(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2);

            if (disc == null)
            {
                disc = TLV.Create(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2.Tag);
                database.AddToList(disc);
            }
            return(disc);
        }
Example #16
0
        public static byte[] PackUdolRelatedDataTag(KernelDatabaseBase database)
        {
            TLV udol = database.Get(EMVTagsEnum.UDOL_9F69_KRN2);

            byte[] udolRelatedData;
            if (udol == null)
            {
                udol = database.Get(EMVTagsEnum.DEFAULT_UDOL_DF811A_KRN2);
            }

            udolRelatedData = PackRelatedDataTag(database, udol);
            return(udolRelatedData);
        }
        internal bool IsFailCardholderVerificationIfThisCVMIsUnsuccessful(KernelDatabaseBase database)
        {
            //if bit 7 of cvm rule is 0: Fail cardholder verification if this CVM is unsuccessful
            //if bit 7 of cvm rule is 1: Apply succeeding CV Rule if this CVM is unsuccessful

            if ((CVMRule & 0x40) == (byte)CVMFailureCondition.FailCardholderVerificationIfThisCVMIsUnsuccessful)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #18
0
        public static void CreateMSDiscretionaryDataRecord(KernelDatabaseBase database)
        {
            //Table 4.8
            if (database.Get(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2) == null)
            {
                database.AddToList(TLV.Create(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2.Tag));
            }

            AddDDEntry(EMVTagsEnum.APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2, database);
            AddDDEntry(EMVTagsEnum.DD_CARD_TRACK1_DF812A_KRN2, database);
            AddDDEntry(EMVTagsEnum.DD_CARD_TRACK2_DF812B_KRN2, database);
            AddDDEntry(EMVTagsEnum.ERROR_INDICATION_DF8115_KRN2, database);
            AddDDEntry(EMVTagsEnum.THIRD_PARTY_DATA_9F6E_KRN2, database);
        }
Example #19
0
        public static void PostUIOnly(KernelDatabaseBase database, KernelQ qManager,
                                      KernelMessageidentifierEnum uiMessage,
                                      KernelStatusEnum uiStatus, bool updateDB)
        {
            USER_INTERFACE_REQUEST_DATA_DF8116_KRN2 uird = new USER_INTERFACE_REQUEST_DATA_DF8116_KRN2(database);

            uird.Value.KernelMessageidentifierEnum = uiMessage;
            uird.Value.KernelStatusEnum            = uiStatus;
            if (updateDB)
            {
                uird.UpdateDB();
            }

            qManager.EnqueueToOutput(new KernelUIResponse(uird));
        }
Example #20
0
        private static void Do_CVM_14(KernelDatabaseBase database, CARDHOLDER_VERIFICATION_METHOD_CVM_RESULTS_9F34_KRN cvr)
        {
            KernelCVMEnum cvmEnum = KernelCVMEnum.N_A;

            #region cvm.14
            cvmEnum = KernelCVMEnum.NO_CVM;
            cvr.Value.CVMPerformed = 0x3F; //No CVM performed
            cvr.Value.CVMCondition = 0x00;
            cvr.Value.CVMResult    = 0x01; //failed
            CommonRoutines.UpdateOutcomeParameterSet(database, cvmEnum);
            cvr.UpdateDB();
            TERMINAL_VERIFICATION_RESULTS_95_KRN tvr = new TERMINAL_VERIFICATION_RESULTS_95_KRN(database);
            tvr.Value.CardholderVerificationWasNotSuccessful = true;
            tvr.UpdateDB();
            #endregion
        }
Example #21
0
        public SmartTag(KernelDatabaseBase database, EMVTagMeta emvTagMeta, V value)
            : base()
        {
            this.database = database;
            EMVTagMeta    = emvTagMeta;

            Tag = new T(EMVTagMeta.Tag);
            Val = value;

            TLV tlv = database.Get(EMVTagMeta);

            if (tlv != null && tlv.Val.Value.Length > 0)
            {
                Val.Deserialize(tlv.Val.Serialize(), 0);
            }
        }
        internal bool IsSupported(KernelDatabaseBase database)
        {
            TERMINAL_CAPABILITIES_9F33_KRN tc = new TERMINAL_CAPABILITIES_9F33_KRN(database);
            byte cvmCode = (byte)(CVMRule & 0x3F);

            if ((byte)CVMCode.PlaintextPINVerificationPerformedByICC == cvmCode)
            {
                return(tc.Value.PlainTextPINforICCVerificationCapable);
            }

            if ((byte)CVMCode.EncipheredPINVerifiedOnline == cvmCode)
            {
                return(tc.Value.EncipheredPINForOnlineVerificationCapable);
            }

            if ((byte)CVMCode.PlaintextPINVerificationPerformedByICCAndSignature_Paper == cvmCode)
            {
                return(tc.Value.PlainTextPINforICCVerificationCapable && tc.Value.SignaturePaperCapable);
            }

            if ((byte)CVMCode.EncipheredPINVerificationPerformedByICC == cvmCode)
            {
                return(tc.Value.EncipheredPINForOfflineVerificationCapable);
            }

            if ((byte)CVMCode.EncipheredPINVerificationPerformedByICCAndSignature_Paper == cvmCode)
            {
                return(tc.Value.EncipheredPINForOfflineVerificationCapable && tc.Value.SignaturePaperCapable);
            }

            if ((byte)CVMCode.Signature_Paper == cvmCode)
            {
                return(tc.Value.SignaturePaperCapable);
            }

            if ((byte)CVMCode.NoCVMRequired == cvmCode)
            {
                return(tc.Value.NoCVMRequiredCapable);
            }

            if ((byte)CVMCode.RFU == cvmCode)
            {
                return(tc.Value.SignaturePaperCapable);
            }

            return(false);
        }
Example #23
0
        public int deserialize(KernelDatabaseBase database, byte[] iccDynamicData, int pos)
        {
            ICCDynamicNumberLength = iccDynamicData[pos];
            pos++;
            ICCDynamicNumber = new byte[ICCDynamicNumberLength];
            Array.Copy(iccDynamicData, pos, ICCDynamicNumber, 0, ICCDynamicNumber.Length);
            pos = pos + ICCDynamicNumber.Length;

            if (IccDynamicDataType != ICCDynamicDataType.DYNAMIC_NUMBER_ONLY)
            {
                CryptogramInformationData = iccDynamicData[pos];
                pos++;
                ApplicationCryptogram = new byte[8];
                Array.Copy(iccDynamicData, pos, ApplicationCryptogram, 0, ApplicationCryptogram.Length);
                pos = pos + ApplicationCryptogram.Length;
                TransactionDataHashCode = new byte[20];
                Array.Copy(iccDynamicData, pos, TransactionDataHashCode, 0, TransactionDataHashCode.Length);
                pos = pos + TransactionDataHashCode.Length;
            }

            APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2 aci;

            switch (IccDynamicDataType)
            {
            case ICCDynamicDataType.NO_IDS_OR_RRP:
                break;

            case ICCDynamicDataType.IDS_AND_RRP:
                aci = new APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2(database);
                pos = deserializeIDS(aci, iccDynamicData, pos);
                pos = deserializeRRP(iccDynamicData, pos);
                break;

            case ICCDynamicDataType.IDS:
                aci = new APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2(database);
                pos = deserializeIDS(aci, iccDynamicData, pos);
                break;

            case ICCDynamicDataType.RRP:
                pos = deserializeRRP(iccDynamicData, pos);
                break;
            }

            return(pos);
        }
Example #24
0
        public static void CreateMSDataRecord(KernelDatabaseBase database)
        {
            //Table 4.10
            if (database.Get(EMVTagsEnum.DATA_RECORD_FF8105_KRN2) == null)
            {
                database.AddToList(TLV.Create(EMVTagsEnum.DATA_RECORD_FF8105_KRN2.Tag));
            }

            AddDREntry(EMVTagsEnum.POINTOFSERVICE_POS_ENTRY_MODE_9F39_KRN, database);
            AddDREntry(EMVTagsEnum.AMOUNT_AUTHORISED_NUMERIC_9F02_KRN, database);

            AddDREntry(EMVTagsEnum.APPLICATION_LABEL_50_KRN, database);
            AddDREntry(EMVTagsEnum.APPLICATION_PREFERRED_NAME_9F12_KRN, database);
            AddDREntry(EMVTagsEnum.DEDICATED_FILE_DF_NAME_84_KRN, database);
            AddDREntry(EMVTagsEnum.ISSUER_CODE_TABLE_INDEX_9F11_KRN, database);
            AddDREntry(EMVTagsEnum.MAGSTRIPE_APPLICATION_VERSION_NUMBER_READER_9F6D_KRN2, database);
            AddDREntry(EMVTagsEnum.TRACK_1_DATA_56_KRN2, database);
            AddDREntry(EMVTagsEnum.TRACK_2_DATA_9F6B_KRN2, database);
        }
Example #25
0
        public static void CreateEMVDiscretionaryData(KernelDatabaseBase database)
        {
            //Table 4.9
            if (database.Get(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2) == null)
            {
                database.AddToList(TLV.Create(EMVTagsEnum.DISCRETIONARY_DATA_FF8106_KRN2.Tag));
            }

            AddDDEntry(EMVTagsEnum.APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2, database);
            AddDDEntry(EMVTagsEnum.APPLICATION_CURRENCY_CODE_9F42_KRN, database);
            AddDDEntry(EMVTagsEnum.BALANCE_READ_AFTER_GEN_AC_DF8105_KRN2, database);
            AddDDEntry(EMVTagsEnum.BALANCE_READ_BEFORE_GEN_AC_DF8104_KRN2, database);
            AddDDEntry(EMVTagsEnum.DS_SUMMARY_3_DF8102_KRN2, database);
            AddDDEntry(EMVTagsEnum.DS_SUMMARY_STATUS_DF810B_KRN2, database);
            AddDDEntry(EMVTagsEnum.ERROR_INDICATION_DF8115_KRN2, database);
            AddDDEntry(EMVTagsEnum.POSTGEN_AC_PUT_DATA_STATUS_DF810E_KRN2, database);
            AddDDEntry(EMVTagsEnum.PREGEN_AC_PUT_DATA_STATUS_DF810F_KRN2, database);
            AddDDEntry(EMVTagsEnum.THIRD_PARTY_DATA_9F6E_KRN2, database);
            AddDDEntry(EMVTagsEnum.TORN_RECORD_FF8101_KRN2, database);
        }
Example #26
0
 //may be a response to a clean request in which case it will contain the torn record, if any, removed
 public static SignalsEnum PostOutcomeOnly(KernelDatabaseBase database, KernelQ qManager,
                                           Kernel2OutcomeStatusEnum k2OutcomeStatus,
                                           Kernel2StartEnum start)
 {
     return(PostOutcome(database, qManager,
                        KernelMessageidentifierEnum.N_A,
                        KernelStatusEnum.N_A,
                        null,
                        k2OutcomeStatus,
                        start,
                        null,
                        KernelMessageidentifierEnum.N_A,
                        L1Enum.NOT_SET,
                        null,
                        L2Enum.NOT_SET,
                        L3Enum.NOT_SET,
                        ValueQualifierEnum.NONE,
                        null,
                        null,
                        false,
                        KernelCVMEnum.N_A));
 }
Example #27
0
        public static void AddSDADDataToDatabase(KernelDatabaseBase database, ICCDynamicData iccdd)
        {
            if (iccdd.ApplicationCryptogram != null)
            {
                TLV ac = database.Get(EMVTagsEnum.APPLICATION_CRYPTOGRAM_9F26_KRN);
                if (ac == null)
                {
                    ac = TLV.Create(EMVTagsEnum.APPLICATION_CRYPTOGRAM_9F26_KRN.Tag);
                }
                ac.Value = iccdd.ApplicationCryptogram;
                database.AddToList(ac);
            }

            TLV iccdn = database.Get(EMVTagsEnum.ICC_DYNAMIC_NUMBER_9F4C_KRN);

            if (iccdn == null)
            {
                iccdn = TLV.Create(EMVTagsEnum.ICC_DYNAMIC_NUMBER_9F4C_KRN.Tag);
            }
            iccdn.Value = iccdd.ICCDynamicNumber;
            database.AddToList(iccdn);
        }
Example #28
0
 internal static SignalsEnum PostOutcomeOnly(KernelDatabaseBase database, KernelQ qManager,
                                             Kernel2OutcomeStatusEnum k2OutcomeStatus,
                                             KernelCVMEnum cvmStatus,
                                             bool receipt)
 {
     return(PostOutcome(database, qManager,
                        KernelMessageidentifierEnum.N_A,
                        KernelStatusEnum.N_A,
                        null,
                        k2OutcomeStatus,
                        Kernel2StartEnum.N_A,
                        true,
                        KernelMessageidentifierEnum.N_A,
                        L1Enum.NOT_SET,
                        null,
                        L2Enum.NOT_SET,
                        L3Enum.NOT_SET,
                        ValueQualifierEnum.NONE,
                        null,
                        null,
                        receipt,
                        cvmStatus));
 }
Example #29
0
        public static void PackDSDOLRelatedDataTag(KernelDatabaseBase database)
        {
            TLV tlvRelatedData = database.Get(EMVTagsEnum.DRDOL_RELATED_DATA_DF8113_KRN2);

            if (tlvRelatedData == null)
            {
                database.AddToList(TLV.Create(EMVTagsEnum.DRDOL_RELATED_DATA_DF8113_KRN2.Tag));
                tlvRelatedData = database.Get(EMVTagsEnum.DRDOL_RELATED_DATA_DF8113_KRN2);
            }
            List <byte[]> tlvRelatedDataBytes = new List <byte[]>();
            TLVList       tags = TLV.DeserializeChildrenWithNoV(database.Get(EMVTagsEnum.DSDOL_9F5B_KRN2).Value, 0);

            int count = 1;

            foreach (TLV tlv in tags)
            {
                TLV valForPack = database.Get(tlv.Tag.TagLable);
                if (valForPack == null)
                {
                    valForPack = TLV.Create(tlv.Tag.TagLable);
                }

                if (count == tags.Count && tlv.Val.GetLength() > valForPack.Value.Length)
                {
                    tlvRelatedDataBytes.Add(valForPack.Value);
                }
                else
                {
                    valForPack.Val.PackValue(tlv.Val.GetLength());
                    tlvRelatedDataBytes.Add(valForPack.Value);
                    count++;
                }
                Logger.Log("Packing DSDOL, Adding tag: " + valForPack.ToString());
            }

            tlvRelatedData.Value = tlvRelatedDataBytes.SelectMany(a => a).ToArray();
        }
 public APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2(KernelDatabaseBase database)
     : base(database, EMVTagsEnum.APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2,
            new APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2_VALUE(EMVTagsEnum.APPLICATION_CAPABILITIES_INFORMATION_9F5D_KRN2.DataFormatter))
 {
 }