Search in sources :

Example 6 with AccessRuleType

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

the class AndroidMarshaller method parseAccessRule.

private AccessRuleType parseAccessRule(XmlPullParser parser) throws XmlPullParserException, IOException {
    AccessRuleType accessRule = new AccessRuleType();
    int eventType;
    do {
        parser.next();
        eventType = parser.getEventType();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("CardApplicationServiceName")) {
                accessRule.setCardApplicationServiceName(parser.nextText());
            } else if (parser.getName().equals("Action")) {
                accessRule.setAction(this.parseAction(parser));
            } else if (parser.getName().equals("SecurityCondition")) {
                accessRule.setSecurityCondition(this.parseSecurityCondition(parser));
            } else {
                throw new IOException("not yet implemented");
            }
        }
    } while (!(eventType == XmlPullParser.END_TAG && parser.getName().equals("AccessRule")));
    return accessRule;
}
Also used : AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType) IOException(java.io.IOException)

Example 7 with AccessRuleType

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

the class CIFCreator method createRuleTrue.

private AccessRuleType createRuleTrue(AuthorizationServiceActionName actionName) {
    AccessRuleType rule = new AccessRuleType();
    rule.setCardApplicationServiceName("AuthorizationService");
    rule.setAction(createAction(actionName));
    rule.setSecurityCondition(createTrueCond());
    return rule;
}
Also used : AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType)

Example 8 with AccessRuleType

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

the class CIFCreator method createRuleTrue.

private AccessRuleType createRuleTrue(CryptographicServiceActionName actionName) {
    AccessRuleType rule = new AccessRuleType();
    rule.setCardApplicationServiceName("CryptographicService");
    rule.setAction(createAction(actionName));
    rule.setSecurityCondition(createTrueCond());
    return rule;
}
Also used : AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType)

Example 9 with AccessRuleType

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

the class CIFCreator method createCryptoDID.

private DIDInfoType createCryptoDID(List<MwCertificate> mwCerts, SignatureAlgorithms sigalg) throws WSMarshallerException, CryptokiException {
    LOG.debug("Creating Crypto DID object.");
    DIDInfoType di = new DIDInfoType();
    String keyLabel = mwCerts.get(0).getLabel();
    // create differential identity
    DifferentialIdentityType did = new DifferentialIdentityType();
    di.setDifferentialIdentity(did);
    String didName = keyLabel + "_" + mwCerts.get(0).getLabel() + "_" + sigalg.getJcaAlg();
    LOG.debug("DIDName: {}", didName);
    did.setDIDName(didName);
    did.setDIDProtocol("urn:oid:1.3.162.15480.3.0.25");
    did.setDIDScope(DIDScopeType.LOCAL);
    // create crypto marker
    CryptoMarkerBuilder markerBuilder = new CryptoMarkerBuilder();
    // add AlgorithmInfo
    AlgorithmInfoType algInfo = new AlgorithmInfoType();
    algInfo.setAlgorithm(sigalg.getJcaAlg());
    AlgorithmIdentifierType algIdentifier = new AlgorithmIdentifierType();
    algIdentifier.setAlgorithm(sigalg.getAlgId());
    algInfo.setAlgorithmIdentifier(algIdentifier);
    algInfo.getSupportedOperations().add("Compute-signature");
    markerBuilder.setAlgInfo(algInfo);
    markerBuilder.setLegacyKeyname(keyLabel);
    // add certificates
    for (MwCertificate nextCert : mwCerts) {
        try {
            CertificateRefType certRef = new CertificateRefType();
            certRef.setDataSetName(nextCert.getLabel());
            markerBuilder.getCertRefs().add(certRef);
        } catch (CryptokiException ex) {
            LOG.warn("Certificate chain is not complete.");
            break;
        }
    }
    // wrap crypto marker and add to parent
    CryptoMarkerType marker = markerBuilder.build();
    DIDMarkerType markerWrapper = new DIDMarkerType();
    markerWrapper.setCryptoMarker(marker);
    did.setDIDMarker(markerWrapper);
    // create acl
    AccessControlListType acl = new AccessControlListType();
    di.setDIDACL(acl);
    List<AccessRuleType> rules = acl.getAccessRule();
    rules.add(createRuleTrue(AuthorizationServiceActionName.ACL_LIST));
    rules.add(createRuleTrue(DifferentialIdentityServiceActionName.DID_GET));
    // create sign rule with PIN reference
    AccessRuleType signRule = createRuleTrue(CryptographicServiceActionName.SIGN);
    signRule.setSecurityCondition(createDidCond(PIN_NAME));
    rules.add(signRule);
    return di;
}
Also used : CryptoMarkerBuilder(org.openecard.mdlw.sal.didfactory.CryptoMarkerBuilder) AccessControlListType(iso.std.iso_iec._24727.tech.schema.AccessControlListType) CryptoMarkerType(iso.std.iso_iec._24727.tech.schema.CryptoMarkerType) CertificateRefType(iso.std.iso_iec._24727.tech.schema.CertificateRefType) DIDMarkerType(iso.std.iso_iec._24727.tech.schema.DIDMarkerType) DifferentialIdentityType(iso.std.iso_iec._24727.tech.schema.DifferentialIdentityType) DIDInfoType(iso.std.iso_iec._24727.tech.schema.DIDInfoType) AlgorithmInfoType(iso.std.iso_iec._24727.tech.schema.AlgorithmInfoType) CryptokiException(org.openecard.mdlw.sal.exceptions.CryptokiException) AlgorithmIdentifierType(iso.std.iso_iec._24727.tech.schema.AlgorithmIdentifierType) AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType)

