use of iso.std.iso_iec._24727.tech.schema.CardApplicationType 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.CardApplicationType in project open-ecard by ecsec.
the class TinySAL method cardApplicationServiceList.
/**
* The CardApplicationServiceList function returns a list of all available services of a card application.
* See BSI-TR-03112-4, version 1.1.2, section 3.3.4.
*
* @param request CardApplicationServiceList
* @return CardApplicationServiceListResponse
*/
@Publish
@Override
public CardApplicationServiceListResponse cardApplicationServiceList(CardApplicationServiceList request) {
CardApplicationServiceListResponse response = WSHelper.makeResponse(CardApplicationServiceListResponse.class, WSHelper.makeResultOK());
try {
ConnectionHandleType connectionHandle = SALUtils.getConnectionHandle(request);
CardStateEntry cardStateEntry = SALUtils.getCardStateEntry(states, connectionHandle);
byte[] cardApplicationID = connectionHandle.getCardApplication();
// Assert.securityConditionApplication(cardStateEntry, cardApplicationID,
// CardApplicationServiceActionName.CARD_APPLICATION_SERVICE_LIST);
CardApplicationServiceNameList cardApplicationServiceNameList = new CardApplicationServiceNameList();
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();
cardApplicationServiceNameList.getCardApplicationServiceName().add(nextt.getCardApplicationServiceName());
}
}
}
response.setCardApplicationServiceNameList(cardApplicationServiceNameList);
} 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.CardApplicationType in project open-ecard by ecsec.
the class AndroidMarshaller method parseCardApplication.
private CardApplicationType parseCardApplication(XmlPullParser parser) throws XmlPullParserException, IOException {
CardApplicationType cardApplication = new CardApplicationType();
int eventType;
do {
parser.next();
eventType = parser.getEventType();
if (eventType == XmlPullParser.START_TAG) {
if (parser.getName().equals("ApplicationIdentifier")) {
cardApplication.setApplicationIdentifier(StringUtils.toByteArray(parser.nextText()));
} else if (parser.getName().equals("ApplicationName")) {
cardApplication.setApplicationName(parser.nextText());
} else if (parser.getName().equals("RequirementLevel")) {
cardApplication.setRequirementLevel(BasicRequirementsType.fromValue(parser.nextText()));
} else if (parser.getName().equals("CardApplicationACL")) {
cardApplication.setCardApplicationACL(this.parseACL(parser, "CardApplicationACL"));
} else if (parser.getName().equals("DIDInfo")) {
cardApplication.getDIDInfo().add(this.parseDIDInfo(parser));
} else if (parser.getName().equals("DataSetInfo")) {
cardApplication.getDataSetInfo().add(this.parseDataSetInfo(parser));
} else if (parser.getName().equals("InterfaceProtocol")) {
cardApplication.getInterfaceProtocol().add(parser.nextText());
}
}
} while (!(eventType == XmlPullParser.END_TAG && parser.getName().equals("CardApplication")));
return cardApplication;
}
use of iso.std.iso_iec._24727.tech.schema.CardApplicationType in project open-ecard by ecsec.
the class StatusHandler method getSupportedCards.
@Nonnull
private static List<StatusType.SupportedCards> getSupportedCards(List<String> protocols, List<CardInfoType> cifs) {
List<StatusType.SupportedCards> result = new ArrayList<>();
for (CardInfoType cif : cifs) {
StatusType.SupportedCards supportedCard = new StatusType.SupportedCards();
result.add(supportedCard);
String name = cif.getCardType().getObjectIdentifier();
supportedCard.setCardType(name);
for (CardApplicationType app : cif.getApplicationCapabilities().getCardApplication()) {
for (DIDInfoType did : app.getDIDInfo()) {
String proto = did.getDifferentialIdentity().getDIDProtocol();
// add protocol to list only if it is supported by the application and not yet added
if (protocols.contains(proto) && !supportedCard.getDIDProtocols().contains(proto)) {
supportedCard.getDIDProtocols().add(proto);
}
}
}
}
return result;
}
use of iso.std.iso_iec._24727.tech.schema.CardApplicationType in project open-ecard by ecsec.
the class CardInfoWrapper method filterForProtocol.
private void filterForProtocol() {
List<CardApplicationType> apps = getApplicationCapabilities().getCardApplication();
Iterator<CardApplicationType> it = apps.iterator();
while (it.hasNext()) {
CardApplicationType app = it.next();
List<String> interfaceProtos = app.getInterfaceProtocol();
// remove when there is a protocol list not containing the current protocol
if (!interfaceProtos.isEmpty()) {
if (interfaceProtocol == null) {
String msg = "Interface protocol is not available.";
LOG.error(msg);
throw new IllegalStateException(msg);
}
if (!interfaceProtos.contains(interfaceProtocol)) {
it.remove();
}
}
}
}
Aggregations