|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.faceless.pdf2.viewer2.ViewerFeature
org.faceless.pdf2.viewer2.SignatureProvider
org.faceless.pdf2.viewer2.feature.RemoteSignatureProvider
public class RemoteSignatureProvider
A SignatureProvider that allows digital signatures to applied using
the RemoteSignatureHandlerFactory
class. This factory works together
with a RemoteSigningServlet
on a remote host to sign the PDF without needing
to manage the KeyStore
on the client.
This class needs a Factory
to operate. This
can be set by calling setSignatureHandlerFactory()
,
or by specifying the URL of the Factory as an initialization parameter (if neither is done
then this class is not used).
SignatureProvider
API documentation.
url | The URL of the RemoteSigningServlet |
---|---|
digestAlgorithm | The digest algorithm to be use. The default (defined by the RemoteSignatureHandlerFactory ) is "SHA1", other valid values are "MD5" or "SHA256". |
Here's a fully working example of how to specify these parameters when the PDF Viewer
is installed as an applet. The URL specified is the URL of a demonstration
RemoteSigningServlet
which can be used for testing.
<applet code="org.faceless.pdf2.viewer2.PDFViewerApplet" name="pdfapplet" archive="bfopdf.jar"> <param name="feature.RemoteSignatureProvider.url" value="http://bfo.com/signdemo/" /> <param name="feature.RemoteSignatureProvider.alias" value="" /> <param name="feature.RemoteSignatureProvider.name" value="John User" /> <param name="feature.RemoteSignatureProvider.certification" value="none" /> <param name="feature.RemoteSignatureProvider.reason" value="" /> <param name="feature.RemoteSignatureProvider.location" value="" /> </applet>
In this exampel we're specifying all the parameters required for signing, so no dialog will
be presented to the user when signing - in fact, if this is the only SignatureProvider
available to the PDFViewer
, clicking a signature field will immediately sign the field
using these parameters without prompting the user for any further information. Note the
RemoteSigningServlet
may be set up to ignore and override these values.
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.faceless.pdf2.viewer2.SignatureProvider |
---|
SignatureProvider.SignatureState |
Constructor Summary | |
---|---|
RemoteSignatureProvider()
|
Method Summary | |
---|---|
boolean |
canSign(FormSignature field)
Return true if a RemoteSignatureHandlerFactory has been specified for signing. |
boolean |
canVerify(FormSignature field)
Signatures do not need to be verified remotely, so this method always returns false. |
protected String |
getDefaultAlias()
Return the default value of "alias" to be passed in to the signing method. |
String |
getDisplayName()
Return the "user friendly" name of this SignatureProvider, to use in dialogs and menus. |
void |
initialize(PDFViewer viewer)
Called when the feature is first added to a viewer |
void |
setSignatureHandlerFactory(RemoteSignatureHandlerFactory factory)
Set the RemoteSignatureHandlerFactory that is to be used to sign this
PDF. |
void |
showSignDialog(JComponent root,
FormSignature field)
Display the signing dialog for the specified field, and assuming all goes well sign the field at the end. |
void |
showVerifyDialog(JComponent root,
FormSignature field)
As the canVerify() method always returns false, this method
does nothing. |
Methods inherited from class org.faceless.pdf2.viewer2.SignatureProvider |
---|
getDefaultCertificationType, getDefaultLocation, getDefaultName, getDefaultReason, getIcon, getSignatureState, getViewer, selectSignProvider, selectVerifyProvider, setSignatureState, verify |
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature |
---|
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RemoteSignatureProvider()
Method Detail |
---|
public String getDisplayName()
SignatureProvider
getDisplayName
in class SignatureProvider
public void initialize(PDFViewer viewer)
ViewerFeature
initialize
in class SignatureProvider
protected String getDefaultAlias()
RemoteSigningServlet
is set up - the
default implementation of this method returns the alias
initialization
parameter for the viewer. If this method returs null
then the user will be
prompted for a value.
public void setSignatureHandlerFactory(RemoteSignatureHandlerFactory factory)
RemoteSignatureHandlerFactory
that is to be used to sign this
PDF. This will override any factory specified by the url
property
to this feature, as described in the API docs
public boolean canSign(FormSignature field)
RemoteSignatureHandlerFactory
has been specified for signing.
canSign
in class SignatureProvider
public boolean canVerify(FormSignature field)
canVerify
in class SignatureProvider
public void showSignDialog(JComponent root, FormSignature field) throws IOException, GeneralSecurityException
SignatureProvider
showSignDialog
in class SignatureProvider
root
- the JCompoment the dialog should be relative to - typically this is the DocumentPanel
field
- the field to be signed
IOException
GeneralSecurityException
public void showVerifyDialog(JComponent root, FormSignature field)
canVerify()
method always returns false, this method
does nothing.
showVerifyDialog
in class SignatureProvider
root
- the JCompoment the dialog should be relative to - typically this is the DocumentPanel
field
- the field to be verified
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |