Search in sources :

Example 1 with SecurityConditionType

use of iso.std.iso_iec._24727.tech.schema.SecurityConditionType in project open-ecard by ecsec.

the class AccessRuleCreator method create.

public AccessRuleType create() {
    AccessRuleType art = new AccessRuleType();
    art.setCardApplicationServiceName(serviceName);
    art.setAction(actionNameType);
    SecurityConditionType security = new SecurityConditionType();
    if (securityConditionAlways != null) {
        security.setAlways(securityConditionAlways);
    }
    if (securityConditionNever != null) {
        security.setNever(securityConditionNever);
    }
    art.setSecurityCondition(security);
    return art;
}
Also used : AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType) SecurityConditionType(iso.std.iso_iec._24727.tech.schema.SecurityConditionType)

Example 2 with SecurityConditionType

use of iso.std.iso_iec._24727.tech.schema.SecurityConditionType in project open-ecard by ecsec.

the class CardStateEntry method checkDataSetSecurityCondition.

public boolean checkDataSetSecurityCondition(byte[] cardApplication, String dataSetName, Enum<?> serviceAction) {
    CardApplicationWrapper application = this.infoObject.getCardApplications().get(new ByteArrayWrapper(cardApplication));
    DataSetInfoWrapper dataSetInfo = application.getDataSetInfo(dataSetName);
    SecurityConditionType securityCondition = dataSetInfo.getSecurityCondition(serviceAction);
    if (securityCondition != null) {
        return checkSecurityCondition(securityCondition);
    } else {
        return false;
    }
}
Also used : ByteArrayWrapper(org.openecard.common.util.ByteArrayWrapper) CardApplicationWrapper(org.openecard.common.sal.state.cif.CardApplicationWrapper) SecurityConditionType(iso.std.iso_iec._24727.tech.schema.SecurityConditionType) DataSetInfoWrapper(org.openecard.common.sal.state.cif.DataSetInfoWrapper)

Example 3 with SecurityConditionType

use of iso.std.iso_iec._24727.tech.schema.SecurityConditionType in project open-ecard by ecsec.

the class CardStateEntry method checkApplicationSecurityCondition.

public boolean checkApplicationSecurityCondition(byte[] applicationIdentifier, Enum<?> serviceAction) {
    if (applicationIdentifier == null) {
        applicationIdentifier = infoObject.getImplicitlySelectedApplication();
    }
    CardApplicationWrapper application = this.infoObject.getCardApplications().get(new ByteArrayWrapper(applicationIdentifier));
    SecurityConditionType securityCondition = application.getSecurityCondition(serviceAction);
    if (securityCondition != null) {
        return checkSecurityCondition(securityCondition);
    } else {
        return false;
    }
}
Also used : ByteArrayWrapper(org.openecard.common.util.ByteArrayWrapper) CardApplicationWrapper(org.openecard.common.sal.state.cif.CardApplicationWrapper) SecurityConditionType(iso.std.iso_iec._24727.tech.schema.SecurityConditionType)

Example 4 with SecurityConditionType

use of iso.std.iso_iec._24727.tech.schema.SecurityConditionType in project open-ecard by ecsec.

the class AndroidMarshaller method parseSecurityCondition.

private SecurityConditionType parseSecurityCondition(XmlPullParser parser) throws XmlPullParserException, IOException {
    SecurityConditionType securityCondition = new SecurityConditionType();
    int eventType;
    do {
        parser.next();
        eventType = parser.getEventType();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("always")) {
                securityCondition.setAlways(true);
            } else if (parser.getName().equals("never")) {
                securityCondition.setNever(false);
            } else if (parser.getName().equals("DIDAuthentication")) {
                securityCondition.setDIDAuthentication(this.parseDIDAuthenticationState(parser));
            } else if (parser.getName().equals("not")) {
                securityCondition.setNot(this.parseSecurityCondition(parser));
            } else if (parser.getName().equals("and")) {
                securityCondition.setAnd(this.parseSecurityConditionTypeAnd(parser));
            } else if (parser.getName().equals("or")) {
                securityCondition.setOr(this.parseSecurityConditionTypeOr(parser));
            } else {
                throw new IOException(parser.getName() + " not yet implemented");
            }
        }
    } while (!(eventType == XmlPullParser.END_TAG && parser.getName().equals("SecurityCondition")));
    return securityCondition;
}
Also used : IOException(java.io.IOException) SecurityConditionType(iso.std.iso_iec._24727.tech.schema.SecurityConditionType)

Example 5 with SecurityConditionType

use of iso.std.iso_iec._24727.tech.schema.SecurityConditionType in project open-ecard by ecsec.

the class CIFCreator method createTrueCond.

private SecurityConditionType createTrueCond() {
    SecurityConditionType cond = new SecurityConditionType();
    cond.setAlways(true);
    return cond;
}
Also used : SecurityConditionType(iso.std.iso_iec._24727.tech.schema.SecurityConditionType)

Aggregations

SecurityConditionType (iso.std.iso_iec._24727.tech.schema.SecurityConditionType)10 DIDAuthenticationStateType (iso.std.iso_iec._24727.tech.schema.DIDAuthenticationStateType)3 CardApplicationWrapper (org.openecard.common.sal.state.cif.CardApplicationWrapper)3 ByteArrayWrapper (org.openecard.common.util.ByteArrayWrapper)3 AccessRuleType (iso.std.iso_iec._24727.tech.schema.AccessRuleType)2 CryptographicServiceActionName (iso.std.iso_iec._24727.tech.schema.CryptographicServiceActionName)1 DIDStructureType (iso.std.iso_iec._24727.tech.schema.DIDStructureType)1 NamedDataServiceActionName (iso.std.iso_iec._24727.tech.schema.NamedDataServiceActionName)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 TreeSet (java.util.TreeSet)1 DIDInfoWrapper (org.openecard.common.sal.state.cif.DIDInfoWrapper)1 DataSetInfoWrapper (org.openecard.common.sal.state.cif.DataSetInfoWrapper)1