Integrating the ABC Engine
Integrating the ABC-Engine
The ABC-Engine (ABCE) provide integration points for user, issuer, verifer, inspector, and revocation authority. The integration is designed to be as simple as possible, but as any ABCE setup requires at least three entities (user, issuer, and verifier) attention must be paid to the details of the instructions.
For each service we have created a helper class which encapsulates and assist in the most common setup of the entities.
In the following we describe how to integrate each entity in an existing application. All the mentioned paths are relative to the current path of the application.
Issuer
-
Initialize IssuanceHelper
IssuanceHelper.initInstance(CryptoEngine.BRIDGED, issuerParamsPrefix, fileStoragePrefix, credSpecAndPolicy, ....);Where:
-
CryptoEngine.BRIDGEDis identifying the crypto engine to use [BRIDGED, UPROVE, IDEMIX] -
issuerParamsPrefixand fileStoragePrefix are strings containing the relative path prefix to identify locations where the issuer parameters and generated files are stored -
credSpecAndPolicyis aSpecAndPolicycontaining a uniques id, the relative paths to the credential specification, and the relative paths to the issuance policy
-
-
Start issuance with initialize issuance
IssuanceMessage im_with_policy = issuanceHelper.initIssuance(engine, specAndPolicyId, attributeValueMap);Where:
-
engineis a reference to the crypto engine -
specAndPolicyIdis the unique id of theSpecAndPolicyobject -
attributeValueMapcontains a reference to a map of the attribute names and their value. This is issuer know attributes.
-
-
Run a sequence of issuance steps until done (checked on the user side by looking at the cd field of the IssuMsgOrCredDesc class. If the field is not null then we are done).
IssuanceMessageAndBoolean response = issuanceHelper.issueStep(engine, issuanceMessage);Where:
-
engineis a reference to the crypto engine -
issuanceMessageis the message received from the user as reponce to either initIssuance or issueStep.
-
See also: integration-test-issuer
Verifier
-
Initialize the VerificationHelper
VerificationHelper.initInstance(CryptoEngine.BRIDGED, issuer_params_resource_list, cred_spec_resource_list, inspector_public_key_resource_list, fileStoragePrefix, presentationPoliciesResouces);Where:
-
issuer_params_resource_listis an array of relative path strings to the issuer parameters binary files -
cred_spec_resource_listis an array of relative path strings to the credential specification files -
inspector_public_key_resource_listis an array of relative path strings to the inspector public keys binary files -
fileStoragePrefixis a string containing the relative path prefix to identify locations where the issuer parameters and generated files are stored. -
presentationPoliciesResoucesis an array of relative path strings to the presentation policies used by the verifier.
-
-
Present a presentation policy 9. Create a nonce to prevent users to reuse old presentation tokens
nonce = verificationHelper.generateNonce();- Add nounce to presentation policy
PresentationPolicyAlternatives ppa = verificationHelper.createPresentationPolicy(policyId, nonce, applicationData);Where: * `policyId` is a unique id used to identify the policy * `nonce` is the nonce generated in step 1 * `applicationData` is application specific data which should be added to the presentation policy- Send the presentation policy to the user
-
Verify the presentation token against the presentation policy. This also verifies that the nonce in the presentation token matches the nonce in the presentation policy.
verificationHelper.verifyToken(presentationPolicyAlternatives, presentationToken);Where:
-
presentationPolicyAlternativesis the presentation policy -
presentationTokenis the presentation token received from the user
-
-
Verify that all pseudonyms in the presentation token are known by the application, if needed.
See also: integration-test-verifier
User
-
Initialize the UserHelper
UserHelper.initInstance(cryptoEngine, issuerParamsResourceList, fileStoragePrefix, credSpecResourceList, inspectorPublicKeyResourceList);Where:
-
cryptoEngineis a reference to the crypto engine -
issuerParamsResourceListis an array of relative path strings to the issuer parameters binary files -
fileStoragePrefixis a string containing the relative path prefix to identify locations where the issuer parameters and generated files are stored -
credSpecResourceListis an array of relative path strings to the credential specification files -
inspectorPublicKeyResourceListis an array of relative path strings to the inspector public keys binary files
-
-
The credential manager can be accessed through the
userHelper.credentialManagerfield. -
The crypto engine can be accessed through the
userHelper.getEngine()method. Useful for creating presentation tokens:userHelper.getEngine().createPresentationToken(presentationPolicy);or for doing a issuance protocol step.
userHelper.getEngine().issuanceProtocolStep(issuanceMessage, policySelector); -
Integration with the identity selection UI
The following protocol is run when the ABCE requests the user to select an identity (a set of credentials and pseudonyms needed to satisfy a policy):
- Check and unlock smart card before Presentation/Issuance.
- Check if the last used card is still present and already unlocked:
Http Response:GET : "/user/checkSmartcard/{SessionID}"OK = 204 (no content) ERROR = other- Check status of smart card
Http Response:GET : "/user/smartcardStatus"OK = 200,204 ERROR = other- Unlock smart card using pin code
Http Responce:POST : "/user/unlockSmartcards/{SessionID}" BODY : <PIN>OK = 200,204 ERROR - 401 Wrong PIN - 403 Card as locked - other - other error - Presentation
- Given a PresentationPolicyAlternatives XML document return descriptions of the matching presentation tokens the user can choose among
Http Responce:Post: "/user/createPresentationToken/{SessionID}" Body: XML PresentationPolicyAlternatives203: SelectPresentationTokenDescription as a JSON structure OTHER: Error- Select a presentation token to be used for the verification
Http Responce:POST: "/user/createPresentationTokenIdentitySelection/{SessionID}" BODY: A JSON structure: { TokenCandidateUID : <UID>, TokenIndex : <IX> PseudonymsList : [UID, UID, ...], InspectorsList : [UID, UID, ...] }200: XML PresentationToken Other: Error - Issuance
- Given a IssuanceMessage XML document return descriptions of the matching presentation tokens the user can choose among
Http Responce:POST : "/user/issuanceProtocolStep/{SessionID}" BODY : XML IssuanceMessage203: SelectIssuanceTokenDescription as a JSON structure OTHER: Error- Select a presentation token to be used for the issuance
Http Responce:POST: "/user/issuanceProtocolStepSelect/{SessionID}" BODY: A JSON structure: { TokenCandidateUID : <UID>, TokenIndex : <IX> PseudonymsList : [UID, UID, ...], InspectorsList : [UID, UID, ...] }200: XML IssuanceMessage OTHER: Error
- Check and unlock smart card before Presentation/Issuance.
See: integration-test-user
##Revocation Authority
-
Initialize the InspectorHelper
RevocationHelper.initInstance(ProductionModule.CryptoEngine.BRIDGED, revocationStoragePrefix, revocationResourcesPrefix, systemParametersResource, issuerParamsResourceList, credSpecResourceList, revocationReferences);Where:
-
revocationStoragePrefixis a string containing the relative path prefix to identify locations where the revocation authority files are stored -
revocationResourcesPrefixis a string containing the relative path prefix to identify locations where the revocation authority resources are stored -
systemParameterResourceis a string containing the relative path prefix to a file containing the system parameters -
issuerParamsResourceListis an array of relative path strings to the issuer parameters binary files -
credSpecResourceListis an array of relative path strings to the revocable credential specification files -
revocationReferencesis an array of RevocationReferences containing the revocation authority UID and the endpoints (URIs) for where to obtain revocation information, non-revocation evidence, and non revocation updates
-
-
Revoke attribute
RevocationInformation ri = RevocationHelper.getInstance().engine.revoke(revParUid, attributes);Where:
-
revParUidis the revocation parameters UID -
atttributesis a list of revocation handle attributes
-
-
Obtain revocation information
RevocationHelper.getInstance().revocationProxyAuthority.processRevocationMessage(in);Where:
-
inis a revocation message with a crypto element containing aRevocationMessageTypeofREQUEST_REVOCATION_INFORMATIONorGET_CURRENT_REVOCATION_INFORMATION
-
-
Obtain non-revocation evidence
RevocationHelper.getInstance().revocationProxyAuthority.processRevocationMessage(in);Where:
-
inis a revocation message with a crypto element containing aRevocationMessageTypeofUPDATE_REVOCATION_EVIDENCE
-
-
Request revocation handle
RevocationHelper.getInstance().revocationProxyAuthority.processRevocationMessage(in);Where:
-
inis a revocation message with a crypto element containing aRevocationMessageTypeofREQUEST_REVOCATION_HANDLE
-
See also: integration-test-revocation
##Inspector
-
Initialize the InspectorHelper
inspectorHelper.initInstance(inspectorStoragePrefix, inspectorResourcePrefix, systemParameterResource, inspector_public_key_uids, inspection_cred_spec_resource_list);Where:
-
inspectorStoragePrefixis a string containing the relative path prefix to identify locations where the inspector files are stored -
inspectorResourcePrefixis a string containing the relative path prefix to identify locations where the inspector resources are stored -
systemParameterResourceis a string containing the relative path prefix to a file containing the system parameters -
inspector_public_key_uidsis an array of URIs to the inspector public keys -
inspection_cred_spec_resource_listis an array of relative path strings to the inspectable credential specification files
-
-
Inspect the inspectable attributes in the presentation token:
List<Attribute> atts = inspectorHelper.inspect(presentationToken.getValue());Where:
-
presentationTokencontains a reference to the presentation token
-
-
Recover the value from its BigInteger representation:
for(Attribute a : atts) { MyAttributeValue value = MyAttributeEncodingFactory.recoverValueFromBigInteger( a.getAttributeDescription().getEncoding(), (BigInteger) a.getAttributeValue(), null); }
See also: integration-test-inspector