Search in sources :

Example 6 with ChannelHandleType

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

the class AndroidMarshallerTest method testConversionOfWait.

@Test
public void testConversionOfWait() throws Exception {
    WSMarshaller m = new AndroidMarshaller();
    Wait w = new Wait();
    w.setContextHandle(new byte[] { 0x0, 0x1, 0x2 });
    w.setTimeOut(new BigInteger("123"));
    ChannelHandleType channelHandleType = new ChannelHandleType();
    channelHandleType.setBinding("binding");
    channelHandleType.setProtocolTerminationPoint("protocolterminatiopoint");
    channelHandleType.setSessionIdentifier("sessionidentifier");
    PathSecurityType pathSecurityType = new PathSecurityType();
    pathSecurityType.setParameters("omg");
    pathSecurityType.setProtocol("protocol");
    channelHandleType.setPathSecurity(pathSecurityType);
    w.setCallback(channelHandleType);
    Document d = m.marshal(w);
    String s = m.doc2str(d);
    LOG.debug(s);
}
Also used : PathSecurityType(iso.std.iso_iec._24727.tech.schema.PathSecurityType) WSMarshaller(org.openecard.ws.marshal.WSMarshaller) BigInteger(java.math.BigInteger) ChannelHandleType(iso.std.iso_iec._24727.tech.schema.ChannelHandleType) Wait(iso.std.iso_iec._24727.tech.schema.Wait) Document(org.w3c.dom.Document) Test(org.testng.annotations.Test)

Example 7 with ChannelHandleType

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

the class HandlerUtils method copyChannel.

private static ChannelHandleType copyChannel(ChannelHandleType handle) {
    if (handle == null) {
        return null;
    }
    ChannelHandleType result = new ChannelHandleType();
    result.setBinding(handle.getBinding());
    result.setPathSecurity(copyPathSec(handle.getPathSecurity()));
    result.setProtocolTerminationPoint(handle.getProtocolTerminationPoint());
    result.setSessionIdentifier(handle.getSessionIdentifier());
    return result;
}
Also used : ChannelHandleType(iso.std.iso_iec._24727.tech.schema.ChannelHandleType)

Example 8 with ChannelHandleType

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

the class CardStateMap method getMatchingEntries.

private synchronized Set<CardStateEntry> getMatchingEntries(CardApplicationPathType cHandle, byte[] slotHandle, RecognitionInfo recInfo, boolean filterAppId) {
    // extract values from map
    ChannelHandleType channel = cHandle.getChannelHandle();
    String session = (channel != null) ? channel.getSessionIdentifier() : null;
    byte[] ctx = cHandle.getContextHandle();
    String ifdname = cHandle.getIFDName();
    BigInteger slotIdx = cHandle.getSlotIndex();
    byte[] cardApplication = cHandle.getCardApplication();
    // when nothing has been specified, return all elements
    Set<CardStateEntry> mergedSets;
    if (session == null && ctx == null && slotHandle == null) {
        mergedSets = new TreeSet<>(allEntries);
    } else {
        // fetch applicable lists from maps
        Set<CardStateEntry> sessionEntries = setFromMap(sessionMap, session);
        Set<CardStateEntry> ctxEntries = setFromMap(contextMap, ctx);
        Set<CardStateEntry> slothandleEntries = setFromMap(slothandleMap, slotHandle);
        // merge entries
        ArrayList<Set<CardStateEntry>> setsToMerge = new ArrayList<>(3);
        if (session != null) {
            setsToMerge.add(sessionEntries);
        }
        if (ctx != null) {
            setsToMerge.add(ctxEntries);
        }
        if (slotHandle != null) {
            setsToMerge.add(slothandleEntries);
        }
        mergedSets = mergeSets(setsToMerge);
    }
    // filter maps for slotIndex if any is given
    if (slotIdx != null) {
        filterIdx(mergedSets, slotIdx);
    }
    if (ifdname != null) {
        filterIfdname(mergedSets, ifdname);
    }
    if (filterAppId && cardApplication != null) {
        filterCardApplication(mergedSets, cardApplication);
    } else {
    // [TR-03112-4] If no card application is specified, paths to all
    // available cards (alpha-card applications) and unused card
    // terminal slots are returned.
    }
    if (recInfo != null && recInfo.getCardType() != null) {
        filterCardType(mergedSets, recInfo.getCardType());
    }
    return mergedSets;
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) ChannelHandleType(iso.std.iso_iec._24727.tech.schema.ChannelHandleType)

