Contactless Mifare API

The Aloaha Smart Card API now also supports contactless Mifare Cards. Suggested cards are the standard Mifare 1k or 4k cards.
A very good contactless Card Reader is the Omikey 5x21.

It is suggested to leave the default Passwords of the cards on FFFFFFFFFFFF or A1A2A3A4A5A6. If other password should be used please open the cardini.ini in Wrocklage and add to the Mifare Section Mifare=PIN.

For example:

[DA BC 12 93]
ATR=3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 02 00 00 00 00 69
MifareName=Mifare Standard 4K
Mifare=AABBCCDDEEFF


The memory management on the card will automatically being done by Aloaha. Additional to the standard Mifare encryption all data will be 3DES encrypted.


Aloaha Mifare API explained

The Mifare API is part of the Aloaha Card API in Object AloahaCSP.Aloaha_csp.
In VBS you would create the object with set CSP=createobject("aloahacsp.aloaha_csp").

Now a connection with the cardreader has to be etablished. Aloaha can support up to 10 Readers with ID 0 to 9.
To etablish the connection just call: csp.set_reader(CLng(1)) for the 2nd connected reader. The return value is bool.

For example: 
dim csp
set csp = createobject("aloahacsp.aloaha_csp")

if csp.set_reader(CLng(0)) = True then
          msgbox "Connected to first reader"
End If 

set csp = nothing


After a connection to the reader has been etablished the following function calls are possible.


MifareClear

This command wipes eveything from the Mifare Card which has ever been written to it with Aloaha. It is called automatically by MifareWriteCard before contents are being written!


MifareWriteCard

This command is used to write the Data to the card. It allocates automatically the required space accross the card and returns bool.

The command syntax is:

retbool=csp.MifareWriteCard(KeyNumber As Long, BlockContentHEX As String, KeyHex As String)


MifareReadCard

This command reads the Data from the Mifare Card. Please note that it returns ONLY data which was written by Aloaha. It does also NOT return Data which was marked as secret. The Data is returned as HEX String!

Syntax: 

RetStringHEX=csp.MifareReadCard(KeyNumber As Long, KeyHex As String, KeyType As Long)



Variables:


KeyNumber defines the Card Key to be used. It can be any decimal value between 0 and 31.

BlockContentHEX contains the Content to be written to the card. Please note that is has to be a HEX String!

KeyHex is the PIN to be used. If left empty Aloaha will use the default Keys FFFFFFFFFFFF/A1B2B3B4B5B6 or the value defined in the cardini.ini

KeyType should always be decimal 96.




Aloaha Software / Knowledge Base / Smart Card API / Mifare
create PDF Software

Mifare

Any questions?
Aloaha Software - Mifare
ProductsKnowledge BaseShopSupportPress
Deutsche VersionEnglish version