NFCPassportReader for iOS 13

Overview

NFCPassportReader

This package handles reading an NFC Enabled passport using iOS 13 CoreNFC APIS

THIS IS AN IN-PROGRESS BRANCH AND NOT EVEN REMOTELY SUPPORTED! IT MAY CRASH OR JUST NOT WORK!

Supported features:

  • Basic Access Control (BAC)
  • Secure Messaging
  • Reads DG1 (MRZ data) and DG2 (Image) in both JPEG and JPEG2000 formats, DG7, DG11, DG12, DG14 and DG15 (also SOD and COM datagroups)
  • Passive Authentication
  • Active Authentication
  • Chip Authentication (ECDH DES and AES keys tested, DH DES AES keys implemented ad should work but currently not tested)
  • PACE - currently only Generic Mapping (GM) supported
  • Ability to dump passport stream and read it back in

This is still very early days - the code is by no means perfect and there are still some rough edges - there ARE most definitely bugs and I'm sure I'm not doing things perfectly.

It reads and verifies my passport (and others I've been able to test) fine, however your mileage may vary.

Installation

Swift Package Manager

NFCPassportReader may be installed via Swift Package Manager, by pointing to this repo's URL.

CocoaPods

Install using CocoaPods by adding this line to your Podfile:

use_frameworks!
pod 'NFCPassportReader', git:'https://github.com/AndyQ/NFCPassportReader.git'  

Then, run the following command:

$ pod install

Note - Current Bitcode is disabled as OpenSSL is not correctly found. Hopefully this will be fixed in a future release.

Usage

To use, you first need to create the Passport MRZ Key which consists of the passport number, date of birth and expiry date (including the checksums). Dates are in YYMMDD format

For example:

<passport number><passport number checksum><date of birth><date of birth checksum><expiry date><expiry date checksum>

e.g. for Passport nr 12345678, Date of birth 27-Jan-1998, Expiry 30-Aug-2025 the MRZ Key would be:

Passport number - 12345678
Passport number checksum - 8
Date Of birth - 980127
Date of birth checksum - 7
Expiry date - 250831
Expiry date checksum - 5

mrzKey = "12345678898012772508315"

Then on an instance of PassportReader, call the readPassport method passing in the mrzKey, the datagroups to read and a completion block.
e.g.

passportReader.readPassport(mrzKey: mrzKey, tags: [.COM, .DG1, .DG2], completed: { (error) in
   ...
}

Currently the datagroups supported are: COM, DG1, DG2, DG7, DG11, DG12, DG14 (partial), DG15, and SOD

This will then handle the reading of the passport, and image and will call the completion block either with an TagError error if there was an error of some kind, or nil if successful.

If successful, the passportReader object will then contain valid data for the passportMRZ and passportImage fields.

In addition, you can customise the messages displayed in the NFC Session Reader by providing a customDisplayMessage callback e.g. to override just the initial request to present passport message:

passportReader.readPassport(mrzKey: mrzKey, tags: [.COM, .DG1, .DG2],
    customDisplayMessage: { (displayMessage) in
        switch displayMessage {
            case .requestPresentPassport:
                return "Hold your iPhone near an NFC enabled passport."
            default: 
                return nil
    }, completed: { (error) in
        ...
}

Logging

Additional logging (very verbose) can be enabled on the PassportReader by passing in a log level on creation: e.g.

let reader = PassportReader(logLevel: .debug)

NOTE - currently this is just printing out to the console - I'd like to implement better logging later - probably using SwiftyBeaver

PassiveAuthentication

Passive Authentication is now part of the main library and can be used to ensure that an E-Passport is valid and hasn't been tampered with.

It requires a set of CSCA certificates in PEM format from a master list (either from a country that publishes their master list, or the ICAO PKD repository). See the scripts folder for details on how to get and create this file.

The masterList.pem file included in the Sample app is purely there to ensure no compiler warnings and contains only a single PEM file that was self-generated and won't be able to verify anything!

Sample app

There is a sample app included in the repo which demonstrates the functionality.

Troubleshooting

  • If when doing the initial Mutual Authenticate challenge, you get an error with and SW1 code 0x63, SW2 code 0x00, reason: No information given, then this is usualy because your MRZ key is incorrect, and possibly because your passport number is not quite right. If your passport number in the MRZ contains a '<' then you need to include this in the MRZKey - the checksum should work out correct too. For more details, check out App-D2 in the ICAO 9303 Part 11 document (https://www.icao.int/publications/Documents/9303_p11_cons_en.pdf)

    e.g. if the bottom line on the MRZ looks like: 12345678<8AUT7005233M2507237<<<<<<<<<<<<<<06

    In this case the passport number is 12345678 but is padded out with an additonal <. This needs to be included in the MRZ key used for BAC. e.g. 12345678<870052332507237 would be the key used.

To do

There are a number of things I'd like to implement in no particular order:

  • Finish off PACE authentication (IM and CAM)

Thanks

I'd like to thank the writers of pypassport (Jean-Francois Houzard and Olivier Roger - can't find their website but referenced from https://github.com/andrew867/epassportviewer) who's work this is based on.

The EPassport section on YobiWiki (http://wiki.yobi.be/wiki/EPassport) This has been an invaluable resource especially around Passive Authentication.

Marcin Krzyżanowski for his OpenSSL-Universal repo.

Comments
  • About NFC Tag Data Validation?

    About NFC Tag Data Validation?

    Hi @AndyQ , Can you please let me know if I need to give some security checks with backend then which data(Something like Json data) need to validate with the DB? I mean like somehow we can validate DG(all Data Groups e.g. DG1, DG2......DG15) or after tag detecting we can store all chip data somewhere and validate it from the database.

    opened by puneetmahali 38
  • PACE is significantly slower than BAC

    PACE is significantly slower than BAC

    I just upgraded from 1.0.10 to 1.1.4 and I noticed that the auth flow is MUCH slower.

    With 1.0.10 I can auth in under ~500ms, while with 1.1.4 it's in the order of 4-6 seconds.

    I have upgraded the library just to provide some fixes the library inserted in the last months, but the UX degradation for our users is kind of a big deal, so this is holding our iOS release.

    Note how PACE is successful, so it's not losing time with an unsuccessful authentication, it's just slower.

    Random idea: If the slowness is "by design" for PACE and we can't do nothing to work around this (I'm just guessing, I did not profiled it), maybe we can provide a setting that when enabled will first attempt BAC and fallback to PACE whenever it fails.

    opened by danydev 22
  • Implementing Chip Authentication

    Implementing Chip Authentication

    Hey, are you thinking of implementing Chip Authentication(CA) besides the Active Authentication(AA)? Even if CA mostly aims to provide the same verification features as AA, CA seems to be more commonly supported in current passports.

    Just for some context, a short summary of CA can be found here.

    enhancement 
    opened by ChristianNorbertBraun 20
  • [German ID] Error reading DG3 tag. Reason: Security status not satisfied.

    [German ID] Error reading DG3 tag. Reason: Security status not satisfied.

    Reading tag - COM
    Reading tag - SOD
    Reading tag - DG1
    

    are successful.

    when reading DG3 tag, getting error:

    Reading tag - DG3
    Mask class byte and pad command header
    	CmdHeader: <value>
    Pad data
    	Data: <value><value>
    Encrypt data with KSenc
    	EncryptedData: <value>
    Build DO'87
    	DO87: <value>
    Concatenate CmdHeader and DO87
    	M: <value>
    		SSC: <value>
    Compute MAC of M
    	Increment SSC with 1
    		SSC: <value>
    	Concatenate SSC and M and add padding
    		N: <value>
    x0: <value>
    y0: <value>
    x1: <value>
    y1: <value>
    x2: <value>
    y2: <value>
    x3: <value>
    y3: <value>
    y: <value>
    bkey: <value>
    akey: <value>
    b: <value>
    a: <value>
    	Compute MAC over N with KSmac
    		CC: <value>
    Build DO'8E
    	DO8E: <value>
    Construct and send protected APDU
    	ProtectedAPDU: <value>
    [SM] <NFCISO7816APDU: 0x283c67570>
    Error reading tag: sw1 - 69, sw2 - 82 - reason: Security status not satisfied
    2019-11-09 19:17:56.458315+0100 NFCPassportReaderApp[669:36407] [CoreNFC] 00000002 81c70900 -[NFCTagReaderSession setAlertMessage:]:92  (null)
    ERROR - Security status not satisfied
    Calculate the SHA-1 hash of MRZ_information
    	Hsha1(MRZ_information): <value>
    Take the most significant 16 bytes to form the Kseed
    	Kseed: <value>
    Calculate the Basic Acces Keys (Kenc and Kmac) using Appendix 5.1
    Compute Encryption key (c: 00000001
    	Concatenate Kseed and c
    		D: <value>
    	Calculate the SHA-1 hash of D
    		Hsha1(D): <value>
    	Form keys Ka and Kb
    		Ka: <value>
    		Kb: <value>
    	Adjust parity bits
    		Ka: <value>
    		Kb: <value>
    Compute MAC Computation key (c: 00000002
    	Concatenate Kseed and c
    		D: <value>
    	Calculate the SHA-1 hash of D
    		Hsha1(D): <value>
    	Form keys Ka and Kb
    		Ka: <value>
    		Kb: <value>
    	Adjust parity bits
    		Ka: <value>
    		Kb: <value>
    DATA - [135, 254, 118, 14, 193, 128, 176, 231]
    Request an 8 byte random number from the MRTD's chip
    	RND.ICC: <value>
    Generate an 8 byte random and a 16 byte random
    	RND.IFD: <value>
    	RND.Kifd: <value>
    Concatenate RND.IFD, RND.ICC and Kifd
    	S: <value>
    Encrypt S with TDES key Kenc as calculated in Appendix 5.2
    	Eifd: <value>
    x0: <value>
    y0: <value>
    x1: <value>
    y1: <value>
    x2: <value>
    y2: <value>
    x3: <value>
    y3: <value>
    x4: <value>
    y4: <value>
    y: <value>
    bkey: <value>
    akey: <value>
    b: <value>
    a: <value>
    Compute MAC over eifd with TDES key Kmac as calculated in-Appendix 5.2
    	Mifd: <value>
    Construct command data for MUTUAL AUTHENTICATE
    	cmd_data: <value>
    Error reading tag: sw1 - 6A, sw2 - 88 - reason: Referenced data not found
    ERROR - The operation couldn’t be completed. (NFCPassportReader.TagError error 0.)
    tagReaderSession:didInvalidateWithError - Error Domain=NFCError Code=200 "Session invalidated by user" UserInfo={NSLocalizedDescription=Session invalidated by user}
    

    <value> replaces real values just to hide them in public.

    Affected version: 1.0.0 ID country: Germany Running on Example app

    Version 0.0.8 reads the same document with the same MRZ Key successfully.

    opened by maxxx777 19
  • SM data objects incorrect / Wrong length

    SM data objects incorrect / Wrong length

    Starting Basic Access Control (BAC)
    BAC Successful
    Reading tag - COM
    got resp - ResponseAPDU(data: [95, 1, 4, 48, 49, 48, 55, 95, 54, 6, 48, 52, 48, 48, 48, 48, 92, 6, 97, 117, 103, 107, 108, 109], sw1: 144, sw2: 0)
    DG Found - ["DG1", "DG2", "DG7", "DG11", "DG12", "DG13"]
    Reading tag - SOD
    Error reading tag: sw1 - 6C, sw2 - 0E - reason: Wrong length Le: SW2 indicates the exact length - (exact length :14)
    ERROR - Wrong length Le: SW2 indicates the exact length - (exact length :14)
    Reading tag - SOD
    Error reading tag: sw1 - 69, sw2 - 88 - reason: SM data objects incorrect
    ERROR - SM data objects incorrect
    

    then

    Starting Basic Access Control (BAC)
    BAC Successful
    Reading tag - SOD
    Error reading tag: sw1 - 6C, sw2 - 0E - reason: Wrong length Le: SW2 indicates the exact length - (exact length :14)
    ERROR - Wrong length Le: SW2 indicates the exact length - (exact length :14)
    Reading tag - SOD
    Error reading tag: sw1 - 69, sw2 - 88 - reason: SM data objects incorrect
    ERROR - SM data objects incorrect
    

    repeats endlessly till the session expired

    Affected version: 1.0.4 Document: ID card from Kazakhstan

    Fix the issue

    adding self.tagReader?.reduceDataReadingAmount() inside the condition

    } else if errMsg == "SM data objects incorrect" {
      // Can't read this element security objects now invalid - and return out so we re-do BAC
      completed(nil)
    }
    

    fixes the issue:

    } else if errMsg == "SM data objects incorrect" {
       // Can't read this element security objects now invalid - and return out so we re-do BAC
       self.tagReader?.reduceDataReadingAmount()
       completed(nil)
    }
    
    opened by maxxx777 17
  • runtime error on iPhone 7 - iOS 14

    runtime error on iPhone 7 - iOS 14

    Hello,

    Example project gets runtime error on iPhone 7 (iOS 14). It works correctly on iPhone 8 Plus (iOS 14) and iPhone 11 (iOS 14) (I tested).

    Error details Starting Basic Access Control (BAC) Error reading tag: sw1 - 0x65, sw2 - 0x81 reason: Memory failure BAC Failed

    I thought my iPhone 7 might have some problem so I downloaded another app on AppStore (ReadID NFC). It worked.

    opened by ssinan 16
  • Guide to running the example

    Guide to running the example

    Hi,

    Could you please provide a guide for building and running the example? I tried using iOS 13, but the example app does not seem to respond the inputs. Did I build it wrong, or am I using the incorrect inputs?

    Thanks!

    Roy

    opened by rooi 15
  • Error performing active authentication

    Error performing active authentication

    When running the example app, I get my data from the passport. However the authentication fails.

    Starting Basic Access Control (BAC)
    Error reading tag: sw1 - 63, sw2 - 00 - reason: No information given
    BAC Failed
    Starting Basic Access Control (BAC)
    BAC Successful
    Reading tag - COM
    DG Found - ["DG1", "DG2", "DG15", "DG3", "DG14"]
    Reading tag - SOD
    Reading tag - DG1
    Reading tag - DG2
    Reading tag - DG15
    Reading tag - DG14
    Performing Active Authentication
    Error reading tag: sw1 - 67, sw2 - 00 - reason: Wrong length
    IN CALLBACK
    error 20 at 0 depth lookup:unable to get local issuer certificate
    

    Quick debug shows that something goes wrong in the send in doInternalAuthentication, maybe the expectedResponseLength should be different?

    This is with a passport from The Netherlands.

    BTW Great project! Since a few days it is possible in the digital ID app of The Netherlands to verify yourself by reading your passport in their app, so I wanted to know how it's done :)

    opened by JanMisker 14
  • "Unknown error - sw1: 0x63, sw2 - 0xCF ", 99, 207

    With version 1.0.11 it works well with pretty much all passports. However, I get the following error message when tried with a Chinese passport: Sorry, there was a problem reading the passport. ("Unknown error - sw1: 0x63, sw2 - 0xCF ", 99, 207)

    IMAGE 2020-07-08 12:53:21

    opened by brqgoo-zz 12
  • Error session.connect( to: NFCTag).

    Error session.connect( to: NFCTag).

    I always have an error when I am trying to connect to tag. I couldn't find any information how to resolve this problem. I tried on Xcode 11 beta 4 and iOS 13 beta 4, Xcode 11 beta 5 and iOS 13 beta 5 Error Domain=NFCError Code=100 "Stack Error" UserInfo={NSLocalizedDescription=Stack Error, NSUnderlyingError=0x2800d7000 {Error Domain=nfcd Code=28 "Tag Not Found" UserInfo={NSLocalizedDescription=Tag Not Found}}}

    opened by SaliienkoAleksandr 12
  • How can I got the DSC?

    How can I got the DSC?

    Hi @AndyQ After matching the all hashes then how can I verify signature of SOD using the DSC? Can you please confirm the DSC available in chip OR compulsory to receive it from Issuing Authority?

    opened by puneetmahali 10
  • Crashed app while reading NFC using this library

    Crashed app while reading NFC using this library

    Hello

    Our app is crashed while reading NFC using this library, 1.1.9 ver. We found out the issue in firebase Crashlytics.

    This is log.

    Crashed: com.apple.corenfc.readersession.delegate
    0  NFCPassportReader              0x575a0 $s17NFCPassportReader15SecureMessagingC9unprotect5rapduAA12ResponseAPDUVAG_tKF + 4420
    1  NFCPassportReader              0x63058 $s17NFCPassportReader03TagB0C4send3cmd9completedySo14NFCISO7816APDUC_yAA08ResponseH0VSg_AA0aB5ErrorOSgtctFy10Foundation4DataV_s5UInt8VASs0J0_pSgtcfU_ + 988
    2  NFCPassportReader              0xe040 $s10Foundation4DataVs5UInt8VAEs5Error_pSgIeggyyg_So6NSDataCA2ESo7NSErrorCSgIeyByyyy_TR + 124
    3  CoreNFC                        0x119e4 __38-[NFCTag _sendAPDU:completionHandler:]_block_invoke + 464
    4  libdispatch.dylib              0x1e68 _dispatch_call_block_and_release + 32
    5  libdispatch.dylib              0x3a2c _dispatch_client_callout + 20
    6  libdispatch.dylib              0xb124 _dispatch_lane_serial_drain + 668
    7  libdispatch.dylib              0xbcb4 _dispatch_lane_invoke + 444
    8  libdispatch.dylib              0x16500 _dispatch_workloop_worker_thread + 648
    9  libsystem_pthread.dylib        0x10bc _pthread_wqthread + 288
    10 libsystem_pthread.dylib        0xe5c start_wqthread + 8
    

    However, we are unable to investigate the issue because we can’t cause the same issue to occur in our environment.

    Is there any way to solve it? Thank you.

    opened by boipqiod 0
  • Reading Turkish eID problem in release version

    Reading Turkish eID problem in release version

    I have a React-Native application and I implemented a 3rd party eID NFC Reader SDK. This 3rd SDK is using NFCPassportReader library and CoreNFC package also. I'm trying to read Turkish Citizenship eID with this module. My problem this module is working properly in debug mode but It's crushing in release version. I've added a crush log related to this issue and I've added tagReaderSession implementation code. I've added my "com.apple.developer.nfc.readersession.iso7816.select-identifiers" configuration code also. Does anybody have an idea about that problem?

    Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
    Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000000
    Exception Codes: 0x0000000000000001, 0x0000000000000000
    VM Region Info: 0 is not in any region.  Bytes before following region: 4340301824
          REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
          UNUSED SPACE AT START
    --->  
          __TEXT                   102b3c000-10603c000 [ 53.0M] r-x/r-x SM=COW  ...ePieMobileDev
    Termination Reason: SIGNAL 11 Segmentation fault: 11
    Terminating Process: exc handler [9236]
    
    Triggered by Thread:  8
    Thread 8 name:   Dispatch queue: com.apple.corenfc.readersession.delegate
    Thread 8 Crashed:
    
    public func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
            Log.debug( "tagReaderSession:didDetect - \(tags[0])" )
            if tags.count > 1 {
                Log.debug( "tagReaderSession:more than 1 tag detected! - \(tags)" )
    
                let errorMessage = NFCViewDisplayMessage.error(.MoreThanOneTagFound)
                self.invalidateSession(errorMessage: errorMessage, error: NFCPassportReaderError.MoreThanOneTagFound)
                return
            }
    
            let tag = tags.first!
            var passportTag: NFCISO7816Tag
            switch tags.first! {
            case let .iso7816(tag):
                passportTag = tag
            default:
                Log.debug( "tagReaderSession:invalid tag detected!!!" )
    
                let errorMessage = NFCViewDisplayMessage.error(NFCPassportReaderError.TagNotValid)
                self.invalidateSession(errorMessage:errorMessage, error: NFCPassportReaderError.TagNotValid)
                return
            }
                    
            // Connect to tag
            Log.debug( "tagReaderSession:connecting to tag - \(tag)" )
            session.connect(to: tag) { [unowned self] (error: Error?) in
                if error != nil {
                    Log.debug( "tagReaderSession:failed to connect to tag - \(error?.localizedDescription ?? "Unknown error")" )
                    let errorMessage = NFCViewDisplayMessage.error(NFCPassportReaderError.ConnectionError)
                    self.invalidateSession(errorMessage: errorMessage, error: NFCPassportReaderError.ConnectionError)
                    return
                }
                
                Log.debug( "tagReaderSession:connected to tag - starting authentication" )
                self.updateReaderSessionMessage( alertMessage: NFCViewDisplayMessage.authenticatingWithPassport(0) )
    
                self.tagReader = TagReader(tag:passportTag)
                
                if let newAmount = self.dataAmountToReadOverride {
                    self.tagReader?.overrideDataAmountToRead(newAmount: newAmount)
                }
                
                self.tagReader!.progress = { [unowned self] (progress) in
                    if let dgId = self.currentlyReadingDataGroup {
                        self.updateReaderSessionMessage( alertMessage: NFCViewDisplayMessage.readingDataGroupProgress(dgId, progress) )
                    } else {
                        self.updateReaderSessionMessage( alertMessage: NFCViewDisplayMessage.authenticatingWithPassport(progress) )
                    }
                }
    
                DispatchQueue.global().async {
                    self.startReading( )
                }
            }
        }
    
    <key>NFCReaderUsageDescription</key>
    <string>Read the NFC chip of ePassports</string>
    <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
    <array>
        <string>A0000002471001</string>
    </array>
    

    Video recording of this issue: https://vimeo.com/784270897

    I can run the application in debug mode without any problems, but when I start reading nfc in release mode, the application crashes.

    opened by aytacyaydem 0
  • Error timeout in Iphone 14 pro - iOS 16.2 and cannot detect in

    Error timeout in Iphone 14 pro - iOS 16.2 and cannot detect in

    Hi, I'm testing on Iphone 14Pro, iOS 16.2, the DataGroup reading is very slow, sometimes it can read it, sometimes it doesn't, most of the time it can't read the data in the chip, there is an error like the log below. Log

    2022-12-22 17:26:40.3050 - Using version 1.1.4.1 2022-12-22 17:26:40.3890 - tagReaderSessionDidBecomeActive 2022-12-22 17:26:40.4640 - tagReaderSession:didDetect - iso7816(<NFCISO7816Tag: 0x2814fedf0>) 2022-12-22 17:26:40.4640 - tagReaderSession:connected to tag - starting authentication 2022-12-22 17:26:40.4960 - Error reading tag: sw1 - 0x69, sw2 - 0x82 2022-12-22 17:26:40.4960 - reason: Security status not satisfied 2022-12-22 17:26:40.4960 - PACE Failed - falling back to BAC 2022-12-22 17:26:40.4960 - Re-selecting eMRTD Application 2022-12-22 17:26:40.5120 - Starting Basic Access Control (BAC) 2022-12-22 17:26:40.5120 - BACHandler - deriving Document Basic Access Keys 2022-12-22 17:26:40.5120 - BACHandler - Getting initial challenge 2022-12-22 17:26:40.5250 - BACHandler - Doing mutual authentication 2022-12-22 17:26:40.5860 - DATA - [219, 144, 82, 25, 164, 157, 141, 187, 240, 190, 32, 102, 223, 23, 82, 187, 207, 86, 19, 71, 209, 216, 113, 233, 240, 130, 148, 253, 222, 166, 108, 132, 122, 249, 234, 124, 33, 242, 171, 43] 2022-12-22 17:26:40.5870 - BACHandler - complete 2022-12-22 17:26:40.5870 - Basic Access Control (BAC) - SUCCESS! 2022-12-22 17:26:40.5870 - Reading tag - COM 2022-12-22 17:26:40.6530 - TagReader - Number of data bytes to read - 24 2022-12-22 17:26:43.1500 - DG Found - ["DG1", "DG2", "DG3", "DG13", "DG15", "DG14"] 2022-12-22 17:26:43.1500 - Reading tag - DG14 2022-12-22 17:26:45.6950 - TagReader - Number of data bytes to read - 382 2022-12-22 17:26:45.8230 - Performing Chip Authentication - number of public keys found - 1 2022-12-22 17:26:46.0970 - Public Key successfully sent to passport! 2022-12-22 17:26:46.0980 - Restarting secure messaging using AES encryption 2022-12-22 17:26:46.0980 - Reading tag - SOD 2022-12-22 17:26:48.6270 - TagReader - Number of data bytes to read - 1765 2022-12-22 17:26:56.0960 - tagReaderSession:failed to connect to tag - Tag response error / no response 2022-12-22 17:26:58.8840 - tagReaderSession:didInvalidateWithError - Session invalidated by user

    Video

    https://user-images.githubusercontent.com/89065538/209114421-9da02671-b768-46ad-b53c-5d4e7356ece6.MP4

    Thanks

    opened by Thanhdv2007 5
  • Access to DataGroup3

    Access to DataGroup3

    I'm trying to access to the DataGroup3 to be able to see the fingerprint data stored there, I get an error of Expected SM data objects mossing (0x105, 0x135) is there any idea of how could I fix this?

    opened by dangary7 3
  • Incorrect parameters P1-P2

    Incorrect parameters P1-P2", 106, 134

    I am trying to scan the French ID card using the NFCPassportReader Demo application. But it was failing with an error "missing the required entitlement". After a bit of research, I found the application identifier for this card is "A0000001510000".

    Now, I can detect the tag, and while selecting the master file I am getting this error "Incorrect parameters P1-P2", 106, 134". But in our android app, we are using JMRTD to read the ID cards and can select the master file and select and read the EF.CardAccess file. I have compared both JMRTD and NFCPassportReader codes, and we have the same APDU commands and flow.

    Please help me with what I am missing and let me know if you need any further information.

    Thank you in advance.

    opened by febinfathah 0
  • CAN support for PACE version 2

    CAN support for PACE version 2

    Summary

    Card Access Number can be used for PACE

    This is heavily inspired by #106, which I tried to rebase onto current main branch, but eventually decided to patch it by hand, because there was conflicts that I couldn't resolve in reasonable time.

    As opposed to #106, there's some changes in error handling, which in our tests can detect if CAN was invalid.

    We've tested the changes successfully with a couple of Finnish passports, on iOS 16.

    Changes

    • Add PACEAccessKey enum, which can either be .mrz or .can
    • Original PassportReader.readPassport() now uses PACEAccessKey when establishing PACE.
    • PassportReader.startReading() doesn't fallback to BAC when PACE fails, if CAN was used.
    • Keep old version of PassportReader.readPassport( mrzKey: ...) as deprecated overload of readPassport( accessKey: ...). Not sure if this makes sense, because of the next bullet point...
    • BREAKING: Replace NFCPassportReaderError.InvalidMRZKey with NFCPassportReaderError.AuthenticationFailed, to indicate that either CAN or MRZ was incorrect.
    • Change error handling in TagReader.send, to handle authentication error when using incorrect CAN

    Caveats

    • As of writing, this is a breaking change, because NFCPassportReaderError.InvalidMRZKey is removed
    • Example apps do not demonstrate CAN functionality, as is done in #106
    • I'm not a PACE expert, nor have previous experience with developing this library, so there might be other things as well that I've overlooked.

    Remarks

    I checked the SPM example, and it's pinned to older version of the library. Perhaps the example should be changed so that it uses local version of NFCPassportReader package, to make it easier to develop the example along with the changes to library?

    opened by visav-tietoevry 1
Owner
Andy Qua
Writer of Cube Runner I. II and TV, Topple Domino plus many more. Hacker in Residence at International Airlines Group.
Andy Qua
A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.

EFQRCode is a lightweight, pure-Swift library for generating stylized QRCode images with watermark or icon, and for recognizing QRCode from images, in

EFPrefix 4.3k Jan 2, 2023
Easily communicate between iOS/OSX devices using BLE

BluetoothKit Easily communicate between iOS devices using BLE. Background Apple mostly did a great job with the CoreBluetooth API, but because it enca

Rasmus Høhndorf Hummelmose 2.1k Dec 29, 2022
iOS & OSX Bluetooth library for RxSwift

RxBluetoothKit is a Bluetooth library that makes interaction with BLE devices much more pleasant. It's backed by RxSwift and CoreBluetooth and it prov

Polidea 1.3k Dec 16, 2022
iOS Bluetooth LE framework

Features A futures interface replacing protocol implementations. Timeout for Peripheral connection, Service scan, Service + Characteristic discovery a

Troy Stribling 696 Dec 25, 2022
You will learn how to scan QR code with iOS framework.

QR Code Scanner You will learn how to scan QR code with in iOS without using any library. It is as simple to scan QR code in iOS. In this example, We

Nitin Aggarwal 11 Dec 8, 2022
Simply the fastest way to transmit data between iOS/tvOS and OSX

DarkLightning DarkLightning is a lightweight Swift library to allow data transmission between iOS/tvOS devices (Lightning port, Dock connector, USB-C)

Jens Meder 318 Nov 29, 2022
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.

Luminous Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8+ Swift 5 Xcode 1

Andrea Mario Lufino 324 Nov 27, 2022
WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.

WatchCon WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS Requirements iOS 9.0+ / watchOS 2.0+ CocoaPods CocoaPods

Abdullah Selek 33 Sep 22, 2022
TapticEngine generates haptic feedback vibrations on iOS device.

TapticEngine Overview TapticEngine generates haptic feedback vibrations on iOS device. This library wrapps on UIImpactFeedbackGenerator, UISelectionFe

WorldDownTown 253 Oct 28, 2022
Just simple template - example how to use haptics in iOS Development

Haptics Just simple template - example how to use haptics in iOS Development imp

Alexander Ryakhin 1 Jan 31, 2022
Grab kbsync dynamically from your jailbroken iOS device.

KbsyncTool Grab kbsync dynamically from your jailbroken iOS device. Usage Test1:~ root# kbsynctool -s 9000 [DEBUG] Did open IPv4 listening socket 3 [D

i_82 13 Oct 31, 2022
Writes twitter and contact (links) to writable nfcs on iPhone 7+ iOS 14+

nfc writer ios app nfc writer app is a hacky fun side project that writes twitter and contact (links) to writable nfcs. runs on iPhone 7+ iOS 14+. joi

Vivian Phung 5 Nov 23, 2022
Android/iOS Apps created to practice with different iOS/Android Tech. These apps were built to have similar feature sets using native Android/iOS.

AgilityFitTodayApp Android/iOS Apps created to practice with different iOS/Android Tech. These apps were built to have similar feature sets using nati

Lauren Yew 1 Feb 25, 2022
Kushal Shingote 1 Feb 2, 2022
Flixster-iOS - Flixster iOS Project for CodePath iOS Course

Flixster-iOS Flixster iOS Project for CodePath iOS Course Flix Flix is an app th

null 0 Feb 3, 2022
Will Powell 1.2k Dec 29, 2022
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.

SwiftEntryKit ?? Donations can be made here. Table of Contents Overview Features Example Project Example Project Installation Presets Playground Requi

Daniel Huri 6.1k Jan 4, 2023
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable

Q: How will my calendar dateCells look with this library? A: However you want them to look. More Images Features Range selection - select dates in a r

PatchTheCode 7.3k Jan 2, 2023
iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

SlideMenuControllerSwift iOS Slide View based on iQON, Feedly, Google+, Ameba iPhone app. Installation CocoaPods pod 'SlideMenuControllerSwift' Carth

Yuji Hato 3.3k Dec 29, 2022
UIStackView replica for iOS 7.x and iOS 8.x

TZStackView A wonderful layout component called the UIStackView was introduced with iOS 9. With this component it is really easy to layout components

Tom van Zummeren 1.2k Oct 10, 2022