A minimal C interface to a capabilty certificate
A minimal C interface to a capabilty certificate. It consists of C-style opaque pointers to a number of C++ classes and C functions to manipulate these pointers.
List of C++ objects that are wrapped:
CapabilityCertificate AkentiPrincipal AttributeInfo UtcTime PublicKey ConditionalActions Usage: // CALL BACK FUNCTION. int doEvaluate(ExprToken op, const AttrInfo info) { const char* attribute = getAttribute(info); const char* value = getAttribute(info); if (...) { return 1; // SUCCESS } else { return 0; // FAILURE } } void someFunction() { CapCert cert = NULL; AKPrincipal subject; char* resource; int version; if (initFromFile("PEM", "cap", &cert)) { printf("initFromFile Failed\n"); freeCapCert(cert); return; } version = getVersionNumber(cert); resource = (char*) getResource(cert); subject = (AKPrincipal) getSubject(cert); ... if (hasGrantedActions(cert)) { int size = numOfGrantedActions(cert); for (int i = 0; i < size; ++i) { const char* action = grantedActionAt(cert, i); ... } } if (hasCondActions(cert)) { int size = numOfCondActions(cert); int i; for (i = 0; i < size; ++i) { const CondActions condActions = condActionsAt(cert, i); if (evaluate(condActions, doEvaluate, NULL)) { int j; for (j = 0; j < numOfActions(condActions); ++j) { const char* action = actionAt(condActions, j); //allow this action } } else if (isCritical(condActions)) { // DENY ACCESS } } } freeCapCert(cert); }
alphabetic index hierarchy of classes
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de