Search in sources :

Example 11 with ListIFDs

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) {
    }
}
Also used : ListIFDs(iso.std.iso_iec._24727.tech.schema.ListIFDs) IFD(org.openecard.ifd.scio.IFD) Connect(iso.std.iso_iec._24727.tech.schema.Connect) EstablishChannelResponse(iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse) WSMarshaller(org.openecard.ws.marshal.WSMarshaller) JAXBException(javax.xml.bind.JAXBException) SAXException(org.xml.sax.SAXException) UnsupportedDataTypeException(javax.activation.UnsupportedDataTypeException) WSMarshallerException(org.openecard.ws.marshal.WSMarshallerException) ClientEnv(org.openecard.common.ClientEnv) MessageDispatcher(org.openecard.transport.dispatcher.MessageDispatcher) SwingDialogWrapper(org.openecard.gui.swing.SwingDialogWrapper) EstablishChannel(iso.std.iso_iec._24727.tech.schema.EstablishChannel) SwingUserConsent(org.openecard.gui.swing.SwingUserConsent) EstablishContext(iso.std.iso_iec._24727.tech.schema.EstablishContext) Test(org.testng.annotations.Test)

Example 12 with ListIFDs

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();
}
Also used : SwingDialogWrapper(org.openecard.gui.swing.SwingDialogWrapper) ListIFDs(iso.std.iso_iec._24727.tech.schema.ListIFDs) InputUnitType(iso.std.iso_iec._24727.tech.schema.InputUnitType) ControlIFD(iso.std.iso_iec._24727.tech.schema.ControlIFD) VerifyUserResponse(iso.std.iso_iec._24727.tech.schema.VerifyUserResponse) Connect(iso.std.iso_iec._24727.tech.schema.Connect) SwingUserConsent(org.openecard.gui.swing.SwingUserConsent) VerifyUser(iso.std.iso_iec._24727.tech.schema.VerifyUser) EstablishContext(iso.std.iso_iec._24727.tech.schema.EstablishContext) PinInputType(iso.std.iso_iec._24727.tech.schema.PinInputType) Test(org.testng.annotations.Test)

Example 13 with ListIFDs

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);
}
Also used : ListIFDs(iso.std.iso_iec._24727.tech.schema.ListIFDs) EstablishContext(iso.std.iso_iec._24727.tech.schema.EstablishContext)

Aggregations

ListIFDs (iso.std.iso_iec._24727.tech.schema.ListIFDs)12 EstablishContext (iso.std.iso_iec._24727.tech.schema.EstablishContext)11 ListIFDsResponse (iso.std.iso_iec._24727.tech.schema.ListIFDsResponse)8 Connect (iso.std.iso_iec._24727.tech.schema.Connect)7 EstablishContextResponse (iso.std.iso_iec._24727.tech.schema.EstablishContextResponse)6 SwingDialogWrapper (org.openecard.gui.swing.SwingDialogWrapper)6 SwingUserConsent (org.openecard.gui.swing.SwingUserConsent)6 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)5 EstablishChannel (iso.std.iso_iec._24727.tech.schema.EstablishChannel)5 EstablishChannelResponse (iso.std.iso_iec._24727.tech.schema.EstablishChannelResponse)5 ClientEnv (org.openecard.common.ClientEnv)5 Test (org.testng.annotations.Test)5 RecognitionInfo (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType.RecognitionInfo)4 CardApplicationConnect (iso.std.iso_iec._24727.tech.schema.CardApplicationConnect)3 CardApplicationConnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationConnectResponse)3 ConnectResponse (iso.std.iso_iec._24727.tech.schema.ConnectResponse)3 ControlIFD (iso.std.iso_iec._24727.tech.schema.ControlIFD)3 BeginTransaction (iso.std.iso_iec._24727.tech.schema.BeginTransaction)2 BeginTransactionResponse (iso.std.iso_iec._24727.tech.schema.BeginTransactionResponse)2 CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)2