use of iso.std.iso_iec._24727.tech.schema.CardApplicationServiceDescribe in project open-ecard by ecsec.
the class TinySAL method cardApplicationServiceDescribe.
/**
* The CardApplicationServiceDescribe function can be used to request an URI, an URL or a detailed description
* of the selected card application service.
* See BSI-TR-03112-4, version 1.1.2, section 3.3.8.
*
* @param request CardApplicationServiceDescribe
* @return CardApplicationServiceDescribeResponse
*/
@Publish
@Override
public CardApplicationServiceDescribeResponse cardApplicationServiceDescribe(CardApplicationServiceDescribe request) {
CardApplicationServiceDescribeResponse response = WSHelper.makeResponse(CardApplicationServiceDescribeResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle);
byte[] cardApplicationID = connectionHandle.getCardApplication();
String cardApplicationServiceName = request.getCardApplicationServiceName();
Assert.assertIncorrectParameter(cardApplicationServiceName, "The parameter CardApplicationServiceName is empty.");
// Assert.securityConditionApplication(cardStateEntry, cardApplicationID,
// CardApplicationServiceActionName.CARD_APPLICATION_SERVICE_DESCRIBE);
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();
if (nextt.getCardApplicationServiceName().equals(cardApplicationServiceName)) {
response.setServiceDescription(nextt.getCardApplicationServiceDescription());
return response;
}
}
}
}
} 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.CardApplicationServiceDescribe in project open-ecard by ecsec.
the class TinySALTest method testCardApplicationServiceDescribe.
/**
* Test of cardApplicationServiceDescribe method, of class TinySAL.
*/
@Test(enabled = TESTS_ENABLED)
public void testCardApplicationServiceDescribe() {
System.out.println("cardApplicationServiceDescribe");
CardApplicationServiceDescribe parameters = new CardApplicationServiceDescribe();
// 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());
parameters.setCardApplicationServiceName("testService");
CardApplicationServiceDescribeResponse resultServiceDescribe = instance.cardApplicationServiceDescribe(parameters);
assertEquals(ECardConstants.Major.OK, resultServiceDescribe.getResult().getResultMajor());
}
Aggregations