Example 9 with ChannelHandleType

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

the class CardStateMap method addEntry.

public synchronized void addEntry(CardStateEntry entry) {
    ConnectionHandleType handle = entry.handleCopy();
    ChannelHandleType channel = handle.getChannelHandle();
    if (channel != null) {
        addMapEntry(channel.getSessionIdentifier(), sessionMap, entry);
    }
    addMapEntry(handle.getContextHandle(), contextMap, entry);
    addMapEntry(handle.getSlotHandle(), slothandleMap, entry);
    allEntries.add(entry);
}
Also used : ConnectionHandleType(iso.std.iso_iec._24727.tech.schema.ConnectionHandleType) ChannelHandleType(iso.std.iso_iec._24727.tech.schema.ChannelHandleType)

Example 10 with ChannelHandleType

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

the class CardStateMap method removeEntry.

/**
 * Remove all references to this CardStateEntry.
 * @param entry Entry to delete.
 * @param removeSlotHandles When set remove all occurrences of this entry in the slotHandle index.
 */
private synchronized void removeEntry(CardStateEntry entry, boolean removeSlotHandles) {
    ConnectionHandleType handle = entry.handleCopy();
    ChannelHandleType channel = handle.getChannelHandle();
    if (channel != null) {
        removeMapEntry(channel.getSessionIdentifier(), sessionMap, entry);
    }
    removeMapEntry(handle.getContextHandle(), contextMap, entry);
    // remove all or just the one a key is given for
    if (removeSlotHandles) {
        Iterator<byte[]> it = slothandleMap.keySet().iterator();
        while (it.hasNext()) {
            byte[] key = it.next();
            removeMapEntry(key, slothandleMap, entry);
        }
    } else {
        removeMapEntry(handle.getSlotHandle(), slothandleMap, entry);
    }
    allEntries.remove(entry);
}
Also used : ConnectionHandleType(iso.std.iso_iec._24727.tech.schema.ConnectionHandleType) ChannelHandleType(iso.std.iso_iec._24727.tech.schema.ChannelHandleType)

Aggregations

ChannelHandleType (iso.std.iso_iec._24727.tech.schema.ChannelHandleType)12 BigInteger (java.math.BigInteger)8 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)6 PathSecurityType (iso.std.iso_iec._24727.tech.schema.PathSecurityType)4 CardApplicationPathType (iso.std.iso_iec._24727.tech.schema.CardApplicationPathType)3 BeginTransaction (iso.std.iso_iec._24727.tech.schema.BeginTransaction)2 BeginTransactionResponse (iso.std.iso_iec._24727.tech.schema.BeginTransactionResponse)2 CardApplicationConnect (iso.std.iso_iec._24727.tech.schema.CardApplicationConnect)2 CardApplicationConnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationConnectResponse)2 CardApplicationDisconnect (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnect)2 CardApplicationDisconnectResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationDisconnectResponse)2 CardApplicationPath (iso.std.iso_iec._24727.tech.schema.CardApplicationPath)2 CardApplicationPathResponse (iso.std.iso_iec._24727.tech.schema.CardApplicationPathResponse)2 Connect (iso.std.iso_iec._24727.tech.schema.Connect)2 ConnectResponse (iso.std.iso_iec._24727.tech.schema.ConnectResponse)2 SlotInfo (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType.SlotInfo)2 DIDAuthenticate (iso.std.iso_iec._24727.tech.schema.DIDAuthenticate)2 DIDAuthenticateResponse (iso.std.iso_iec._24727.tech.schema.DIDAuthenticateResponse)2 DestroyChannel (iso.std.iso_iec._24727.tech.schema.DestroyChannel)2 DestroyChannelResponse (iso.std.iso_iec._24727.tech.schema.DestroyChannelResponse)2