教程分析教案bei ch mifare ultralight card data definition v_第1页
教程分析教案bei ch mifare ultralight card data definition v_第2页
教程分析教案bei ch mifare ultralight card data definition v_第3页
教程分析教案bei ch mifare ultralight card data definition v_第4页
教程分析教案bei ch mifare ultralight card data definition v_第5页
已阅读5页,还剩36页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

History文档修订记修正版修正日说作SeeAppendixAPreviousHistoryA过去的修Neil19SepChangeStaticMACtobeonlyUIDandserialPhillip19SepRemovedreferencestodiversificationonBII’sShane20Sep3.3.1UseofActiveStatusField-UpdatedActiveblockselectiondescriptiontomatchnewflow3.3.1activeStatusNeil24OctMovedhistoryforv2.16tov2.19toAppendixA2.162.19A中UpdatedcoversheetEngineeringandProject1Introduction–Added_CHsuffixtoallBEInumbers.3.2StaticArea–RenamedkeyVersionto3.2keyVersion3.3DynamicArea–Renamed‘status’to4CardSerialNumberDefinition–AddedinformationonCheckDigitcalculation.4卡序列号定义-StaticAreaMACCalculation–RenamedtoMACCalculation,added5.1.1&5.1.2todescribethenewStaticandDynamicAreaMACCalculation.UpdatedFig2.静态区MAC计算-MAC5.1.12DetailedLayout–updatedtoreflectabovechanges.-TotalPurchaseValuerenamedto5.2详细结构-Neil13Nov3.2StaticData–testModeisnow13.2testMode1Neil14Novv3.5afterv3.5Neil22NovMovedhistoryforv2.20tov3.0toAppendixv2.20v3.01.3Terminology–MovedallTermsintotheTermscolumnandalldefinitionsintotheDefinitionscolumn.Neil修正版修正日说作1.3–把所有的术语移到术语列,把所有的定义移3.2StaticArea–ChangedtestModetotestCard,productTypetopurseOrProductTypeId,productCategorytopurseOrProductCategoryandproductIsserIdtopurseOrProductIssuerId.3.2静态区–testModetestCardproductTypepurseOrProductTypeId,把productIsserIdpurseOrProductIssuerId。4CardSerialNumberDefinition-IndustryCodenowdefinedas:75135MACCalculation–SeperatedfromDetailedCardLayoutsectionwhichisnowsection6.5MAC66DetailedLayoutupdatedtoreflectabovechanges6–根据以上变更进行了更新24Janv3.7afterGao25JanMadechangestosection1.4Referencesandcross-referenceformats.Re-appliedstyles.修改1.4参考文献和交叉格式。重新应用风格J.Bluhm-30Janv3.9afterVersionedforReleaseHarry修正版修正日说作14Removeduseof(card)“serialnumber”toreferto删除票卡“序列号”UID。“Big-endianonlyappliestonumericvalues.Renamed“UIDArea”to“UIDandLockArea”tomatchitscontents.RecedreferencestoSAMfunctionswithacompletespecificationoftheMACalgorithms.CleanedupMACcalculationstouseconsistent将SAM函数的内容替换成完整的MAC算定。删MAC计算以便适用一致的术语。Removed“Encryption”columnfromTable10:DetailedCardLayout,becausenocarddataisPaddingbitsaresettoallzeros,toallowforeasieruseinfuture.MiscellaneousotherminorcorrectionsandMitch19Notedequivalences/differencesbetweenISO/IEC9797-1MACalgorithmandthealgorithmdefinedintheConstructionMinistrystandardApplicationtechnologyforconstructioncauseICcard(NationwideExposureDraft).ISO/IEC9797-1MACAddedreferencestoBEI-00022_APPC_CHDeviceCardProcessingSpecificationAppendixC.Mitch30JulyChangessincev4.0havebeenrejectedandthecontentofthehasbeenrevertedbacktov4.0content.VersionedforRelease5.0HarryTableofIntroduction引 Purpose目 Scope范 Overview概 CardData卡数 UIDAreaUID OneTime bleArea一次编程 UserRead/WriteArea用户读写 StaticData(IssuerArea)静态数据(区 DynamicData动态数 PeriodProduct定期产 PeriodProduct–DynamicData定期产品–动态数 MultirideProduct计次产 MultirideProduct–DynamicData计次产品–动态数 PurseProduct钱包产 PurseProduct–DynamicData钱包产品–动态数 CardSerialNumberDefinition卡序列 MACCalculationMAC计 CRC-32AlgorithmCRC-32算 DetailedCardLayout票卡具体结 Appendix PreviousHistory附录A文档历 ListofTables表Table1:Abbreviations,TermsandDefinitions表1:缩写、术语和定 TABLE2:CARDEEPROMMEMORYLAYOUT表2:卡的EEPROM结 Table3:DataStoredintheOneTime bleArea表3:在一次编程区内的数 Table4:DataStoredintheUserRead/WriteArea表4:在用户读/写区的数 Table5:StaticData表5:静态数 Table6:DynamicData表6:动态数 Table7:PeriodProduct–DynamicData表7:定期产品–动态数 Table8:MultirideProduct–DynamicData表8:计次产品–动态数 Table9:PurseProduct–DynamicData表9:钱包产品–动态数 Table10:DetailedCardLayout表10:票卡具体结 ListofFigures图Figure1:DynamicAreaSelectionFlow图1动态区选择流 Figure2:DynamicAreaMACCalculation动态区MAC计 Introduction引 isoneofasetof sthatdescribetheBeijingAFCClearingCentre(ACC)interfacespecifications.本文档是描述轨道交通自动售检票系统(ACC)接口规范的一组文档之Theset sBEI-00017_CHConfigurationDataDefinitionBEI-00019_CHMifareUltralightCardDataDefinitionBEI-00020_CHMifareStandard1KCardDataDefinitionBEI-00021_CHUsageDataDefinitionBEI-00022_CHDeviceCardProcessingSpecificationBEI-00022_APPC_CHDeviceCardProcessingSpecificationAppendixC设备票卡处理规范附录CBEI-00023_CHDeviceMan-MachineInterfaceSpecification设备人-BEI-00033_CHBaseTypeDataDefinitionBEI-00037_CHSystemInterfacesOverviewBEI-00039_CHACCtoLCInterfaceACCLCBEI-00040_CHSystemInitialValuesBEI-00045_CHOnlineEnquiryFunctionalSpecification查询功能说BEI-00054_CHSAMInterfaceSpecificationSAMPurpose目Thepurposeofthis istodefinethedatastructuresandelementsoftheMifareUltralightcontactlesscardfortheBeijingACCproject.本文档定义了轨道交通自动售检票系统使用的MifareUltralight非接触卡Scope范Thescopeofthis islimitedtoadefinitionofthedatafortheMifareUltralightContactlessSingle-TripTicketICMF0ICU1fortheBeijingproject.本文档仅限于定义供项目使用的MifareUltralight非接触式单程票ICMF01CU1的数ThedetaileddescriptionofhowthedeviceprocessesthecardiscontainedinBEI-Terminology术Table1listsabbreviations,termsanddefinitionsusedinthisTable1:Abbreviations,Termsand表1:缩写、术语和定缩术定AutomatedFareTheuseroftheConfigurationCyclicRedundancyMultirideAprepaidproductwhichprovidesthecardholderwiththerighttotravelforaspecificnumberofPeriodAprepaidproductprovidesthewiththerighttotravelforspecificAformofcontractbetweentheproductissuerandcardholder.Agenerictermforthecollectionofspecificproducttypes,i.e.multiride,periodandpurseproducts.PurseAproductthatprovidescardholderwithunitsthatareusedtoforgoodsandUniqueReferences参考文Thefollowingmaterialsaretobeusedinconjunctionwithorarereferencedby.[Ref: ConfigurationData[Ref: Intentionally[Ref: MifareStandard1KCardData[Ref: UsageData[Ref: DeviceCardProcessing[Ref: DeviceMan-MachineInterface[Ref: BaseTypeData[Ref: SystemInterfaces[Ref: ACCtoLC[Ref: SystemInitial[Ref: OnlineEnquiryFunctional[Ref: SAMInterface[Ref:13] MifareUltralightContactlessSingle-TripTicketIC,MF0ICU1,FunctionalSpecification,Revision3.0,March2003,PhilipsSemiconductors[Ref:14] ANSX9.52-1998TripleDataEncryptionAlgorithmModesOfOperation,ApprovedJuly29,1998,AmericanBankersAssociationOverview概ThissectiondescribesthecontextoftheMifareUltralightsmartcardandhowdataisrepresentedonit.Context背TheMifareUltralightcardisasimplecontactlessmemorycarddbyPhilipsandspecificallydesignedfortransportapplications.DataRepresentation数据表Allnumericvaluesdefinedinthis arespecifiedusingdecimalnotationunlessexplicitlyspecifiedotherwise.Alldatafieldsdefinedin shallbestoredinbig-endianCardData卡数ThissectionincludesdescriptionsStaticDynamicMultiridePursePeriodOverview概TheMifareUltralightcardhasatotalof512bits(64bytes)ofEEPROM,whichisorganisedin16pagesof4byteseach.MifareUltralight512位(64字节)EEPROM164字TheEEPROMispartitionedasshowninTable2.EEPROM2表示。Table2:CardEEPROMMemory表2:卡的EEPROM结区Size大小(位说1UIDUID2OneTimeProgrble(OTP)3UserRead/WriteTotal:Bits(64ThethreememoryareasdefinedinTable2aredescribedinmoredetailinthefollowingUIDAreaUIDThe96-bitUIDAreaismandatedbyPhilipsandcontainsthefollowingCardserialnumber(7bytes),agloballyuniquenumber,whichcomplieswiththeISO/IEC14443-3andISO/IEC7816-6AMD.1standards(7字节)ISO/IEC14443-3ISO/IEC7816-6AMD.1Serialnumbercheckdigits(2bytes),complyingwiththeISO/IEC14443-3序列号校验位(2字节)ISO/IEC14443-3Internalusedata(1数据(1字节)Datalockbytes(2bytes),tolocktheOneTimeProgrbleAreaandUserRead/WriteAreatoread-only.RefertothePhilipsMifareUltralightFunctionalSpecification[Ref:13]formoreinformationontheUIDArea.UID的信息参见PhilipsMifareUltralight功能规范[Ref:13]OneTimeProgrbleArea一次编程TheOneTimeProgrbleAreawillbeusedtostorethecardserialnumber,whichiswrittenwhenthecardismanufacturedandmaynotbesubsequentlyupdated.Notethattheseven-byteserialnumberstoredbyPhilipsintheUIDArea(seesection3.1.1)isunnecessarilylarge.Forthisreason,a32-bitserialnumbersuitablefortheBeijingsystemisstoredintheOneTimeProgrbleArea.请注意,飞利浦公司在UID区(参见3.1.1节)的7字节序列号太大了。因此,适用于系统的一个32位序列号被在一次编程区内。Table3:DataStoredintheOneTimeProgrble表3:在一次编程区内的数字Size大小(位说Thecardserialnumber,whichallowsthecardtobeuniquelyidentifiedwithintheBeijingsystem.ThecardserialnumberisassignedbythecardmanufactureraccordingtoBeijingsystemRangeTotal:位UserRead/WriteArea用户读写TheUserRead/WriteAreawillcontainthemajorityofthecarddata.Theareawillbesplitintothreeblocks,comprising:Block1:StaticDatathatiswrittentothecardwhentheproductitcontainsisBlocks2and3:DynamicDatathatiswrittentothecardwhentheproductisused.Theblocksaresizedanddefinedidentically,andtheyarewrittentoalternayinordertoprovideanti-tearsupportforthecard.23块:动态数据,在使用产品时写进卡中。这两块区域是完全相同的,它们被Table4:DataStoredintheUserRead/Write表4:在用户读/写区的数块Size大小(位说1Static2DynamicDataBlock3DynamicDataBlockTotal:Bits(48StaticData(IssuerArea)静态数据(区Table5:Static5:静态数字Size大小(位说Card2SpecifiestheversionoftheMifareUltralightcardThecurrentversionisoneRangeMifareUltralight卡上数据格式的版本目前的版本是1字Size大小(位说Specifiesthenumberoftimesthecardhasbeenre-Range卡被重新的次数3Specifiestheversionofthedataencryptionkeythatwasusedtoprotectthedatastoredonthecard.Range确保在卡上数据安全的数据密钥的版本9Specifiesthedate/timeofthestartofthemonththecardwasinitialisedasfollows:0=1stJanuary20061=1stFebruary20062=1stMarch200600:00(witharangeofapproximay42020061112006212200631ThebatchnumberthecardwasissuedRange0to1Specifieswhetherthecardhasbeenissuedfornormaluseorfortestpurposesasfollows:0=Thecardhasbeenissuedfornormal1=Thecardhasbeenissuedfortestortraining指定此卡是否已经被以供正常使用或供测试使用0=此卡已经被供正常使用1=此卡已经被供测试或培训使用6IdentifiesthetypeofproductasspecifiedbyitsRange0..63字Size大小(位说3Specifiesthetypeofpassengerinthetransitsystem,e.g.Adult,Child.Range0..72Specifiesthekindofproductstoredonthe0=NoProduct(productnotyet1=Purse2=Period3=Multiride0=无产品(产品尚未123Specifiesthemonetaryvaluepaidbythecardholdertopurchasetheperiod/multirideproduct,orthevaluelastaddedtothepurse.RangeRMB0.00toRMB范围:0.00元至1310.711forfutureuse.64Endof88Uniquelyidentifiesthedevicethatissuedtheproduct(byusingtheSAMIDofitsISAM).产品的设备唯一性标识(ISAMSAM2Specifiesthepaymentmethodofproductpurchase0=1=2=3=0123=字Size大小(位说2SpecifieswhethervalidityDurationisstoredasoneof0=1=2=3=Calendar0=1237Thenumberofminutes/hours/days/monthsamultirideor,periodorpurseproductisvalidforonceitisactivated.Range5Identifiestheissueroftheproduct,relativetotheapplicationissuerRange0..310forfutureuse.MAC-32oftheentirestaticdatablock(exceptMAC).Thisiscalculatedovertheunencrypted(intext)versionofthedata.Total:DynamicData动态数Table6:Dynamic6:动态数字Size大小(位说Card1AcycliccounterthatallowsthedevicetodeterminewhetherDynamicDataBlockAorBiscurrentlyactive.Thisisusedforanti-tearprotection.Seesection3.3.1formoreinformation.RangeA3.3.12Specifiestheblockingstatusofthecardas0=1=Not2=3=Blocked–Surrendered/Captured0123废弃/8Asequencenumberthatisincrementedundercertainconditions(definedbytheproducttype).Range一个序列号,在特定条件下增加(由产品类型确定)1Specifieswhetheranhasbeen0=not1=0=未打1=已打字Size大小(位说Journey旅Specifiesthedateandtimefromwhichthejourneyisvalid.UpdatedonthefirstlegofthecurrentpassengerSpecifiedasthenumberofminutessincecardBaseDateTime(witharangeofapproximay88年)。8SpecifiesthedateandtimewhentheproductwaslastSpecifiedasthenumberofminutesfromtheticketstartDateTime(witharangeofapproximay254mins/4分钟/4小时)SpecifiesthelocationatwhichtheproductwaslastTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation2Specifiesthenumberoftransfersthathavebeentakenforthecurrentjourney.字Size大小(位说3Specifiesthevalidationstatusofthejourneyas0=Productnotyet1=Lastusedtocheck-2=Lastusedtocheck-3=Lastusedtocheck-outintrainmalfunction4=Lastusedforcompensationfare567012345670forfutureuse.DynamicProductThedynamicproductdatastructure,whichisdependantonproducttype(seesections3.4.1,3.5.1and3.6.1).3.4.1节,.1节)。MACofthestaticanddynamicdataTotal:位UseoftheactiveStatusFieldactiveStatusTheactiveStatusfieldisa1-bitcycliccounter(range0..1)thatallowsthedevicetodeterminewhetherDynamicDataBlockAorBiscurrentlyactive.Thisisusedforanti-tearprotection.activeStatus1位的循环计数器(0..1),设备通过它可以判断目前动态数据块A或B是否处于激活状态。它被用于防保护。Thisnumberisincrementedonceeverytimeatransactionupdatesthedynamicdataonthecard;oncethevaluereaches1,itwrapsaroundto0again.Attheendofthetransaction,theupdatedcarddatawillbecopiedintothespecifieddatablock(AorB),andthepreviouscopyofthedataintheotherdatablockwillbep.Ifthetransactionistornwhilethecardisbeingupdated,thepreviousdataisleft在结束时,更新后的卡中数据将被到指定的数据块(A或B)中,另一数据块中上次的数据将被保留下来。如果当卡正在被更新时被中断,则上次的数据保持不AnexampleoftheprocessinglogicisasBothblockAandBactiveStatusvaluesstartat0whenthecardis当卡被时,A块和B块的激活状态值均自0开始Read(A=0,B=0,A.status=0)writetoA,setAvalue=(A=0,B=0,A.status=0)A,A=1Read(A=1,B=0)indicatesAlastwritten,sowritetoB,setBvalue=(A1B0)ABB=1Read(A=1,B=1)indicatesBlastwritten,sowritetoA,setAvalue=(A1B1)BAA=0Read(A=0,B=1)indicatesAlastwritten,sowritetoB,setBvalue=(A0B1)ABB=0Read(A=0,B=0,A.status!=0)indicatesBlastwritten,sowritetoA,setA=(A0B0A.status!=0)BAA=1Read(A=1,B=0)(A=1,B=0)等等。Thisfield,plustheMAC,isusedtoverifythataparticulardatablockisthecurrentactiveone.Oncetheactiveblockhasbeendetermined(above),thedevicewillverifytheMACofoneorbothblocks.激活(如上所述),MAC。RefertoSection5fordetailsonhowtheMACisIfblockAwaslastwrittenanditsMACisvalidthenblockAwillbethecurrentactiveblockandblockBwillbewritten.如果A数据块是最后写入的,并且它的动态区MAC是有效的,那么数据块A将是当前的激活块,B数据块将被改写。IfblockAwaslastwrittenanditsMACisinvalidthenblockBMACwillbecheckedandifitisvalidthenblockBwillbethecurrentactiveblockandblockAwillbe如果A数据块是最后写入的,并且它的动态区MAC是无效的,那么数据块B的动态区MAC将被检查,如果有效,那么数据块B将是当前的激活块,数据块A将被IfblockBwaslastwrittenanditsMACisvalidthenblockBwillbethecurrentactiveblockandblockAwillbewritten.如果B数据块是最后写入的,并且它的动态区MAC是有效的,那么数据块B将是A将被改写。IfblockBwaslastwrittenanditsMACisinvalidthenblockAMACwillbecheckedandifitisvalidthenblockAwillbethecurrentactiveblockandblockBwillbe如果数据块B是最后写入的,并且它的动态区MAC是无效的,那么数据块A的动态区MAC将被检查,如果有效,那么数据块A将是当前的激活块,数据块B将被IfbothMACsareinvalid,thenthecardiscorruptandcannotbeusedforaFareThefollowingdiagramshowsthelogicalflowfordeterminingwhichdynamicareaistobereadfromandwrittentoforthecurrenttransaction:Figure1DynamicAreaSelectionFlow1动态区选择A=DynamicAreaB=DynamicAreaReadCard(bothAandB)A.activeStatus0B.activeStatus0A.journey.status=0(Productnotyetused)? A=ActiveA=Backup11B.activeStatus0A=ActiveAreaB=Backup1B=ActiveAreaA=BackupActiveandBackupAreaMACofActiveArea MACofBackupAreaCardCorrupt:ReturntoReadfromActiveAreaWritetoBackupReadfromBackupAreaWritetoActiveAreaPeriodProduct定期产ThissectiondescribesthedynamicdatafortheperiodPeriodProductDynamicData定期产动态数Table7:PeriodProduct–Dynamic7:定期产品–动态数ThedateandtimefromwhichtheproductisSpecifiedasthenumberofminutessincecardBaseDateTime(witharangeofapproximay8cardBaseDateTime起的分钟数来表示(范围大约8年)Iftheproducthasnotyetbeenactivated,thisfieldspecifiestheshelflifeoftheproduct(i.e.thelastdate/timethattheproductmaybeactivated).Whentheproductisactivated,deviceswillcalculatevalidityEndDateTimebasedonvalidityDurationType,validityDurationandvalidityStartDateTime.validityDurationType、SpecifiesthevalidoriginlocationfortheTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation0xFFFSpecifiesthevaliddestinationlocationfortheTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation0xFFF1Ifsetto1,theproductisalreadyIfsetto0,theproductwillbeactivatedwhenitisfirstusedforfarepayment.Whenactivatingtheproduct,validityStartDateTimewillbesettothecurrentdate/time,andthisfieldwillbesetto1.forfutureuse.Total:MultirideProduct计次产ThissectiondescribesthedynamicdataforthemultirideMultirideProductDynamicData计次产动态数Table8:MultirideProduct–Dynamic8:计次产品–动态数ThedateandtimefromwhichtheproductisSpecifiedasthenumberofminutessincecardBaseDateTime(witharangeofapproximay88年Iftheproducthasnotyetbeenactivated,thisfieldspecifiestheshelflifeoftheproduct(i.e.thelastdate/timethattheproductmaybeactivated).Whentheproductisactivated,deviceswillcalculatevalidityEndDateTimebasedonvalidityDurationType,validityDurationandvalidityStartDateTime.validityDurationvalidityStartDateTime计算8ThenumberofridesremaininginthemultirideRange0..255SpecifiesthevalidoriginlocationfortheTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation0xFFFSpecifiesthevaliddestinationlocationfortheTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation0xFFF1Ifsetto1,theproductisalreadyIfsetto0,theproductwillbeactivatedwhenitisfirstusedforfarepayment.Whenactivatingtheproduct,validityStartDateTimewillbesettothecurrentdate/time,andthisfieldwillbesetto1.1Specifiesthetotalnumberofridesfromthemultirideproductdeductedforthecurrentjourney.Range0to011forfutureuse.Total:PurseProduct钱包产ThissectiondescribesthedynamicdataforthepursePurseProductDynamicData钱包产动态数Table9:PurseProduct–Dynamic9:钱包产品–动态数Product产ThedatefromwhichthePurseproductisSpecifiedasthenumberofdayssincecardBaseDateTime(witharangeofapproximay11years)产品有效日期。年)Specifiestheremainingvalueinthepurse(i.e.RangeRMB0.00toRMB范围:0.00元至1310.711Ifsetto1,theproductisalreadyactivated.1,产品已Ifsetto0,theproductwillbeactivatedwhenitisfirstusedforfarepayment.值为0,产品将在第一次使用时激活Whenactivatingtheproduct,validityStartDatewillbesettothecurrentdate,andthisfieldwillbesetto1.1Journey旅Specifiesthetotalvaluedeductedfromthepurseforthecurrentjourney.RangeRMB0.00toRMB范围:RMB0.00元至327.67SpecifiestheoriginlocationforthecurrentTakenfromamaptablethatallowstheentryof4094Setto0xFFFiflocation0xFFF0forfutureuse.Total:CardSerialNumberDefinition卡序列ThePhysicalSerialNumberisstoredinthecardintheserialNumberfieldintheOneTimeProgrble(OTP)Area.Itisa32bitnumberranging0x 0xFFFFFFFFgivingatotalof4,294,967,295uniquenumbers.Thereisnocheckdigitstoredinthe物理序列号存在卡上可编程区(OTP)的serialNumber字段。它是一个32位数,从0x 到0xFFFFFFFF,总数为4,294,967,295。TheLogicalSerialNumberisacombinationofthePhysicalSerialNumber(above)andthelifecycleCountfield.ThePrintedSerialNumberisthenumberprintedbythecardmanufactureronthesurfaceofthecard.Theinformationprintedisasfollows:4digitCityCode–Beijing=1000(AAAA)4位城市代码4digitIndustryCode7513(BBBB)4ACC确定10digitPhysicalSerialNumberasstoredintheserialNumberNNNNNNNNNN)10serialNumber存的一样(NNNNNNNNNN)1digitCheckDigitcalculatedacrosstheCityCodeIndustryCodeandPhysicalSerialNumber.(D)1(D)TheCheckDigitiscalculatedusingtheLuhnformula.PleaserefertotheISO7812校验位使用Luhn计算。请参见ISO7812标准Thenumberwillbeprintedinthefollowingformat:AAAABBBB印刷的数字如下格式:AAAABBBBNNNNNNNNNNDMACCalculationMAC计TheStatic(Issuer)areaMACiscalculatedovertheUIDandtheOTPserialNumber静态区(区)MAC在UID和OTP的序列号(serialNumber)字段的基础上进行计算TheDynamicareaMACsaregeneratedfromtheCRCcalculatedovertheUID,CSN,staticdataandthedynamicdata(AorB).动态区MAC根据覆盖UID、CSN、静态区数据和动态区数据(A或B)计算的CRCTheStaticAreaandDynamicAreaMACsuseseparateThereisnodiversificationontheMACs.MAC上不进行分散。The80FCcommand(see[Ref:12])willbeusedtoverifytheStaticMACandgeneratetheDynamicMACinasinglecommandtotheSAM.80FC指令(12MACMAC,这SAM中用一条指令实现的。StaticAreaMACCalculationMAC计NOTE:ThisisonlydonebytheCard注:由卡商完成Calculatethe8inputbytes(M0toM7)fortheStaticAreaMACgenerationfromtheUIDandCSNisasfollows:MACUIDCSN8个输入字节(M0M7),如下所示:M1[0]=UID[0]^UID[6]M1[1]=UID[1]^M1[2]=UID[2]^UID[4]M1[3]=UID[3]M1[4]=M1[5]=M1[6]=M1[7]=DynamicAreaMACCalculation动态MAC计TheDynamicareaMACiscalculatedasInitiallyachecksumiscalculatedusingtheCRC-32algorithmdefinedinsection5.1.3.ThechecksumiscalculatedovertheUID,CSN,staticareaandthedynamicareawhichtheMACisin.ThusifthestaticareaisupdatedbothdynamicareaAandBwillneedtohavetheirMACrecalculated.This,however,onlyoccursduringcardissueorreissue,andnotatagate,soisnotaperformanceissueforgates.首先,先利用5.1.3节中的CRC-32算法计算一个校验和。该校验和将覆盖UID,CSN,静MACAB都必须重新计算他们的MAC。这只会发生在卡或者重新时,不是在闸机商,所以不会对闸机的TheinputstotheMACvalidationfunctionM1[0]=UID[0]^M1[1]=UID[1]^M1[2]=UID[2]^UID[4]M1[3]=UID[3]M1[4]=M1[5]=M1[6]=M1[7]=M1[8]=StaticAreaMAC>>24M1[9]=StaticAreaMAC>>16M1[10]=StaticAreaMAC>>8M1[11]=StaticAreaMACM1[12]=crc>>24M1[13]=crc>>16M1[14]=crc>>8M1[15]=crcM1[16]=M1[12]^M1[13]^M1[14]^TheM1dataispassedtotheSAMaspartofthe80FCcommand(see[Ref:12]).Thisresultsin5SectorIDs(of6byteseach)beinggeneratediftheStaticAreaMACisvalid.M180FC命令的一部分送往SAM(12】)MAC有5ID(6字节)。Usingthese30bytesasastringof240bits(m[0]tom[239])a12bitMACisgeneratedasshownbelow.使用这30个字节作为一个240bit的数组(m[0]到m[239]),一个12bit的MACA[x]andBholds12bit m[11]thatis m[23]thatis m[239]thatisso A[20];thatisBistheresultant12bitFigure2DynamicAreaMACCalculation动态区MAC计CRC-32AlgorithmCRC-32算CRC-32isanalgorithminwhichapolynomialisusedtocalculateaCRCvaluethatcanbeusedtodetecterrorsinan ingbitstream.CRC-32CRC值,使用该值来发现进来的位Theoutputofthealgorithmis32bitsinTheinputtothealgorithm(themessage)isaseriesof8-bitThegeneratorpolynomialusedfortheCRC-32algorithmisasfollows:CRC-32算法使用的生成多项式是:Polynomial=x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x1+x0Polynomial=ThestartvalueisCRC-32ImplementationCRC-32实constU32_tcrc32_tab[]= /*CRCpolynomial0xEDB88320 , ,0xEE0E612C,0x990951BA,0x076DC419,0xE963A535,0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,0x1DB71064,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0xFA0F3D63,0x8D080DF5,0x3B6E20C8,0x4C69105E,0xD56041E4, 0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,0x35B5A8FA,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0xCFBA9599,0xB8BDA50F,0x2802B89E,0x5F058808,0xC60CD9B2,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D,0x76DC4190,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x91646C97,0xE6635C01,0x6B6B51F4,0x1C6C6162,0x856530D8,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,0x65B0D9C6,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0xA4D1C46D,0xD3D6F4FB,0x4369E96A,0x346ED9FC,0xAD678846,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, C,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0xB7BD5C3B,0xC0BA6CAD,0xEDB88320,0x9ABFB3B6,0x03B6E20C,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683,0xE3630B12,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x196C3671,0x6E6B06E7,0xFED41B76,0x89D32BE0,0x10DA7A5A,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5,0xD6D6A3E8,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0x316E8EEF,0x4669BE79,0xCB61B38C,0xBC66831A,0x256FD2A0,0xCC0C7795,0xBB0B4703,0x220216B9, F,0xC5BA3BBE,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9, , ,0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21,0x86D3D2D4,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0x616BFFD3,0x166CCF45,0xA00AE278,0xD70DD2EE,0x4E048354, ,0xD06016F7, D,0x3E6E77DB,0xAED16A4A,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0x54DE5729,0x23D967BF,0xB3667A2E,0xC4614AB8,0x5D681B02,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,******ComputestheCRC32onablockof****void Thestartingaddressoftheblockof**U32_t Thelengthofthememory**U32_t InitalvectorforcalculatedCRC**** ReturnstheCRC****ThisCRCemploysthereverse-polynomialcalculationU32_tCrc32(void*pStart,U32_tlength,U32_t{ U8_t =registerconstU32_t =while(--length){crc32=p_crc32_tab[(*pS++^(U8_t)crc32)&0xFF]^(crc32>>}return}DetailedCardLayout票卡具体结Table10definesthedetailedcardlayout,includingtheoffsetandlengthinbitsofeachdatafield.Table10:DetailedCard表10:票卡具体结字偏移(位长(位加UIDUID0NotNotNotOneTimeProgrble一次可编程NotUserRead/Write用户读写Static静态数2NotNot3Not9NotNot1Not6Not3Not2NotNot1NotNot2Not2Not7Not5Not0Not字偏移(位长(位加NotDynamicDataBlock动态数据1Not2Not8Not1NotNot8NotNot2Not3Not0NotPeriodProductDynamicData(ifcardcontainsthistypeof定期产品动态数据(如果卡包含该类型产品NotNotNot1NotNotMultirideProductDynamicData(ifcardcontainsthistypeof计次产品动态数据(如果卡包含该类型产品Not8NotNotNot1Not1Not1NotPurseProductDynamicData(ifcardcontainsthistypeof钱包产品动态数据(如果卡包含该类型产品NotNot1NotNotNot0Not字偏移(位长(位加MACforDynamicDataBlock动态数据ADynamicDataBlock动态数据1Not2Not8Not1NotNot8NotNot2Not3Not0NotPeriodProductDynamicData(ifcardcontainsthistypeof定期产品动态数据(如果卡包含该类型产品NotNotNot1NotNotMultirideProductDynamicData(ifcardcontainsthistypeof计次产品动态数据(如果卡包含该类型产品Not8NotNotNot1Not1Not1NotPurseProductDynamicData(ifcardcontainsthistypeof钱包产品动态数据(如果卡包含该类型产品NotNot1NotNotNot0Not字偏移(位长(位加MACforDynamicDataBlock动态数据BAppendix PreviousHistoryA文档历修正版修正日描Author作17JanInitialdraft(tableof初稿 Al20JanUpdatedafterinternalShane18FebIncorporatedcarddataLeon25FebElaboratedcarddataLeon25FebVersionedfor版Shane15MarchChangedlastLocation,origin&destinationfieldsto14bitsandadjustedpaddingbitstocompensatelastLocationorigin&destination14位,并Neil27Correctedunspecifiedvaluesfor’lastLocation’nowitis14bits.Neil27VersionedforRelease2oftheACCInterfaceShane12AprilAdded3.6-PurseNeil12April3.6-PurseProduct–UpdatedafterRemovedcurrencyanddepositfieldsandaddedorigin,destinationandpaddingfields.Reducedremainingfieldsizes.3.6currency&depositorigin,destination&paddingremaining字段的Neil13April3.6-PurseProduct–Updatedafterfurtherorigin,destinationnolongerneeded,restoredendDateTimeto24bits,remainingValueto17bitsandadjustedpaddingsize.3.6OrigindestinationendDateTime24位,remaining17位,并padding大Neil21April3.3DynamicData-AddedprintedflagandchangedblockingStatusto3bits.Table11–UpdatedforabovechangesandaddedP

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论