Add (and export) AID administration codes (provided by MAD document - AN10787)

This commit is contained in:
Romuald Conty 2010-07-28 10:15:58 +00:00
parent 985cb0b349
commit a70688222b
2 changed files with 34 additions and 0 deletions

View file

@ -134,6 +134,13 @@ typedef struct mad *Mad;
/* MAD Public read key A */
extern const MifareClassicKey mad_public_key_a;
/* AID - Adminisration codes */
extern const MadAid mad_free_aid;
extern const MadAid mad_defect_aid;
extern const MadAid mad_reserved_aid;
extern const MadAid mad_card_holder_aid;
extern const MadAid mad_not_applicable_aid;
Mad mad_new (const uint8_t version);
Mad mad_read (MifareTag tag);
int mad_write (MifareTag tag, Mad mad, const MifareClassicKey key_b_sector_00, const MifareClassicKey key_b_sector_10);

View file

@ -70,6 +70,33 @@ const MifareClassicKey mad_public_key_a = {
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5
};
/* AID - Administration codes: */
/* if sector is free */
const MadAid mad_free_aid = {
.function_cluster_code = 0x00,
.application_code = 0x00,
};
/* if sector is defect, e.g. access keys are destroyed or unknown */
const MadAid mad_defect_aid = {
.function_cluster_code = 0x00,
.application_code = 0x01,
};
/* if sector is reserved */
const MadAid mad_reserved_aid = {
.function_cluster_code = 0x00,
.application_code = 0x02,
};
/* if sector contains card holder information in ASCII format. */
const MadAid mad_card_holder_aid = {
.function_cluster_code = 0x00,
.application_code = 0x04,
};
/* if sector not applicable (above memory size) */
const MadAid mad_not_applicable_aid = {
.function_cluster_code = 0x00,
.application_code = 0x05,
};
/*
* Allocate an empty new MAD.
*/