M5Unit-NFC 0.1.0 git rev:93745b5
Loading...
Searching...
No Matches
nfcf.cpp File Reference

NFC-F definitions. More...

#include "nfcf.hpp"
#include <M5Utility.hpp>
#include <algorithm>

Namespaces

namespace  m5
 Top level namespace of M5Stack.
 

Functions

uint16_t m5::nfc::f::get_maximum_block (const Type t)
 Gets the maximum block.
 
uint16_t m5::nfc::f::get_number_of_user_blocks (const Type t)
 Gets the number of user blocks.
 
uint16_t m5::nfc::f::get_first_user_block (const Type t)
 Gets the first user area block number.
 
uint16_t m5::nfc::f::get_last_user_block (const Type t)
 Gets the last user area block number.
 
uint8_t m5::nfc::f::get_maximum_read_blocks (const Type t)
 Maximum number of blocks that can be read simultaneously.
 
uint8_t m5::nfc::f::get_maximum_write_blocks (const Type t)
 Maximum number of blocks that can be write simultaneously.
 
bool m5::nfc::f::is_read_only_lite (const block_t block)
 Is read only block (Permissions are not considered)
 
bool m5::nfc::f::is_read_only_lite_s (const block_t block)
 Is read only block (Permissions are not considered)
 
bool m5::nfc::f::can_read_lite (const block_t block)
 Can the value of the specified block be read? (Permissions are not considered)
 
bool m5::nfc::f::can_read_lite_s (const block_t block)
 Can the value of the specified block be read? (Permissions are not considered)
 
bool m5::nfc::f::operator== (const PICC &a, const PICC &b)
 Equal? (Only IDm,PMm)
 
For MAC
bool m5::nfc::f::make_session_key (uint8_t sk[16], const uint8_t ck[16], const uint8_t rc[16])
 Make session key.
 
bool m5::nfc::f::generate_mac (uint8_t mac[8], const uint8_t *plain, uint32_t plain_len, const uint8_t *block_data, uint32_t block_len, const uint8_t sk1[8], const uint8_t sk2[8], const uint8_t rc[16])
 Generate MAC.
 
bool m5::nfc::f::make_personalized_card_key_lite_s (uint8_t card_key[16], const uint8_t master_key[24], const uint8_t id_block[16])
 Generate personalized card key for FeliCa Lite-S.
 

Detailed Description

NFC-F definitions.

Function Documentation

◆ can_read_lite()

bool m5::nfc::f::can_read_lite ( const block_t block)

Can the value of the specified block be read? (Permissions are not considered)

Parameters
blockBlock list element
Returns
True if the FeliCa Lite block can be read

◆ can_read_lite_s()

bool m5::nfc::f::can_read_lite_s ( const block_t block)

Can the value of the specified block be read? (Permissions are not considered)

Parameters
blockBlock list element
Returns
True if the FeliCa Lite-S block can be read

◆ generate_mac()

bool m5::nfc::f::generate_mac ( uint8_t mac[8],
const uint8_t * plain,
uint32_t plain_len,
const uint8_t * block_data,
uint32_t block_len,
const uint8_t sk1[8],
const uint8_t sk2[8],
const uint8_t rc[16] )

Generate MAC.

Parameters
[out]macMAC
plainPlain blocks (If nullptr, do not use)
plain_lenLength of plain (If zero, do not use)
block_dataBlock data
block_lenLength of block_data
sk1Session key 1
sk2Session key 2
rcRandom challenge
Returns
True if successful

◆ get_first_user_block()

uint16_t m5::nfc::f::get_first_user_block ( const Type t)

Gets the first user area block number.

Parameters
tPICC type
Returns
First user block number

◆ get_last_user_block()

uint16_t m5::nfc::f::get_last_user_block ( const Type t)

Gets the last user area block number.

Parameters
tPICC type
Returns
Last user block number

◆ get_maximum_block()

uint16_t m5::nfc::f::get_maximum_block ( const Type t)

Gets the maximum block.

Parameters
tPICC type
Returns
Maximum block number

◆ get_maximum_read_blocks()

uint8_t m5::nfc::f::get_maximum_read_blocks ( const Type t)

Maximum number of blocks that can be read simultaneously.

Parameters
tPICC type
Returns
Maximum readable block count

◆ get_maximum_write_blocks()

uint8_t m5::nfc::f::get_maximum_write_blocks ( const Type t)

Maximum number of blocks that can be write simultaneously.

Parameters
tPICC type
Returns
Maximum writable block count

◆ get_number_of_user_blocks()

uint16_t m5::nfc::f::get_number_of_user_blocks ( const Type t)

Gets the number of user blocks.

Parameters
tPICC type
Returns
Number of user blocks

◆ is_read_only_lite()

bool m5::nfc::f::is_read_only_lite ( const block_t block)

Is read only block (Permissions are not considered)

Parameters
blockBlock list element
Returns
True if the FeliCa Lite block is read-only

◆ is_read_only_lite_s()

bool m5::nfc::f::is_read_only_lite_s ( const block_t block)

Is read only block (Permissions are not considered)

Parameters
blockBlock list element
Returns
True if the FeliCa Lite-S block is read-only

◆ make_personalized_card_key_lite_s()

bool m5::nfc::f::make_personalized_card_key_lite_s ( uint8_t card_key[16],
const uint8_t master_key[24],
const uint8_t id_block[16] )

Generate personalized card key for FeliCa Lite-S.

Parameters
[out]card_keyPersonalized card key (16 bytes)
master_keyPersonalized master key (24 bytes)
id_blockID block value (16 bytes)
Returns
True if successful

◆ make_session_key()

bool m5::nfc::f::make_session_key ( uint8_t sk[16],
const uint8_t ck[16],
const uint8_t rc[16] )

Make session key.

Parameters
[out]skSession key (sk1 8byte + sk2 8byte)
ckCard key
rcRandom challenge
Returns
True if successful

◆ operator==()

bool m5::nfc::f::operator== ( const PICC & a,
const PICC & b )

Equal? (Only IDm,PMm)

Parameters
aLeft PICC
bRight PICC
Returns
True if IDm and PMm are equal