use of iso.std.iso_iec._24727.tech.schema.CardApplicationServiceListResponse.CardApplicationServiceNameList in project open-ecard by ecsec.
the class TinySAL method cardApplicationServiceList.
/**
* The CardApplicationServiceList function returns a list of all available services of a card application.
* See BSI-TR-03112-4, version 1.1.2, section 3.3.4.
*
* @param request CardApplicationServiceList
* @return CardApplicationServiceListResponse
*/
@Publish
@Override
public CardApplicationServiceListResponse cardApplicationServiceList(CardApplicationServiceList request) {
CardApplicationServiceListResponse response = WSHelper.makeResponse(CardApplicationServiceListResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle);
byte[] cardApplicationID = connectionHandle.getCardApplication();
// Assert.securityConditionApplication(cardStateEntry, cardApplicationID,
// CardApplicationServiceActionName.CARD_APPLICATION_SERVICE_LIST);
CardApplicationServiceNameList cardApplicationServiceNameList = new CardApplicationServiceNameList();
CardInfoWrapper cardInfoWrapper = cardStateEntry.getInfo();
Iterator<CardApplicationType> it = cardInfoWrapper.getApplicationCapabilities().getCardApplication().iterator();
while (it.hasNext()) {
CardApplicationType next = it.next();
byte[] appName = next.getApplicationIdentifier();
if (Arrays.equals(appName, cardApplicationID)) {
Iterator<CardApplicationServiceType> itt = next.getCardApplicationServiceInfo().iterator();
while (itt.hasNext()) {
CardApplicationServiceType nextt = itt.next();
cardApplicationServiceNameList.getCardApplicationServiceName().add(nextt.getCardApplicationServiceName());
}
}
}
response.setCardApplicationServiceNameList(cardApplicationServiceNameList);
} catch (ECardException e) {
response.setResult(e.getResult());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
throwThreadKillException(e);
response.setResult(WSHelper.makeResult(e));
}
return response;
}
use of iso.std.iso_iec._24727.tech.schema.CardApplicationServiceListResponse.CardApplicationServiceNameList in project open-ecard by ecsec.
the class TinySALTest method testCardApplicationServiceList.
/**
* Test of cardApplicationServiceList method, of class TinySAL.
*/
@Test(enabled = TESTS_ENABLED)
public void testCardApplicationServiceList() {
System.out.println("cardApplicationServiceList");
CardApplicationServiceList parameters = new CardApplicationServiceList();
// get path to esign
CardApplicationPath cardApplicationPath = new CardApplicationPath();
CardApplicationPathType cardApplicationPathType = new CardApplicationPathType();
cardApplicationPathType.setCardApplication(appIdentifier_ESIGN);
cardApplicationPath.setCardAppPathRequest(cardApplicationPathType);
CardApplicationPathResponse cardApplicationPathResponse = instance.cardApplicationPath(cardApplicationPath);
assertTrue(cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult().size() > 0);
assertEquals(cardApplicationPathResponse.getResult().getResultMajor(), ECardConstants.Major.OK);
// connect to esign
CardApplicationConnect cardApplicationConnect = new CardApplicationConnect();
cardApplicationConnect.setCardApplicationPath(cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult().get(0));
CardApplicationConnectResponse result = instance.cardApplicationConnect(cardApplicationConnect);
assertEquals(ECardConstants.Major.OK, result.getResult().getResultMajor());
assertEquals(appIdentifier_ESIGN, result.getConnectionHandle().getCardApplication());
parameters.setConnectionHandle(result.getConnectionHandle());
CardApplicationServiceListResponse resultServiceList = instance.cardApplicationServiceList(parameters);
CardApplicationServiceNameList cardApplicationServiceNameList = resultServiceList.getCardApplicationServiceNameList();
assertEquals(ECardConstants.Major.OK, resultServiceList.getResult().getResultMajor());
assertTrue(cardApplicationServiceNameList.getCardApplicationServiceName().isEmpty());
}
Aggregations