Project

General

Profile

Add-on System » History » Version 5

Hans-Martin Haase, 08/13/2015 03:01 PM
Add new structure and clarify the word add-on including the availabe kinds of them.

1 4 Hans-Martin Haase
{{toc}}
2
3 1 Dirk Petrautzki
h1. Add-on System
4 4 Hans-Martin Haase
5
On this wiki page you'll find detailed information about the add-on development like the different kinds of add-ons and how they are enabled to communicate with core application.
6
7
h2. Definition of Add-on in the Open eCard context
8
9
_Add-on_ is the generic term for a component that enhances the functionality of the Open eCard App.
10
11
_Extensions_ are independent from the context. Moreover, they are included directly into the user interface and can be executed by the user. For instance, an add-on that provides a PIN change functionality for smart cards is classified as an _extension_.
12
13
_Plug-ins_ depend on the context in which the user uses the application. Performing an authentication to a service using a particular smart card, for instance, requires a _plug-in_ which is capable of providing such functionality. Subsequently, _plug-ins_ require a communication with bindings to interact with external applications and services. Furthermore, we distinguish between IFD, SAL, and application plug-ins.
14
15
h2. Add-on Types
16
17
h3. IFD Plug-ins
18
19 5 Hans-Martin Haase
An IFD Plug-in represents a protocol which is used to extend the IFD. The protocol implementation may enable the IFD to perform a special user authentication method or establish a secure channel between a card and cardreader to protect the communication from being eavesdropped. Each protocol must have a unique identifier in form of a URI. The URI must be associated with the actual implementation as described in the [[Add-on System#IFD protocol implementation details|IFD protocol implementation details]]. In addition, each protocol plug-in must implement the IFD Protocol Interface and must define protocol-specific _AuthenticationProtocolData_ used in the _EstablishChannel_ call and corresponding response message. An example for an IFD Plugin is the Password Authenticated Connection Establishment (PACE) protocol which is executed by the IFD. It is included as integrated add-on in the Open eCard App.
20
21 4 Hans-Martin Haase
h3. SAL Plug-ins
22
23 5 Hans-Martin Haase
The SAL provides generic interfaces to common smart card services like Crypto services or differential identity services. The SAL can be extended by plug-ins, which provide implementations of protocols for the Crypto Services and the Differential Identity Services as required for the use of specific signature cards and electronic identity cards for example. The plugin concept is quite similar to the one used for the IFD. There is also an unique identifier necessary in the protocol implementation but an SAL protocol may have multiple steps and allows the definition more sophisticated user interfaces including a sequence of interaction steps to represent information dialogues and general user consents. For example the already included Extended Access Control (EAC) protocol is one of this kind. The protocol is used while authentication process with German eID card.
24
25
26 4 Hans-Martin Haase
h3. Application Plug-ins
27
28 5 Hans-Martin Haase
Application plug-ins provide a mechanism to add additional functionality to the eID application with which external applications can communicate. Depending on the type of the underlying binding, this could be a browser, a PKCS#11 module or even a remote application. Protocol bindings realize the connection to the external world. While a broad variety of transport protocols could be supported, the most obvious choices are HTTP and SOAP,
29
as they are stipulated by [Fed12d, Section 3.2] for example. Given the properties of the activation mechanism, HTTP and SOAP, as well as similar transport protocols, the abstract requirements for a protocol binding are given as follows: A protocol binding must support 
30
31
# a request-response semantic,
32
# a mapping mechanism to identify the appropriate plug-in for a request,
33
# messages comprising a body, named parameters and attachments,
34
# an error delivery mechanism, and
35
# a redirect semantic.
36
37 4 Hans-Martin Haase
h3. Application Extensions
38
39 5 Hans-Martin Haase
Extensions enhance – similar to plug-ins – the basic eID platform and provide additional functionality, but they do not depend on the context in which the eID application is used. Further, extensions are included into the user interface and can be started directly by the user. Similar to application plug-ins, the _AppExtensionAction_ interface contains an execute function. However, this function does not have any parameters nor does it have a result. Therefore, it cannot be used with a binding and only be triggered manually.
40
41
42 4 Hans-Martin Haase
h2. Architecture of an Add-on package
43
44
h3. General architecture
45
46
h3. The Add-on Manifest
47
48
h3. Types available in the configuration
49
50
h3. Configuration of an Add-on in the client
51
52
h2. Add-on Implementation
53 5 Hans-Martin Haase
54
h3. IFD protocol implementation details
55
56 1 Dirk Petrautzki
57
This section describes the add-on system from the perspective of a developer.
58
The implementation of the add-on system is located in the maven module with the group Id *org.openecard* and the artifact Id *addon*.
59
All classes are in a sub namespace of *org.openecard.addon*. The module is divided into the following five packages:
60
* *org.openecard.addon*
61
In this package are the main classes of the add-on system, for example the AddonManager or the different AddonRegistries.
62
* *org.openecard.addon.bind*
63
This package includes all classes representing the interface between an addon and a specific binding. That is to say, here are the classes needed to convert a specific request, for example a HTTP request that arrives via the localhost binding, into a generic request, which is independent from binding and vice versa for the response.
64
* *org.openecard.addon.ifd*
65
In here are the classes that specify the interface for an IFD protocol and the factory to instantiate such a protocol.
66
* *org.openecard.addon.manifest*
67
This package accumulates all classes needed to convert (automatically) between the XML represantation of the add-on description and it's java object pendants.
68
* *org.openecard.addon.sal*
69
In here are the classes that specify the interface for an SAL protocol and the factory to instantiate such a protocol.
70
71
h1. Types of add-ons
72
73 2 Dirk Petrautzki
In the context of Open eCard App, the terms add-on, plug-in and extension are defined as follows.
74
75
Add-on is the generic term for a component that enhances the functionality of the Open eCard App.
76
77
Extensions are independent from the context. Moreover, they are included directly into
78
the user interface and can be executed by the user. For instance, an add-on that provides a
79
PIN change functionality for smart cards is classified as an extension.
80
81
Plug-ins depend on the context in which the user uses the application. Performing
82
an authentication to a service using a particular smart card, for instance, requires a plug-in
83
which is capable of providing such functionality. Subsequently, plug-ins require a communication
84
with bindings to interact with external applications and services. Furthermore,
85
we distinguish between IFD, SAL, and application plug-ins.
86
87 1 Dirk Petrautzki
h1. Add-on development
88
89
This section describes the steps to take when developing an add-on.
90
As first step a new XML file called *Addon.xml* in the *META-INF* directory of the project should be created and the fields that describe the general part of the add-ons can already be filled.
91
An example file for a PIN Management addon could look like this:
92
<pre>
93
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
94
<AddonBundleDescription>
95
	<ID>PIN-Plugin</ID>
96
	<Version>1.0</Version>
97
	<About />
98
	<License />
99
	<LocalizedName xml:lang="DE">PIN Verwaltung</LocalizedName>
100
	<LocalizedDescription xml:lang="DE">Verwaltung von PIN/ PUK und gegebenenfalls anderen Geheimnissen der Chipkarte.
101
	</LocalizedDescription>
102
	<LocalizedName xml:lang="EN">PIN Management</LocalizedName>
103
	<LocalizedDescription xml:lang="EN">Management of PIN/ PUK and possibly other secrets of the smart-card.</LocalizedDescription>
104
	<Logo>images/logo.png</Logo>
105
	<ConfigDescription />
106
	<BindingActions />
107
	<ApplicationActions />
108
	<IFDActions />
109
	<SALActions />
110
</AddonBundleDescription>
111
</pre>
112
As can be seen, some fields can be localized. That fields are: *LocalizedName*, *LocalizedDescription* and *About*
113
The next step is to think about what actions should be offerd by the add-on and of what type these actions are.
114
For the PIN management example there are two actions. An action to change a PIN and a second action to unblock a PIN.
115 2 Dirk Petrautzki
These actions are not of type *ProtocolPlugin* nor *AppPluginAction*, but of type *AppExtensionAction*, as they expand the function of the Open eCard App independent from a context.
116
This means two classes implementing the *AppExtensionAction* interface need to be added to the project and the two AppExtensionActionDescription that belong to them need to be added to the XML description.
117
Assume we are working in the org.openecard.plugins.pinplugin namespace and the two actions are called ChangePINAction and UnblockPINAction, the resulting XML would now look similar to this:
118
<pre>
119
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
120
<AddonBundleDescription>
121
	<ID>PIN-Plugin</ID>
122
	<Version>1.0</Version>
123
	<About />
124
	<License />
125
	<LocalizedName xml:lang="DE">PIN Verwaltung</LocalizedName>
126
	<LocalizedDescription xml:lang="DE">Verwaltung von PIN/ PUK und gegebenenfalls anderen Geheimnissen der Chipkarte.
127
	</LocalizedDescription>
128
	<LocalizedName xml:lang="EN">PIN Management</LocalizedName>
129
	<LocalizedDescription xml:lang="EN">Management of PIN/ PUK and possibly other secrets of the smart-card.</LocalizedDescription>
130
	<Logo>images/pin-management.png</Logo>
131
	<ConfigDescription />
132
	<BindingActions />
133
	<ApplicationActions>
134
		<AppExtensionActionDescription>
135
			<ID>ChangePINAction</ID>
136
			<ClassName>org.openecard.plugins.pinplugin.ChangePINAction</ClassName>
137
			<LocalizedName xml:lang="DE">PIN ändern</LocalizedName>
138
			<LocalizedDescription xml:lang="DE">Mit dieser Aktion können Sie ihre PIN ändern.</LocalizedDescription>
139
			<LocalizedName xml:lang="EN">Change PIN</LocalizedName>
140
			<LocalizedDescription xml:lang="EN">With this action you can change your PIN.</LocalizedDescription>
141
			<ConfigDescription />
142
		</AppExtensionActionDescription>
143
		<AppExtensionActionDescription>
144
			<ID>UnblockPINAction</ID>
145
			<ClassName>org.openecard.plugins.pinplugin.UnblockPINAction</ClassName>
146
			<LocalizedName xml:lang="DE">PIN entsperren</LocalizedName>
147
			<LocalizedDescription xml:lang="DE">Mit dieser Aktion können Sie ihre PIN entsperren.</LocalizedDescription>
148
			<LocalizedName xml:lang="EN">Unblock PIN</LocalizedName>
149
			<LocalizedDescription xml:lang="EN">With this action you can unblock your PIN.</LocalizedDescription>
150
			<ConfigDescription />
151
		</AppExtensionActionDescription>
152
	</ApplicationActions>
153
	<IFDActions />
154
	<SALActions />
155
</AddonBundleDescription>
156
</pre>
157 3 Dirk Petrautzki
158
For the actual implementation part of the add-on, the following has to be considered.
159
The actions need to implement the AppExtensionAction interface, which itself extends the FactoryBaseType interface. 
160
Altogether, three functions are to be implemented:
161
* void execute();
162
the actual logic of the action, in this case the PIN change, will take place here
163
* void init(Context context) throws FactoryInitializationException;
164
initialization of the action; the given Context allows access to components of the Open eCard App like UserConsent or Dispatcher
165
* void destroy();
166
closing resources and further cleanup.