use of iso.std.iso_iec._24727.tech.schema.ListIFDs in project open-ecard by ecsec.
the class PACETest method executePACE_PIN.
@Test(enabled = false)
public void executePACE_PIN() throws UnsupportedDataTypeException, JAXBException, SAXException, WSMarshallerException {
ClientEnv env = new ClientEnv();
MessageDispatcher dispatcher = new MessageDispatcher(env);
IFD ifd = new IFD();
SwingUserConsent gui = new SwingUserConsent(new SwingDialogWrapper());
ifd.setGUI(gui);
env.setIFD(ifd);
env.setDispatcher(dispatcher);
ifd.addProtocol(ECardConstants.Protocol.PACE, new PACEProtocolFactory());
EstablishContext eCtx = new EstablishContext();
byte[] ctxHandle = ifd.establishContext(eCtx).getContextHandle();
ListIFDs listIFDs = new ListIFDs();
listIFDs.setContextHandle(ctxHandle);
String ifdName = ifd.listIFDs(listIFDs).getIFDName().get(0);
Connect connect = new Connect();
connect.setContextHandle(ctxHandle);
connect.setIFDName(ifdName);
connect.setSlot(BigInteger.ZERO);
byte[] slotHandle = ifd.connect(connect).getSlotHandle();
// PinID: 02 = CAN, 03 = PIN
String xmlCall = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<iso:EstablishChannel xmlns:iso=\"urn:iso:std:iso-iec:24727:tech:schema\">\n" + " <iso:SlotHandle>" + ByteUtils.toHexString(slotHandle) + "</iso:SlotHandle>\n" + " <iso:AuthenticationProtocolData Protocol=\"urn:oid:0.4.0.127.0.7.2.2.4\">\n" + " <iso:PinID>02</iso:PinID>\n" + " <iso:CHAT>7f4c12060904007f0007030102025305300301ffb7</iso:CHAT>\n" + // Remove PIN element to active the GUI
" <iso:PIN>142390</iso:PIN>\n" + // + " <iso:PIN>123456</iso:PIN>\n"
" </iso:AuthenticationProtocolData>\n" + "</iso:EstablishChannel>";
WSMarshaller m = WSMarshallerFactory.createInstance();
EstablishChannel eCh = (EstablishChannel) m.unmarshal(m.str2doc(xmlCall));
EstablishChannelResponse eChR = ifd.establishChannel(eCh);
LOG.info("PACE result: {}", eChR.getResult().getResultMajor());
try {
LOG.info("{}", eChR.getResult().getResultMinor());
LOG.info("{}", eChR.getResult().getResultMessage().getValue());
} catch (Exception ignore) {
}
}
use of iso.std.iso_iec._24727.tech.schema.ListIFDs in project open-ecard by ecsec.
the class PINTest method verifyeGK.
@Test(enabled = false)
public void verifyeGK() {
IFD ifd = new IFD();
ifd.setGUI(new SwingUserConsent(new SwingDialogWrapper()));
EstablishContext eCtx = new EstablishContext();
byte[] ctxHandle = ifd.establishContext(eCtx).getContextHandle();
ListIFDs listIFDs = new ListIFDs();
listIFDs.setContextHandle(ctxHandle);
String ifdName = ifd.listIFDs(listIFDs).getIFDName().get(0);
Connect connect = new Connect();
connect.setContextHandle(ctxHandle);
connect.setIFDName(ifdName);
connect.setSlot(BigInteger.ZERO);
byte[] slotHandle = ifd.connect(connect).getSlotHandle();
VerifyUser verify = new VerifyUser();
verify.setSlotHandle(slotHandle);
InputUnitType inputUnit = new InputUnitType();
verify.setInputUnit(inputUnit);
PinInputType pinInput = new PinInputType();
inputUnit.setPinInput(pinInput);
pinInput.setIndex(BigInteger.ZERO);
pinInput.setPasswordAttributes(create(true, ISO_9564_1, 6, 8, 8));
verify.setTemplate(StringUtils.toByteArray("00 20 00 01", true));
VerifyUserResponse verifyR = ifd.verifyUser(verify);
byte[] responseCode = verifyR.getResponse();
}
use of iso.std.iso_iec._24727.tech.schema.ListIFDs in project open-ecard by ecsec.
the class TerminalTest method init.
public void init() {
ifd = new IFD();
EstablishContext eCtx = new EstablishContext();
ctxHandle = ifd.establishContext(eCtx).getContextHandle();
ListIFDs listIFDs = new ListIFDs();
listIFDs.setContextHandle(ctxHandle);
ifdName = ifd.listIFDs(listIFDs).getIFDName().get(0);
}
Aggregations