M5Unit-NFC 0.0.3 git rev:59f5362
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

◆ 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_numNumber 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

◆ 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