use of iso.std.iso_iec._24727.tech.schema.DataSetInfoType in project open-ecard by ecsec.
the class MiddlewareSAL method dataSetSelect.
@Override
public DataSetSelectResponse dataSetSelect(DataSetSelect request) {
DataSetSelectResponse response = WSHelper.makeResponse(DataSetSelectResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle);
byte[] applicationID = connectionHandle.getCardApplication();
String dataSetName = request.getDataSetName();
Assert.assertIncorrectParameter(dataSetName, "The parameter DataSetName is empty.");
CardInfoWrapper cardInfoWrapper = cardStateEntry.getInfo();
DataSetInfoType dataSetInfo = cardInfoWrapper.getDataSet(dataSetName, applicationID);
Assert.assertNamedEntityNotFound(dataSetInfo, "The given DataSet cannot be found.");
Assert.securityConditionDataSet(cardStateEntry, applicationID, dataSetName, NamedDataServiceActionName.DATA_SET_SELECT);
// nothing else to do, DSI Read works for itself
} 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.DataSetInfoType in project open-ecard by ecsec.
the class CIFCreator method addTokenInfo.
public CardInfoType addTokenInfo() throws WSMarshallerException, CryptokiException {
LOG.debug("Adding information to CardInfo file for card type {}.", cif.getCardType().getObjectIdentifier());
PIN_NAME = "USER_PIN";
DIDInfoType pinDid = createPinDID();
List<DIDInfoType> cryptoDids = getSignatureCryptoDIDs();
List<DataSetInfoType> datasets = getCertificateDatasets();
CardApplicationType app = cif.getApplicationCapabilities().getCardApplication().get(0);
app.getDIDInfo().add(pinDid);
app.getDIDInfo().addAll(cryptoDids);
app.getDataSetInfo().addAll(datasets);
return cif;
}
use of iso.std.iso_iec._24727.tech.schema.DataSetInfoType in project open-ecard by ecsec.
the class CIFCreator method getCertificateDatasets.
private List<DataSetInfoType> getCertificateDatasets() throws CryptokiException {
ArrayList<DataSetInfoType> datasets = new ArrayList<>();
List<MwCertificate> mwCerts = session.getCertificates();
for (MwCertificate cert : mwCerts) {
// create DataSetType and set primitive values
DataSetInfoType ds = new DataSetInfoType();
ds.setDataSetName(cert.getLabel());
PathType path = new PathType();
ds.setDataSetPath(path);
// don't care value
path.setEfIdOrPath(new byte[] { (byte) 0xFF });
// create ACLs
AccessControlListType acl = new AccessControlListType();
ds.setDataSetACL(acl);
List<AccessRuleType> rules = acl.getAccessRule();
rules.add(createRuleTrue(AuthorizationServiceActionName.ACL_LIST));
rules.add(createRuleTrue(NamedDataServiceActionName.DSI_READ));
rules.add(createRuleTrue(NamedDataServiceActionName.DSI_LIST));
rules.add(createRuleTrue(NamedDataServiceActionName.DATA_SET_SELECT));
datasets.add(ds);
}
return datasets;
}
use of iso.std.iso_iec._24727.tech.schema.DataSetInfoType in project open-ecard by ecsec.
the class DatasetInfoCrerator method create.
public DataSetInfoType create() {
DataSetInfoType dsit = new DataSetInfoType();
dsit.setDataSetName(datasetName);
dsit.setDataSetACL(acl);
PathType pt = new PathType();
pt.setEfIdOrPath(efIdOrPath);
dsit.setDataSetPath(pt);
return dsit;
}
use of iso.std.iso_iec._24727.tech.schema.DataSetInfoType in project open-ecard by ecsec.
the class TinySAL method aclList.
/**
* The ACLList function returns the access control list for the stated target object (card application, data set, DID).
* See BSI-TR-03112-4, version 1.1.2, section 3.7.1.
*
* @param request ACLList
* @return ACLListResponse
*/
@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.");
// get the target values, according to the schema only one must exist, we pick the first existing ;-)
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.");
// TODO Check security condition ?
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;
}
Aggregations