Do you understand that
uint8_t message[5]; message[0] = 0x00; message[1] = 0xA4; message[2] = 0x04; message[3] = 0x00; message[4] = 0x08; message[5] = 0x4C656C616E746F73ULL;
will actually result in an array that looks like this:
uint8_t message[] = { 0x00, 0xA4, 0x04, 0x00, 0x08, 0x73 };
This means that the rest of your AID ( 0x4C , 0x65 , 0x6C , 0x61 , 0x6E , 0x74 , 0x6F ) is effectively trimmed and therefore your APDU also has the wrong length field (Lc).
So, you can format SELECT APDU correctly:
uint8_t message[] = { 0x00, 0xA4, 0x04, 0x00, 0x08, 0x4C, 0x65, 0x6C, 0x61, 0x6E, 0x74, 0x6F, 0x73, 0x00 };
In addition, I suggest that you use the AID of the form Fxxxxxxxxx... (that is, the top nibble of the first byte set to 0xF , length from 5 to 16 bytes) indicating the patented unregistered AID, otherwise you may encounter other standard applications. See ISO / IEC 7816-4 for more information on proper AID formatting.
Michael Roland
source share