Skip to main content

NFC reader

Project description

pyNFCReader

A little python client to use as a low level contactless smart card reader the Hydra NFC v1 & v2, developed by Benjamin Vernoux:

The communication uses the BBIO reader mode.

Status

  • It works with :

    • ISO 14443 A & ISO 15693 card.
    • ISO 14443 B only for hydra NFC v2
  • The PCD frame size is currently limited to 16 bytes.

Help

Example

The file pynfcreader/examples/reader_hydranfc_iso14443_a.py contains an example. You can customize :

  • the port com and baudrate
  • the debug mode.

It enables :

  • to select a Master Card card
  • to read the first 0x19 response bytes
  • to send the Get Processing Options and get the response

Here's a log (where I've changed the UID and the historical bytes of the card :) )

INFO  ::  Hydra NFC python driver version : 0.0.1 - beta
INFO  ::  	Supported hydra firmware 11.02.2015 - [HydraFW v0.5 Beta]
INFO  ::  	ISO 14443 A only
INFO  ::  	Only one card in the field during a transaction
INFO  ::  
INFO  ::  Connect to HydraNFC
INFO  ::  
INFO  ::  Reset HydraNFC
INFO  ::  
INFO  ::  Configure HydraNFC
INFO  ::  	Configure gpio and spi...
INFO  ::  	Configure spi2...
INFO  ::  
INFO  ::  Set HydraNFC to ISO 14443 A mode
INFO  ::  
INFO  ::  REQA (7 bits):
INFO  ::  		26                                                     &   
INFO  ::  	
INFO  ::  ATQA:
INFO  ::  		04 00                                                  ..   
INFO  ::  	
INFO  ::  Select cascade level 1:
INFO  ::  		93 20                                                  ..   
INFO  ::  	
INFO  ::  Select cascade level 1 response:
INFO  ::  		XX XX XX XX 17                                         .....   
INFO  ::  	
INFO  ::  Select cascade level 1:
INFO  ::  		93 70 XX XX XX XX 17                                   .p.....   
INFO  ::  	
INFO  ::  Select cascade level 1 response:
INFO  ::  		20 FC 70                                               ..p   
INFO  ::  	
INFO  ::  Request for Answer To Select (RATS):
INFO  ::  	PCD selected options:
INFO  ::  		FSDI : 0x0 => max PCD frame size : 16 bytes
INFO  ::  		CID  : 0x0
INFO  ::  RATS
INFO  ::  		E0 00                                                  ..   
INFO  ::  	
INFO  ::  Answer to Select (ATS = RATS response):
INFO  ::  		0A 78 80 82 02 XX XX XX   XX XX 92 43                  .x......   ...C
INFO  ::  	
INFO  ::  	T0 : 0x78
INFO  ::  		FSCI : 0x8 => max card frame size : 256 bytes
INFO  ::  		TA(1) present
INFO  ::  		TB(1) present
INFO  ::  		TC(1) present
INFO  ::  	TA(1) : 0x80
INFO  ::  		Interpretation : TODO...
INFO  ::  	TB(1) : 0x82
INFO  ::  		Interpretation : TODO...
INFO  ::  	TC(1) : 0x02
INFO  ::  		NAD not supported
INFO  ::  		CID supported
INFO  ::  	Historical bytes : XX XX XX XX XX
INFO  ::  	CRC : 92 43
INFO  ::  
INFO  ::  
INFO  ::  
INFO  ::  PPS
INFO  ::  	PCD selected options:
INFO  ::  	CID : 0x0
INFO  ::  	PPS1 not transmitted
INFO  ::  PPS:
INFO  ::  		D0                                                     .   
INFO  ::  	
INFO  ::  PPS response:
INFO  ::  		D0 73 87                                               .s.   
INFO  ::  	
INFO  ::  	PPS accepted
INFO  ::  
INFO  ::  APDU command:
INFO  ::  		00 A4 04 00 07 A0 00 00   00 04 10 10 19               ........   .....
INFO  ::  	
INFO  ::  		TPDU command:
INFO  ::  			0A 00 00 A4 04 00 07 A0   00 00 00 04 10 10 19         ........   .......
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			1A 00 6F 3F 84 07 A0 00   00 00 04 10 10 A5 7A 14      ..o?....   ......z.
INFO  ::  		
INFO  ::  		TPDU command:
INFO  ::  			A3                                                     .   
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			13 34 50 0A 4D 41 53 54   45 52 43 41 52 44 69 1C      .4P.MAST   ERCARDi.
INFO  ::  		
INFO  ::  		TPDU command:
INFO  ::  			A2                                                     .   
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			02 90 00 F1 09                                         .....   
INFO  ::  		
INFO  ::  APDU response:
INFO  ::  		6F 3F 84 07 A0 00 00 00   04 10 10 A5 34 50 0A 4D      o?......   ....4P.M
INFO  ::  		41 53 54 45 52 43 41 52   44 90 00                     ASTERCAR   D..
INFO  ::  	
INFO  ::  APDU command:
INFO  ::  		80 A8 00 00 02 83 00 00                                ........   
INFO  ::  	
INFO  ::  		TPDU command:
INFO  ::  			0B 00 80 A8 00 00 02 83   00 00                        ........   ..
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			1B 00 77 16 82 02 19 80   94 10 08 01 01 00 C6 3D      ..w.....   .......=
INFO  ::  		
INFO  ::  		TPDU command:
INFO  ::  			A2                                                     .   
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			12 10 01 01 01 18 01 02   00 20 01 02 00 90 99 5B      ........   .......[
INFO  ::  		
INFO  ::  		TPDU command:
INFO  ::  			A3                                                     .   
INFO  ::  		
INFO  ::  		TPDU response:
INFO  ::  			03 00 C8 34                                            ...4   
INFO  ::  		
INFO  ::  APDU response:
INFO  ::  		77 16 82 02 19 80 94 10   08 01 01 00 10 01 01 01      w.......   ........
INFO  ::  		18 01 02 00 20 01 02 00   90 00                        ........   ..
INFO  ::  	

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyNFCReader-1.3.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyNFCReader-1.3.0-py3-none-any.whl (38.0 kB view details)

Uploaded Python 3

File details

Details for the file pyNFCReader-1.3.0.tar.gz.

File metadata

  • Download URL: pyNFCReader-1.3.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for pyNFCReader-1.3.0.tar.gz
Algorithm Hash digest
SHA256 d299bcdc8535831bc4186f264df4733e5b302d8a046a1ab6a2d6c6113d48eadb
MD5 bce281ac67de3c987e8224649a987f5d
BLAKE2b-256 2a9af26a61d93595c47337bdb206b0c4effffb0d0a0c02c895f56068e60bec6b

See more details on using hashes here.

File details

Details for the file pyNFCReader-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: pyNFCReader-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 38.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.5

File hashes

Hashes for pyNFCReader-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f74e6871fed035b83cf38311963859a45d85a7b6966adcd49cb8cc64df92d2c
MD5 b3cafbd13874fb11ec3651defb560412
BLAKE2b-256 40cd28af8d1b9a5cb5cc543994610efe0626ec25905d54a3fdb61a7614b7de01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page