Search in sources :

Example 1 with CardApplicationType

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;
}
Also used : CardApplicationType(iso.std.iso_iec._24727.tech.schema.CardApplicationType) DIDInfoType(iso.std.iso_iec._24727.tech.schema.DIDInfoType) DataSetInfoType(iso.std.iso_iec._24727.tech.schema.DataSetInfoType)

Example 2 with CardApplicationType

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;
}
Also used : ConnectionHandleType(iso.std.iso_iec._24727.tech.schema.ConnectionHandleType) ECardException(org.openecard.common.ECardException) CardStateEntry(org.openecard.common.sal.state.CardStateEntry) CardApplicationType(iso.std.iso_iec._24727.tech.schema.CardApplicationType) CardApplicationServiceListResponse(iso.std.iso_iec._24727.tech.schema.CardApplicationServiceListResponse) CardApplicationServiceType(iso.std.iso_iec._24727.tech.schema.CardApplicationServiceType) CardInfoWrapper(org.openecard.common.sal.state.cif.CardInfoWrapper) PrerequisitesNotSatisfiedException(org.openecard.common.sal.exception.PrerequisitesNotSatisfiedException) NameExistsException(org.openecard.common.sal.exception.NameExistsException) AddonNotFoundException(org.openecard.addon.AddonNotFoundException) ThreadTerminateException(org.openecard.common.ThreadTerminateException) ECardException(org.openecard.common.ECardException) NamedEntityNotFoundException(org.openecard.common.sal.exception.NamedEntityNotFoundException) UnknownProtocolException(org.openecard.common.sal.exception.UnknownProtocolException) IncorrectParameterException(org.openecard.common.sal.exception.IncorrectParameterException) InappropriateProtocolForActionException(org.openecard.common.sal.exception.InappropriateProtocolForActionException) TLVException(org.openecard.common.tlv.TLVException) SecurityConditionNotSatisfiedException(org.openecard.common.sal.exception.SecurityConditionNotSatisfiedException) UnknownConnectionHandleException(org.openecard.common.sal.exception.UnknownConnectionHandleException) CardApplicationServiceNameList(iso.std.iso_iec._24727.tech.schema.CardApplicationServiceListResponse.CardApplicationServiceNameList) Publish(org.openecard.common.interfaces.Publish)

Example 3 with CardApplicationType

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;
}
Also used : CardApplicationType(iso.std.iso_iec._24727.tech.schema.CardApplicationType)

Example 4 with CardApplicationType

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;
}
Also used : CardInfoType(iso.std.iso_iec._24727.tech.schema.CardInfoType) CardApplicationType(iso.std.iso_iec._24727.tech.schema.CardApplicationType) DIDInfoType(iso.std.iso_iec._24727.tech.schema.DIDInfoType) StatusType(org.openecard.ws.schema.StatusType) ArrayList(java.util.ArrayList) Nonnull(javax.annotation.Nonnull)

Example 5 with CardApplicationType

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();
            }
        }
    }
}
Also used : CardApplicationType(iso.std.iso_iec._24727.tech.schema.CardApplicationType)

Aggregations

CardApplicationType (iso.std.iso_iec._24727.tech.schema.CardApplicationType)7 DIDInfoType (iso.std.iso_iec._24727.tech.schema.DIDInfoType)3 CardApplicationServiceType (iso.std.iso_iec._24727.tech.schema.CardApplicationServiceType)2 ConnectionHandleType (iso.std.iso_iec._24727.tech.schema.ConnectionHandleType)2 DataSetInfoType (iso.std.iso_iec._24727.tech.schema.DataSetInfoType)2 AddonNotFoundException (org.openecard.addon.AddonNotFoundException)2 ECardException (org.openecard.common.ECardException)2 ThreadTerminateException (org.openecard.common.ThreadTerminateException)2 Publish (org.openecard.common.interfaces.Publish)2 InappropriateProtocolForActionException (org.openecard.common.sal.exception.InappropriateProtocolForActionException)2 IncorrectParameterException (org.openecard.common.sal.exception.IncorrectParameterException)2 NameExistsException (org.openecard.common.sal.exception.NameExistsException)2 NamedEntityNotFoundException (org.openecard.common.sal.exception.NamedEntityNotFoundException)2 PrerequisitesNotSatisfiedException (org.openecard.common.sal.exception.PrerequisitesNotSatisfiedException)2 SecurityConditionNotSatisfiedException (org.openecard.common.sal.exception.SecurityConditionNotSatisfiedException)2 UnknownConnectionHandleException (org.openecard.common.sal.exception.UnknownConnectionHandleException)2 UnknownProtocolException (org.openecard.common.sal.exception.UnknownProtocolException)2 CardStateEntry (org.openecard.common.sal.state.CardStateEntry)2 CardInfoWrapper (org.openecard.common.sal.state.cif.CardInfoWrapper)2 TLVException (org.openecard.common.tlv.TLVException)2