use of iso.std.iso_iec._24727.tech.schema.ChannelHandleType in project open-ecard by ecsec.
the class HandlePrinter method printHandle.
public static void printHandle(Writer w, ConnectionHandleType handle) throws IOException {
ChannelHandleType channel = handle.getChannelHandle();
String session = null;
if (channel != null) {
session = channel.getSessionIdentifier();
}
byte[] ctx = handle.getContextHandle();
String ifdname = handle.getIFDName();
BigInteger slotIdx = handle.getSlotIndex();
byte[] slotHandle = handle.getSlotHandle();
ConnectionHandleType.RecognitionInfo rec = handle.getRecognitionInfo();
String cardType = null;
if (rec != null) {
cardType = rec.getCardType();
}
w.write("ConnectionHandle:");
if (session != null) {
w.write("\n Session: ");
w.write(session);
}
if (ctx != null) {
w.write("\n ContextHandle: ");
w.write(ByteUtils.toHexString(ctx));
}
if (ifdname != null) {
w.write("\n IFDName: ");
w.write(ifdname);
if (slotIdx != null) {
w.write(" SlotIndex: ");
w.write(slotIdx.toString());
}
}
if (slotHandle != null) {
w.write("\n SlotHandle: ");
w.write(ByteUtils.toHexString(slotHandle));
}
if (cardType != null) {
w.write("\n CardType: ");
w.write(cardType);
}
}
use of iso.std.iso_iec._24727.tech.schema.ChannelHandleType in project open-ecard by ecsec.
the class AndroidMarshallerTest method testConversionOfStartPAOS.
@Test
public void testConversionOfStartPAOS() throws Exception {
WSMarshaller m = new AndroidMarshaller();
StartPAOS startP = new StartPAOS();
startP.setSessionIdentifier("5ec5ebb1dd254f392e6ca33cf5bf");
ConnectionHandleType connectionHandleType = new ConnectionHandleType();
connectionHandleType.setContextHandle(new BigInteger("94D7439CE657561E7AE3D491FD71AC21F8BCBB5608BA61F5A0EA52269BC01250", 16).toByteArray());
connectionHandleType.setSlotHandle(new BigInteger("EEB49368C1152BEC379DA59356D59039CA7757AC3EAF9430285F2CBB3DD6EDDD", 16).toByteArray());
connectionHandleType.setIFDName("Name of IFD");
connectionHandleType.setSlotIndex(new BigInteger("0"));
connectionHandleType.setCardApplication(new byte[] { 0x0, 0x0, 0x0 });
ChannelHandleType channelHandle = new ChannelHandleType();
channelHandle.setSessionIdentifier("sessionID");
connectionHandleType.setChannelHandle(channelHandle);
RecognitionInfo recognitionInfo = new RecognitionInfo();
recognitionInfo.setCardType("nPA_1-0-0.xml");
connectionHandleType.setRecognitionInfo(recognitionInfo);
startP.getConnectionHandle().add(connectionHandleType);
Document d = m.marshal(startP);
assertEquals(m.doc2str(d), START_PAOS);
}
use of iso.std.iso_iec._24727.tech.schema.ChannelHandleType in project open-ecard by ecsec.
the class AndroidMarshaller method marshalCardApplicationPathResult.
private Element marshalCardApplicationPathResult(CardApplicationPathType type, Document document, String name) {
Element em = createElementIso(document, name);
// ChannelHandle
ChannelHandleType h = type.getChannelHandle();
Element emChild = createElementIso(document, "ChannelHandle");
Element emChildOfCH;
if (h.getProtocolTerminationPoint() != null) {
emChildOfCH = createElementIso(document, "ProtocolTerminationPoint");
emChildOfCH.appendChild(document.createTextNode(h.getProtocolTerminationPoint()));
emChild.appendChild(emChildOfCH);
}
if (h.getSessionIdentifier() != null) {
emChildOfCH = createElementIso(document, "SessionIdentifier");
emChildOfCH.appendChild(document.createTextNode(h.getSessionIdentifier()));
emChild.appendChild(emChildOfCH);
}
if (h.getBinding() != null) {
emChildOfCH = createElementIso(document, "Binding");
emChildOfCH.appendChild(document.createTextNode(h.getBinding()));
emChild.appendChild(emChildOfCH);
}
PathSecurityType ps = h.getPathSecurity();
if (ps != null) {
emChildOfCH = createElementIso(document, "PathSecurity");
Element emChildOfPS = createElementIso(document, "Protocol");
emChildOfPS.appendChild(document.createTextNode(ps.getProtocol()));
emChildOfCH.appendChild(emChildOfPS);
// TODO here any type parsen
LOG.error("AnyType of CardApplicationPath: " + ps.getParameters().toString());
emChild.appendChild(emChildOfCH);
em.appendChild(emChild);
}
// context handle
emChild = createElementIso(document, "ContextHandle");
emChild.appendChild(document.createTextNode(ByteUtils.toHexString(type.getContextHandle())));
em.appendChild(emChild);
// IFDName
emChild = createElementIso(document, "IFDName");
emChild.appendChild(document.createTextNode(type.getIFDName()));
em.appendChild(emChild);
// SlotIndex
emChild = createElementIso(document, "SlotIndex");
emChild.appendChild(document.createTextNode(type.getSlotIndex().toString()));
em.appendChild(emChild);
// Card Application
emChild = createElementIso(document, "CardApplication");
emChild.appendChild(document.createTextNode(ByteUtils.toHexString(type.getCardApplication())));
em.appendChild(emChild);
return em;
}
use of iso.std.iso_iec._24727.tech.schema.ChannelHandleType in project open-ecard by ecsec.
the class HandlerBuilder method buildChannelHandle.
/**
* Creates a {@code ChannelHandleType} if the relevant values are set in the instance.
*
* @return A {@code ChannelHandleType} instance, or {@code null} if no values are available.
*/
@Nullable
public ChannelHandleType buildChannelHandle() {
if (protocolEndpoint != null || sessionId != null || binding != null) {
ChannelHandleType chan = new ChannelHandleType();
chan.setProtocolTerminationPoint(protocolEndpoint);
chan.setSessionIdentifier(sessionId);
chan.setBinding(binding);
return chan;
} else {
return null;
}
}
Aggregations