Search in sources :

Example 1 with PinCompareDIDUpdateDataType

use of iso.std.iso_iec._24727.tech.schema.PinCompareDIDUpdateDataType in project open-ecard by ecsec.

the class ChangePinInSALAction method execute.

@Override
public void execute() {
    List<ConnectionHandleType> connectedCards = null;
    try {
        connectedCards = connectCards();
        if (connectedCards.isEmpty()) {
        // TODO: show no card inserted dialog
        }
        for (ConnectionHandleType nextCard : connectedCards) {
            // pick first card, find pin DID and call didupdate
            String didName = null;
            try {
                didName = getPinDid(nextCard);
            } catch (WSException ex) {
                LOG.info("Skipping card, because it has no PIN DID.");
                continue;
            }
            DIDUpdate updateReq = new DIDUpdate();
            updateReq.setConnectionHandle(nextCard);
            updateReq.setDIDName(didName);
            DIDUpdateDataType updateData = new PinCompareDIDUpdateDataType();
            updateData.setProtocol("urn:oid:1.3.162.15480.3.0.9");
            updateReq.setDIDUpdateData(updateData);
            dispatcher.safeDeliver(updateReq);
        }
    } catch (WSException ex) {
    } finally {
        if (connectedCards != null) {
            for (ConnectionHandleType nextHandle : connectedCards) {
                CardApplicationDisconnect dr = new CardApplicationDisconnect();
                dr.setConnectionHandle(nextHandle);
                dr.setAction(ActionType.RESET);
                dispatcher.safeDeliver(dr);
            }
        }
    }
}
Also used : ConnectionHandleType(iso.std.iso_iec._24727.tech.schema.ConnectionHandleType) CardApplicationDisconnect(iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect) DIDUpdate(iso.std.iso_iec._24727.tech.schema.DIDUpdate) WSException(org.openecard.common.WSHelper.WSException) PinCompareDIDUpdateDataType(iso.std.iso_iec._24727.tech.schema.PinCompareDIDUpdateDataType) PinCompareDIDUpdateDataType(iso.std.iso_iec._24727.tech.schema.PinCompareDIDUpdateDataType) DIDUpdateDataType(iso.std.iso_iec._24727.tech.schema.DIDUpdateDataType)

Aggregations

CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)1 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)1 DIDUpdate (iso.std.iso_iec._24727.tech.schema.DIDUpdate)1 DIDUpdateDataType (iso.std.iso_iec._24727.tech.schema.DIDUpdateDataType)1 PinCompareDIDUpdateDataType (iso.std.iso_iec._24727.tech.schema.PinCompareDIDUpdateDataType)1 WSException (org.openecard.common.WSHelper.WSException)1