use of iso.std.iso_iec._24727.tech.schema.DIDDelete in project open-ecard by ecsec.
the class TinySAL method didDelete.
/**
* The DIDDelete function deletes the DID addressed with DIDName.
* See BSI-TR-03112-4, version 1.1.2, section 3.6.5.
*
* @param request DIDDelete
* @return DIDDeleteResponse
*/
@Override
public DIDDeleteResponse didDelete(DIDDelete request) {
DIDDeleteResponse response = WSHelper.makeResponse(DIDDeleteResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
byte[] cardApplicationID = connectionHandle.getCardApplication();
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle, false);
String didName = request.getDIDName();
Assert.assertIncorrectParameter(didName, "The parameter DIDName is empty.");
DIDStructureType didStructure = cardStateEntry.getDIDStructure(didName, cardApplicationID);
Assert.assertNamedEntityNotFound(didStructure, "The given DIDName cannot be found.");
Assert.securityConditionDID(cardStateEntry, cardApplicationID, didName, DifferentialIdentityServiceActionName.DID_DELETE);
String protocolURI = didStructure.getDIDMarker().getProtocol();
SALProtocol protocol = getProtocol(connectionHandle, null, protocolURI);
if (protocol.hasNextStep(FunctionType.DIDDelete)) {
response = protocol.didDelete(request);
removeFinishedProtocol(connectionHandle, protocolURI, protocol);
} else {
throw new InappropriateProtocolForActionException("DIDDelete", 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.DIDDelete in project open-ecard by ecsec.
the class TinySALTest method testDidDelete.
/**
* Test of didDelete method, of class TinySAL.
*/
@Test(enabled = TESTS_ENABLED)
public void testDidDelete() {
System.out.println("didDelete");
DIDDelete parameters = new DIDDelete();
DIDDeleteResponse result = instance.didDelete(parameters);
assertEquals(ECardConstants.Major.ERROR, result.getResult().getResultMajor());
}
Aggregations