All Projects → AndyQ → Nfcpassportreader

AndyQ / Nfcpassportreader

Licence: mit
NFCPassportReader for iOS 13

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Nfcpassportreader

core
UBIC: The crypto currency providing UBI for the masses using the E-Passport
Stars: ✭ 37 (-91.92%)
Mutual labels:  nfc, passport
Mifareonetool
A GUI Mifare Classic tool on Windows(停工/最新版v1.7.0)
Stars: ✭ 404 (-11.79%)
Mutual labels:  nfc
Passport
Laravel Passport provides OAuth2 server support to Laravel.
Stars: ✭ 2,936 (+541.05%)
Mutual labels:  passport
Laravel Api
Laravel API starter Kit will provide you with the tools for making API's that everyone will love
Stars: ✭ 334 (-27.07%)
Mutual labels:  passport
Passport Steam
Steam (OpenID) authentication strategy for Passport and Node.js.
Stars: ✭ 280 (-38.86%)
Mutual labels:  passport
Node Express Passport Mysql
Login Express + Passport + MySQL
Stars: ✭ 349 (-23.8%)
Mutual labels:  passport
react-redux-jwt-authentication-boilerplate
React-Redux JWT Authentication Boilerplate
Stars: ✭ 44 (-90.39%)
Mutual labels:  passport
Nfcgate
An NFC research toolkit application for Android
Stars: ✭ 425 (-7.21%)
Mutual labels:  nfc
Passport
Simple, unobtrusive authentication for Node.js.
Stars: ✭ 19,608 (+4181.22%)
Mutual labels:  passport
Blinkid Ios
Everything you need to add AI-driven ID scanning into your native iOS app.
Stars: ✭ 325 (-29.04%)
Mutual labels:  passport
Tretjapannfcreader
NFC (FeliCa) Reader for iOS 13 Core NFC / 日本の NFC、FeliCa カード向けリーダーライブラリ(iOS 13.0 以降 Core NFC)交通系IC(Suica、PASMO など)、楽天Edy、nanaco、WAON など、運転免許証、マイナンバーカードの読み取り
Stars: ✭ 323 (-29.48%)
Mutual labels:  nfc
Jianshu
仿简书nx+nodejs+nestjs6+express+mongodb+angular8+爬虫
Stars: ✭ 296 (-35.37%)
Mutual labels:  passport
Http Auth
Node.js package for HTTP basic and digest access authentication.
Stars: ✭ 355 (-22.49%)
Mutual labels:  passport
Passport Spotify
Spotify authentication strategy for Passport and Node.js.
Stars: ✭ 266 (-41.92%)
Mutual labels:  passport
Vsmartcard
umbrella project for emulation of smart card readers or smart cards
Stars: ✭ 404 (-11.79%)
Mutual labels:  nfc
Passport Auth0
Auth0 authentication strategy for Passport.js
Stars: ✭ 256 (-44.1%)
Mutual labels:  passport
Nfc Pcsc
Easy reading and writing NFC tags and cards in Node.js
Stars: ✭ 322 (-29.69%)
Mutual labels:  nfc
Core Nestjs
A simple application demonstrating the basic usage of permissions with NestJS (JWT, Passport, Facebook, Google+, User, Group, Permission)
Stars: ✭ 347 (-24.24%)
Mutual labels:  passport
Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (-4.37%)
Mutual labels:  passport
Passportscanner
Scan the MRZ code of a passport and extract the firstname, lastname, passport number, nationality, date of birth, expiration date and personal numer.
Stars: ✭ 417 (-8.95%)
Mutual labels:  passport

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].