Code Sample Aloaha Mifare API
The code sample below connects to the card reader and writes the specified Data to disk. Please take note of the sections [PIN] and [SEC].
dim dummy
dim csp
set csp = createobject("aloahacsp.aloaha_csp")
dummy = ""
'start PIN Section.
dummy = "[PIN]"
'save PINs for 3 certificates in card.
'the PIN section cannot be read from the card!
dummy = dummy + vbCrLf + Replace("a8 c2 5b 48 27 2a 93 a4 2f f3 f3 77 cd 38 a0 5f d5 96 77 a8=123456", " ", "")
dummy = dummy + vbCrLf + Replace("b1 11 e8 98 bc 28 ea 50 22 5d 5a 8d 36 a2 59 81 e4 27 80 7d=123456", " ", "")
dummy = dummy + vbCrLf + Replace("98 28 dc 8c 57 9a b1 9b 24 64 c1 50 4b 0a 9a 12 ff 8a a1 74=123456", " ", "")
'close the PIN section
dummy=dummy + vbCrLf + "[/PIN]"
'start message section.
'dummy = dummy + vbCrLf + "[MSG]"
'dummy = dummy + vbCrLf + "PIN Token of Karl Mustermann"
'dummy = dummy + vbCrLf + "Please do not loose"
'dummy = dummy + vbCrLf + "[/MSG]"
'start secrect section. RFU!
'dummy = dummy + vbCrLf + "[SEC]"
'dummy = dummy + vbCrLf + "bla bla bla"
'dummy = dummy + vbCrLf + "[/SEC]"
'Write public Data
dummy=dummy + vbCrLf + "Hallo Welt"
'convert to HEX
dummy = csp.BSTR2HEX(cstr(dummy))
'Connecto to reader 0
if csp.set_reader(CLng(0)) = True then
'Write Data to Card
If csp.MifareWriteCard(26, cstr(dummy), "") = True Then
'read public data back.
dummy = csp.MifareReadCard(26, "", 1)
dummy = csp.hex2bstr(cstr(dummy))
MsgBox dummy
end if
End If
set csp=nothing
Please ask...
Although we really tried hard, there are always questions left open.
Please send us your question.
We would be glad to answer it.
Home / Knowledge Base / Smart Card API / Mifare / Aloaha Mifare Code Sample