Ciao Antonio, navigando il file system della smart card ottengo i dati riportati sopra... in questa maniera:
Dim apdu(261) As Byte
Dim recvbuf(258) As Byte
Dim recvlen As Integer
Dim iosendreq As SCARD_IO_REQUEST
Dim iorecvreq As SCARD_IO_REQUEST
' STRINGA APDU
apdu(0) = &H0 'CLA
apdu(1) = &HCA 'INS
apdu(2) = &H0 'P1
apdu(3) = &H81 'P2
apdu(4) = &H0 'LC
apdu(5) = &H0 'LE
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 6, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then MsgBox ("Errore nella trasmissione: " & CStr(retval))
'---------------------
' LIVELLO MF
'---------------------
apdu(0) = &H0 'CLA
apdu(1) = &HA4 'INS
apdu(2) = &H0 'P1
apdu(3) = &H0 'P2
apdu(4) = &H2 'LC
apdu(5) = &H3F
apdu(6) = &H0
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 7, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then
MsgBox ("Errore n." & CStr(retval))
End If
'---------------------
' LIVELLO DF D000
'---------------------
apdu(0) = &H0 'CLA
apdu(1) = &HA4 'INS
apdu(2) = &H0 'P1
apdu(3) = &H0 'P2
apdu(4) = &H2 'LC
apdu(5) = &HD0
apdu(6) = &H0
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 7, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then
MsgBox ("Errore n." & CStr(retval))
End If
'---------------------
' LIVELLO D100 - DATI PERSONALI CONTENUTI NELLA CARTA
'---------------------
apdu(0) = &H0 'CLA
apdu(1) = &HA4 'INS
apdu(2) = &H0 'P1
apdu(3) = &H0 'P2
apdu(4) = &H2 'LC
apdu(5) = &HD1
apdu(6) = &H0
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 7, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then
MsgBox ("Errore n." & CStr(retval))
End If
'---------------------
' LIVELLO D101 - DATI PERSONALI CONTENUTI NELLA CARTA EF.NKAF
'---------------------
apdu(0) = &H0 'CLA
apdu(1) = &HA4 'INS
apdu(2) = &H0 'P1
apdu(3) = &H0 'P2
apdu(4) = &H2 'LC
apdu(5) = &HD1
apdu(6) = &H1
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 7, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then
MsgBox ("Errore n." & CStr(retval))
End If
' LEGGO I BINARY PROVENIENTI DALLA CARTA
apdu(0) = &H0 'CLA
apdu(1) = &HB0 'INS
apdu(2) = &H0 'P1
apdu(3) = &H0 'P2
apdu(4) = &H96 'LC
recvlen = 257
iosendreq.dwProtocol = activeprotocol
iosendreq.dbPciLength = Len(iosendreq)
iorecvreq.dwProtocol = activeprotocol
iorecvreq.dbPciLength = Len(iosendreq)
retval = SCardTransmit(hCard, iosendreq, apdu(0), 5, iorecvreq, recvbuf(0), recvlen)
If (retval <> 0) Then
MsgBox ("Errore n." & CStr(retval))
End If
risposta = ""
For K = 0 To apdu(4) - 1: risposta = risposta + Chr(recvbuf(K)): Next K
unico problema in questa parte del file system ( non so per quale motivo ) non è presente l'indirizzo di residenza e altri dati tipo medico di famiglia, statura etc etc, a quanto pare questi dati risiedono nal EF.nkaf che ha un FID D101, applicando lo stesso ragionamento per navigare il file system come sopra non ottengo i dati attesi.. e non sono pefettamente sicuro che stia facendo giusto.