Murielle666 / eid-applet

Automatically exported from code.google.com/p/eid-applet
Other
0 stars 0 forks source link

How to supply an in memory document for signing to the applet #86

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use the eid-applet for signing a document.  This document is an in memory 
string. To supply the document to the applet, I create a stateful session bean 
(ejb3) that implements the eid-applets SignatureService interface 
(be.fedict.eid.applet.service.spi.SignatureService). In my webapp I create the 
ejb and set the document to sign using a setter from the stateful session bean. 
The applet calls the servlet that (should) create the same ejb. Unfortunately 
this ejb is not the same instance of this stateful session bean. How can I get 
the document (in memory string) from the session of the webapp (struts action) 
into the applet for signing.

This is the code of the stateful session bean I use :

@Stateful(name = "DocumentSignatureService")
@Local(DocumentSignatureService.class)
public class DocumentServiceBean  implements DocumentSignatureService {

    ...

    public void setDocument(byte [] doc) {
        ...
    }
    @Remove
    public byte [] getSignature() {
        ...
    }

    @Override
    public byte[] getDocument() {
        return doc;
    }

    @Override
    public void setSignature(byte[] sig) {
        ...
    }

    @Override
    public String getFilesDigestAlgorithm() {
        return null;
    }

    @Override
    public void postSign(byte[] arg0, List<X509Certificate> arg1) 
        throws ... {
        ...
    }

    @Override
    public DigestInfo preSign(List<DigestInfo> arg0,
                              List<X509Certificate> arg1) throws ... {
        return null;
    }
}

public interface DocumentSignatureService extends SignatureService {
    byte [] getDocument();
    void setDocument(byte [] doc);
    byte [] getSignature();
    void setSignature(byte[] sig);
}

Original issue reported on code.google.com by dominiqu...@gmail.com on 20 Mar 2013 at 11:15

GoogleCodeExporter commented 9 years ago
What you're looking for is JACC.
Example JACC usage to retrieve the HttpServletSession from within the EJB3 
container:
http://code.google.com/p/eid-applet/source/browse/trunk/eid-applet-beta/eid-appl
et-beta-model/src/main/java/be/fedict/eid/applet/beta/AuthenticationServiceBean.
java

Original comment by frank.co...@gmail.com on 18 Apr 2013 at 3:16