Example 10 with AccessRuleType

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

the class ACLResolver method getUnsatisfiedDIDs.

public List<DIDStructureType> getUnsatisfiedDIDs(TargetNameType target) throws WSException, SecurityConditionUnsatisfiable {
    // get the ACL first
    ACLList aclReq = new ACLList();
    aclReq.setConnectionHandle(handle);
    aclReq.setTargetName(target);
    ACLListResponse aclRes = (ACLListResponse) dispatcher.safeDeliver(aclReq);
    WSHelper.checkResult(aclRes);
    List<AccessRuleType> acls = aclRes.getTargetACL().getAccessRule();
    List<DIDStructureType> dids = getMissingDids(acls, target);
    return dids;
}
Also used : ACLList(iso.std.iso_iec._24727.tech.schema.ACLList) ACLListResponse(iso.std.iso_iec._24727.tech.schema.ACLListResponse) AccessRuleType(iso.std.iso_iec._24727.tech.schema.AccessRuleType) DIDStructureType(iso.std.iso_iec._24727.tech.schema.DIDStructureType)

Aggregations

AccessRuleType (iso.std.iso_iec._24727.tech.schema.AccessRuleType)11 AccessControlListType (iso.std.iso_iec._24727.tech.schema.AccessControlListType)3 DIDInfoType (iso.std.iso_iec._24727.tech.schema.DIDInfoType)2 DIDMarkerType (iso.std.iso_iec._24727.tech.schema.DIDMarkerType)2 DIDStructureType (iso.std.iso_iec._24727.tech.schema.DIDStructureType)2 DifferentialIdentityType (iso.std.iso_iec._24727.tech.schema.DifferentialIdentityType)2 SecurityConditionType (iso.std.iso_iec._24727.tech.schema.SecurityConditionType)2 ArrayList (java.util.ArrayList)2 CryptokiException (org.openecard.mdlw.sal.exceptions.CryptokiException)2 ACLList (iso.std.iso_iec._24727.tech.schema.ACLList)1 ACLListResponse (iso.std.iso_iec._24727.tech.schema.ACLListResponse)1 AlgorithmIdentifierType (iso.std.iso_iec._24727.tech.schema.AlgorithmIdentifierType)1 AlgorithmInfoType (iso.std.iso_iec._24727.tech.schema.AlgorithmInfoType)1 CertificateRefType (iso.std.iso_iec._24727.tech.schema.CertificateRefType)1 CryptoMarkerType (iso.std.iso_iec._24727.tech.schema.CryptoMarkerType)1 CryptographicServiceActionName (iso.std.iso_iec._24727.tech.schema.CryptographicServiceActionName)1 DIDAuthenticationStateType (iso.std.iso_iec._24727.tech.schema.DIDAuthenticationStateType)1 DataSetInfoType (iso.std.iso_iec._24727.tech.schema.DataSetInfoType)1 KeyRefType (iso.std.iso_iec._24727.tech.schema.KeyRefType)1 NamedDataServiceActionName (iso.std.iso_iec._24727.tech.schema.NamedDataServiceActionName)1