diff --git a/examples/mifare-ultralight-info.c b/examples/mifare-ultralight-info.c index f27aabc..a191cea 100644 --- a/examples/mifare-ultralight-info.c +++ b/examples/mifare-ultralight-info.c @@ -65,7 +65,19 @@ main (int argc, char *argv[]) char *tag_uid = freefare_get_tag_uid (tags[i]); printf ("Tag with UID %s is a %s\n", tag_uid, freefare_get_tag_friendly_name (tags[i])); - + if (freefare_get_tag_type (tags[i]) == ULTRALIGHT_C) { + MifareTag tag = tags[i]; + int res; + MifareDESFireKey key; + uint8_t key1_3des_data[16] = { 0x49, 0x45, 0x4D, 0x4B, 0x41, 0x45, 0x52, 0x42, 0x21, 0x4E, 0x41, 0x43, 0x55, 0x4F, 0x59, 0x46 }; + key = mifare_desfire_3des_key_new (key1_3des_data); + if (mifare_ultralight_connect (tag) < 0) + errx (EXIT_FAILURE, "Error connecting to tag."); + res = mifare_ultralightc_authenticate (tag, key); + printf ("Authentication with default key: %s\n", res ? "fail" : "success"); + mifare_desfire_key_free (key); + mifare_ultralight_disconnect (tag); + } free (tag_uid); }