Extending the issuer sample
The issuer may be extended in different ways. This site is going to document some examples on the use of various interfaces.
A certificate specification is required to be available online for download by any client or verifier, as well as a handler for providing issuer values.
Certificate specifications are handled at runtime using I_IssuerConfig, which holds a list of specifications and access methods to retrieve the handlers attached to it. It is either possible to use the existing sample implementation for extension or to implement a custom I_IssuerConfig. In the following section only the first term should be covered
The example servlets web.xml defines certificate specifications with the pattern:
<init-param> <param-name>SPECn</param-name> <param-value><http-uri-where-public-available>|<file-uri-where-located-as-file></param-value> </init-param>
Currently two certificate specifications are registered (SPEC1/SPEC2), so to add a new one you may simply add:
<init-param>
<param-name>SPEC3</param-name>
<param-value>http://localhost:8080/idenpa-issuer/files/CREDDEF3_LOCATION|file://${file.separator}${catalina.home}${file.separator}conf${file.separator}idemix${file.separator}credstruct3noeid.xml</param-value>
</init-param>At the next deployment the spec will be loaded from from TOMCAT_ROOT/conf/idemix/credstruct3noeid.xml and will be used with the default specification handler, filling any issuer-related certificate fields with random values. If you want to use the specification with the default handler for eID-enabled specifications, the specification location must not contain the string "noeid".
However, in both cases a custom specification handler might be necessary. To exchange the default behaviour simply change the issuer servlets init() method and register a handler for your own spec in the following way:
@Override
public void init(ServletConfig config) throws ServletException {
...
super.init(config);
try {
m_objCfg = new IssuerServletConfig(config);
m_objCfg.init();
...
m_objStorage = StorageWrapper.init(m_objCfg);
m_objSrvHandler = ServiceHandler.init(m_objStorage);
...
specStore.setHandler("http://localhost:8080/idenpa-issuer/files/CREDDEF3_LOCATION", new MyCustomSpecHandler());
}
...
}The handler MyCustomSpecHandler() may either implement I_SpecHandler or I_EidSpecHandler depending whether a normal or eID-enabled specification was added. Refer to the JavaDoc for further implementation of those interfaces.
A new HTML element to use the aforementioned SPEC3 might look like this:
<html>
<body>
....
<form action="issue" method="get">
<input type="hidden" name="STRUCT" value="http://localhost:8080/idenpa-issuer/files/CREDDEF3_LOCATION"/>
<input type="submit" name="Submit" value="Issue custom certificate"/>
</form>
....
</body>
</html>
To integrate a custom eID-library either the provided I_IssuerConfig implementation may be extended or a new one may be provided and used instead. In the first case, simply extend the exemplary implementation as follows and return your own implementation of I_EidProviderWrapper:
public class CustomServletConfig extends IssuerServletConfig implements I_IssuerConfig {
/**
* Delegate constructor for use of IssuerServletConfig()
*/
public CustomServletConfig(ServletConfig cfg)
throws IssuerServiceInitException {
super(cfg);
}
/**
* Overwrite default implementation
*/
@Override
public I_EidProviderWrapper getEidProviderWrapper() {
return m_objEidWrapper;
}
}