use of iso.std.iso_iec._24727.tech.schema.CardApplicationEndSession in project open-ecard by ecsec.
the class TinySAL method cardApplicationEndSession.
/**
* The CardApplicationEndSession function closes the session between the client application and the card application.
* See BSI-TR-03112-4, version 1.1.2, section 3.2.4.
*
* @param request CardApplicationEndSession
* @return CardApplicationEndSessionResponse
*/
@Publish
@Override
public CardApplicationEndSessionResponse cardApplicationEndSession(CardApplicationEndSession request) {
CardApplicationEndSessionResponse response = WSHelper.makeResponse(CardApplicationEndSessionResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle);
byte[] cardApplicationID = connectionHandle.getCardApplication();
String didName = SALUtils.getDIDName(request);
DIDStructureType didStructure = cardStateEntry.getDIDStructure(didName, cardApplicationID);
Assert.assertNamedEntityNotFound(didStructure, "The given DIDName cannot be found.");
Assert.securityConditionApplication(cardStateEntry, cardApplicationID, ConnectionServiceActionName.CARD_APPLICATION_END_SESSION);
String protocolURI = didStructure.getDIDMarker().getProtocol();
SALProtocol protocol = getProtocol(connectionHandle, null, protocolURI);
if (protocol.hasNextStep(FunctionType.CardApplicationEndSession)) {
response = protocol.cardApplicationEndSession(request);
removeFinishedProtocol(connectionHandle, protocolURI, protocol);
} else {
throw new InappropriateProtocolForActionException("CardApplicationEndSession", protocol.toString());
}
} 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.CardApplicationEndSession in project open-ecard by ecsec.
the class TinySALTest method testCardApplicationEndSession.
/**
* Test of cardApplicationEndSession method, of class TinySAL.
*/
@Test(enabled = TESTS_ENABLED)
public void testCardApplicationEndSession() {
System.out.println("cardApplicationEndSession");
CardApplicationEndSession parameters = new CardApplicationEndSession();
CardApplicationEndSessionResponse result = instance.cardApplicationEndSession(parameters);
assertEquals(ECardConstants.Major.ERROR, result.getResult().getResultMajor());
}
Aggregations