TinySAL implements SAL { @Publish @Override public ACLListResponse aclList(ACLList request) { ACLListResponse response = WSHelper.makeResponse(ACLListResponse.class, WSHelper.makeResultOK()); try { ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request); CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle, false); TargetNameType targetName = request.getTargetName(); Assert.assertIncorrectParameter(targetName, "The parameter TargetName is empty."); byte[] targetAppId = targetName.getCardApplicationName(); String targetDataSet = targetName.getDataSetName(); String targetDid = targetName.getDIDName(); CardInfoWrapper cardInfoWrapper = cardStateEntry.getInfo(); byte[] handleAppId = connectionHandle.getCardApplication(); if (targetDataSet != null) { DataSetInfoType dataSetInfo = cardInfoWrapper.getDataSet(targetDataSet, handleAppId); Assert.assertNamedEntityNotFound(dataSetInfo, "The given DataSet cannot be found."); response.setTargetACL(cardInfoWrapper.getDataSet(targetDataSet, handleAppId).getDataSetACL()); } else if (targetDid != null) { DIDInfoType didInfo = cardInfoWrapper.getDIDInfo(targetDid, handleAppId); Assert.assertNamedEntityNotFound(didInfo, "The given DIDInfo cannot be found."); response.setTargetACL(cardInfoWrapper.getDIDInfo(targetDid, handleAppId).getDIDACL()); } else if (targetAppId != null) { CardApplicationWrapper cardApplication = cardInfoWrapper.getCardApplication(targetAppId); Assert.assertNamedEntityNotFound(cardApplication, "The given CardApplication cannot be found."); Assert.securityConditionApplication(cardStateEntry, targetAppId, AuthorizationServiceActionName.ACL_LIST); response.setTargetACL(cardInfoWrapper.getCardApplication(targetAppId).getCardApplicationACL()); } else { throw new IncorrectParameterException("The given TargetName is invalid."); } } catch (ECardException e) { response.setResult(e.getResult()); } catch (Exception e) { LOG.error(e.getMessage(), e); throwThreadKillException(e); response.setResult(WSHelper.makeResult(e)); } return response; } TinySAL(Environment env, CardStateMap states); void setAddonManager(AddonManager manager); @Override InitializeResponse initialize(Initialize request); @Override TerminateResponse terminate(Terminate request); @Override CardApplicationPathResponse cardApplicationPath(CardApplicationPath request); @Override CardApplicationConnectResponse cardApplicationConnect(CardApplicationConnect request); @Override CardApplicationSelectResponse cardApplicationSelect(CardApplicationSelect request); @Override CardApplicationDisconnectResponse cardApplicationDisconnect(CardApplicationDisconnect request); @Publish @Override CardApplicationStartSessionResponse cardApplicationStartSession(CardApplicationStartSession request); @Publish @Override CardApplicationEndSessionResponse cardApplicationEndSession(CardApplicationEndSession request); @Publish @Override CardApplicationListResponse cardApplicationList(CardApplicationList request); @Override CardApplicationCreateResponse cardApplicationCreate(CardApplicationCreate request); @Override CardApplicationDeleteResponse cardApplicationDelete(CardApplicationDelete request); @Publish @Override CardApplicationServiceListResponse cardApplicationServiceList(CardApplicationServiceList request); @Override CardApplicationServiceCreateResponse cardApplicationServiceCreate(CardApplicationServiceCreate request); @Override CardApplicationServiceLoadResponse cardApplicationServiceLoad(CardApplicationServiceLoad request); @Override CardApplicationServiceDeleteResponse cardApplicationServiceDelete(CardApplicationServiceDelete request); @Publish @Override CardApplicationServiceDescribeResponse cardApplicationServiceDescribe(CardApplicationServiceDescribe request); @Override ExecuteActionResponse executeAction(ExecuteAction request); @Publish @Override DataSetListResponse dataSetList(DataSetList request); @Override DataSetCreateResponse dataSetCreate(DataSetCreate request); @Publish @Override DataSetSelectResponse dataSetSelect(DataSetSelect request); @Override DataSetDeleteResponse dataSetDelete(DataSetDelete request); @Publish @Override DSIListResponse dsiList(DSIList request); @Override DSICreateResponse dsiCreate(DSICreate request); @Override DSIDeleteResponse dsiDelete(DSIDelete request); @Publish @Override DSIWriteResponse dsiWrite(DSIWrite request); @Publish @Override DSIReadResponse dsiRead(DSIRead request); @Publish @Override EncipherResponse encipher(Encipher request); @Override DecipherResponse decipher(Decipher request); @Publish @Override GetRandomResponse getRandom(GetRandom request); @Publish @Override HashResponse hash(Hash request); @Override SignResponse sign(Sign request); @Override VerifySignatureResponse verifySignature(VerifySignature request); @Override VerifyCertificateResponse verifyCertificate(VerifyCertificate request); @Publish @Override DIDListResponse didList(DIDList request); @Override DIDCreateResponse didCreate(DIDCreate request); @Publish @Override DIDGetResponse didGet(DIDGet request); @Override DIDUpdateResponse didUpdate(DIDUpdate request); @Override DIDDeleteResponse didDelete(DIDDelete request); @Publish @Override DIDAuthenticateResponse didAuthenticate(DIDAuthenticate request); @Publish @Override ACLListResponse aclList(ACLList request); @Override ACLModifyResponse aclModify(ACLModify request); void setGUI(UserConsent uc);  }
@Test(enabled = TESTS_ENABLED) public void testAclList() { System.out.println("aclList"); CardApplicationPath cardApplicationPath = new CardApplicationPath(); CardApplicationPathType cardApplicationPathType = new CardApplicationPathType(); cardApplicationPathType.setCardApplication(appIdentifier_ESIGN); cardApplicationPath.setCardAppPathRequest(cardApplicationPathType); CardApplicationPathResponse cardApplicationPathResponse = instance.cardApplicationPath(cardApplicationPath); CardApplicationConnect cardApplicationConnect = new CardApplicationConnect(); cardApplicationConnect.setCardApplicationPath(cardApplicationPathResponse.getCardAppPathResultSet().getCardApplicationPathResult() .get(0)); CardApplicationConnectResponse result = instance.cardApplicationConnect(cardApplicationConnect); assertEquals(ECardConstants.Major.OK, result.getResult().getResultMajor()); ACLList aclList = new ACLList(); aclList.setConnectionHandle(result.getConnectionHandle()); TargetNameType targetName = new TargetNameType(); targetName.setCardApplicationName(appIdentifier_ESIGN); aclList.setTargetName(targetName); ACLListResponse aclListResponse = instance.aclList(aclList); assertEquals(aclListResponse.getResult().getResultMajor(), ECardConstants.Major.OK); assertTrue(aclListResponse.getTargetACL().getAccessRule().size()>0); aclList = new ACLList(); aclList.setConnectionHandle(null); targetName = new TargetNameType(); targetName.setCardApplicationName(appIdentifier_ESIGN); aclList.setTargetName(targetName); aclListResponse = instance.aclList(aclList); assertEquals(ECardConstants.Major.ERROR, aclListResponse.getResult().getResultMajor()); assertEquals(ECardConstants.Minor.App.INCORRECT_PARM, aclListResponse.getResult().getResultMinor()); aclList = new ACLList(); aclList.setConnectionHandle(null); targetName = new TargetNameType(); aclList.setTargetName(targetName); aclListResponse = instance.aclList(aclList); assertEquals(ECardConstants.Major.ERROR, aclListResponse.getResult().getResultMajor()); assertEquals(ECardConstants.Minor.App.INCORRECT_PARM, aclListResponse.getResult().getResultMinor()); aclList = new ACLList(); aclList.setConnectionHandle(result.getConnectionHandle()); targetName = new TargetNameType(); targetName.setCardApplicationName(new byte[]{0x0, 0x0, 0x0}); aclList.setTargetName(targetName); aclListResponse = instance.aclList(aclList); assertEquals(ECardConstants.Major.ERROR, aclListResponse.getResult().getResultMajor()); assertEquals(ECardConstants.Minor.SAL.NAMED_ENTITY_NOT_FOUND, aclListResponse.getResult().getResultMinor()); aclList = new ACLList(); aclList.setConnectionHandle(result.getConnectionHandle()); aclList.getConnectionHandle().setIFDName("invalid"); targetName = new TargetNameType(); targetName.setCardApplicationName(appIdentifier_ESIGN); aclList.setTargetName(targetName); aclListResponse = instance.aclList(aclList); assertEquals(ECardConstants.Major.ERROR, aclListResponse.getResult().getResultMajor()); assertEquals(ECardConstants.Minor.App.INCORRECT_PARM, aclListResponse.getResult().getResultMinor()); }