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);
}
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;
}
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;
}
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);
}
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);
}
Aggregations