//////////////////////////////////////////////////////////////////// // // Mifare Card Explorer for Mac // // Created by Francesco Germinara // // Freeware (c) 2005-2006 SofTech di F.Germinara - www.germinara.it. // // For information please contact me at info@germinara.it //////////////////////////////////////////////////////////////////// // History: // // Description: // //////////////////////////////////////////////////////////////////// #import //#define NO_ERROR_FILES //#define NO_ULTRA_CARDS #define NO_DESFIRE_CARDS #include "GemTagAPI.h" #include "g2kcapi.h" //This enum must match the NSMutableStringArray saMifareCardType in CFGMifareObj enum MifareCartTypeID { MIFARE_ULTRA_LIGTH, MIFARE_1K, MIFARE_4K, MIFARE_DES_FIRE, MIFARE_ProX, MIFARE_SmartMX, eEND }; typedef struct _tag_card_data { unsigned char HasPart4; //I don't know what this mean I believe that is T=CL Support unsigned short BlocksCount; unsigned char SectorsCount; unsigned char Method; MIF_SINGLE_UID ChipID; }CARD_DATA; #define UNKNOW_METHOD 0x000 #define ULTRA_LIGTH_METHOD 0x001 #define MIFARE_1K_METHOD 0x002 #define MIFARE_4K_METHOD 0x003 #define MIFARE_DES_FIRE_METHOD 0x004 #define T_CL_METHOD 0x005 #define KEY_A 0 #define KEY_B 1 #define WRITE_KEY_A 2 #define WRITE_KEY_B 3 #define ID_CARD_REMOVED 9999 @interface FGMifareCard : NSObject { NSString *strCardType; //Card Type Description NSString *strCardUID; //Card Type UID int nMethodType; //Type of call method supported @public unsigned char KeyA[6]; //Default Key A value unsigned char KeyB[6]; //Default Key B value CARD_DATA cardInfo; //Card Info (UID, Number of block, Number of sector,Has Part4 ??? } - (void) ClearData; //Clear data structure - (void) SetCardType:(NSString *) str; //Set Card Type Description - (NSString*) CardType; //Get the Card Type Description -(void) SetMethodType:(int) meth; //Set type of method call -(int) MethodType; //Get the type of method call -(CARD_DATA *) GetCardInfo; //Get the Card Info structure -(NSString*) Uid; //Return UID as string object -(void) SetUid:(NSString*) CardUID; //Set Uid of the card as string value -(void) SetKeyA:(unsigned char) byte0 b1:(unsigned char) byte1 b2:(unsigned char) byte2 b3:(unsigned char) byte3 b4:(unsigned char) byte4 b5:(unsigned char) byte5; //set KeyA -(void) SetKeyB:(unsigned char) byte0 b1:(unsigned char) byte1 b2:(unsigned char) byte2 b3:(unsigned char) byte3 b4:(unsigned char) byte4 b5:(unsigned char) byte5; //set KeyA -(NSString*) GetKeyA; //Return Key A value as string object -(void) GetKeyA:(unsigned char *) key; //Return Key A value 6 BYTES -(void) GetKeyB:(unsigned char *) key; //Return Key B value 6 BYTES -(NSString*) GetKeyB; //Return Key B value as string object -(void) GetKeyA:(unsigned char *) byte0 b1:(unsigned char *) byte1 b2:(unsigned char *) byte2 b3:(unsigned char *)byte3 b4:(unsigned char *) byte4 b5:(unsigned char *) byte5; //get KeyA -(void) GetKeyB:(unsigned char *) byte0 b1:(unsigned char *) byte1 b2:(unsigned char *) byte2 b3:(unsigned char *)byte3 b4:(unsigned char *) byte4 b5:(unsigned char *) byte5; //get KeyA -(void) SetKeyAasStringValue:(NSString*) byte0 b1:(NSString*) byte1 b2:(NSString*) byte2 b3:(NSString*) byte3 b4:(NSString*) byte4 b5:(NSString*) byte5; //set KeyA as CString -(void) SetKeyBasStringValue:(NSString*) byte0 b1:(NSString*) byte1 b2:(NSString*) byte2 b3:(NSString*) byte3 b4:(NSString*) byte4 b5:(NSString*) byte5; //set KeyA as CString -(unsigned char) atoh:(NSString*) strValue; //Convert Hex double bytes value as unsigned char value -(void) copyTo:(FGMifareCard*) destination; //Copy data from two object -(BOOL) equalTo:(FGMifareCard*) destination;//TRUE are the same card -(void) SetKeyA:(unsigned char *) key; //Return Key A value 6 BYTES -(void) SetKeyB:(unsigned char *) key; //Return Key B value 6 BYTES -(void) setNewKeyA:(NSString*) aNewKey; //Set new KeyA as NSString of 12 chars (hex values) -(void) setNewKeyB:(NSString*) aNewKey; //Set new KeyA as NSString of 12 chars (hex values) @end