IDESP eDni
Quisiera saber como obtener el codigo IDESP del eDNI.
Ya he podido extraer los datos públicos (nombre, apellidos , Num.Dni.. ) pero en estos no consta el codigo IDESP.
Me puede decir alguien como obtenerlo..?
Gracias
J.L.
- Conecta o crea cuenta para participar

- 2451 lecturas
Twitter

así
private String getIDESP(){ ResponseAPDU r; CardChannel channel = OpenChannel(); try { r = channel.transmit(new CommandAPDU(new BigInteger("00CA02E109", 16).toByteArray())); } catch (CardException e) { return null; } CloseChannel(channel); return new String( r.getData() ); }No funciona
No me funciona como esta en el código. Puede que falta elegir el contexto (fichero) primero.
Error que tengo es
SCARD_E_NOT_TRANSACTED An attempt was made to end a non-existent transaction. Terminals: [PC/SC terminal ACS ACR 38U-CCID 00 00] Card: PC/SC card in ACS ACR 38U-CCID 00 00, protocol T=0, state OK ATR: 3B 7F 38 00 00 00 6A 44 4E 49 65 10 02 4C 34 01 13 03 90 00 ATR: ATR: 20 bytes ATR HistoricalBytes: 00 6A 44 4E 49 65 10 02 4C 34 01 13 03 90 00 Card: PC/SC card in ACS ACR 38U-CCID 00 00, protocol T=0, state OK ATR: 3B 7F 38 00 00 00 6A 44 4E 49 65 10 02 4C 34 01 13 03 90 00 > 00 CA 02 E1 09 Exception in thread "main" javax.smartcardio.CardException: sun.security.smartcardio.PCSCException: SCARD_E_NOT_TRANSACTED at sun.security.smartcardio.ChannelImpl.doTransmit(ChannelImpl.java:202) at sun.security.smartcardio.ChannelImpl.transmit(ChannelImpl.java:73)No funciona
El comando 00CA02E109 solo funciona con los lectores LCT31 de C3PO.
Tienes que actualizar el firmware...
... para que dichos comandos te funcionen:
http://www.c3po.es/pv_ltc31.html#comandos_dnie
De nada :-)
Gegen die Dummheit kämpfen selbst die Götter vergebens - Schiller
Ese es el que tengo yo
..y la verdad es no tengo mucha idea al respecto. Eso lo saque del articulo (un poco complejo pero muy bueno) http://blog.48bits.com/2010/03/16/analisis-de-la-estructura-interna-del-dni-e/. Siento no poder ayudarte en mucho más
Ejemplo entero y corto
Ejemplo entero y corto que funciona:
import java.util.List;
import javax.smartcardio.Card;
import javax.smartcardio.CardChannel;
import javax.smartcardio.CardException;
import javax.smartcardio.CardTerminal;
import javax.smartcardio.CommandAPDU;
import javax.smartcardio.ResponseAPDU;
import javax.smartcardio.TerminalFactory;
public class main {
public static Card getCard() throws CardException {
TerminalFactory factory = TerminalFactory.getDefault();
List<CardTerminal> terminals = factory.terminals().list();
System.out.println("Terminals: " + terminals);
if (terminals.isEmpty()) {
throw new CardException("No terminals found.");
}
CardTerminal terminal = terminals.get(0);
Card card = terminal.connect("*");
System.out.println("Card: " + card);
return card;
}
public static String getIDESP(CardChannel channel) throws CardException {
ResponseAPDU resp = channel.transmit(new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x06}));
resp = channel.transmit(new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xB0, (byte) 0x00, (byte) 0x00, (byte) 0x09}));
return new String(resp.getData());
}
public static void main(String[] args) throws CardException, Exception {
Card card = getCard();
CardChannel channel = card.getBasicChannel();
String idesp = getIDESP(channel);
System.out.println(idesp);
card.disconnect(true);
}
}
El fichero 0x0006 en realidad más largo que nueve bytes pero solo contiene valor IDESP
Ok.. Funciona
Gracias Dune. Funciona perfectamente con estos comandos..
Por fin , después de tantos meses lo he solucionado...
Un saludos
J.L.