public abstract class SignatureHandler
extends java.lang.Object
SignatureHandler
represents as third-party
signature signing and verifying handler interface.
This is a handler and is implemented by caller.
When host application wants to do customize signing and verifying signature fields,
this handler should be implemented and function
should be called to register this handler to Foxit PDF SDK.Signature.registerHandler(String, String, SignatureHandler)
Modifier and Type | Field and Description |
---|---|
java.lang.Object |
clientData
User-defined data.
|
Constructor and Description |
---|
SignatureHandler() |
Modifier and Type | Method and Description |
---|---|
abstract int |
continueCalcDigest(java.lang.Object clientData,
java.lang.Object context,
int millisecond)
Foxit PDF SDK calls this interface to continue a custom digest calculation.
|
abstract java.lang.String |
finishCalcDigest(java.lang.Object clientData,
java.lang.Object context)
Foxit PDF SDK calls this interface to finish the custom digest calculation and get the digest.
|
abstract java.lang.String |
sign(java.lang.Object clientData,
java.lang.Object context,
Signature sigField,
java.lang.String digest)
Foxit PDF SDK calls this interface to sign a document.
|
abstract java.lang.Object |
startCalcDigest(java.lang.Object clientData,
Signature sigField,
FileHandler file,
int[] byteRange)
Foxit PDF SDK calls this interface to start a custom digest calculation.
|
abstract void |
verify(java.lang.Object clientData,
java.lang.Object context,
Signature sigField,
java.lang.String digest,
java.lang.String signedData)
Foxit PDF SDK calls this interface to verify a specified signature.
|
public java.lang.Object clientData
public abstract java.lang.Object startCalcDigest(java.lang.Object clientData, Signature sigField, FileHandler file, int[] byteRange) throws PDFException
It may spend a long time for application to calculate the digest, so
Foxit PDF SDK uses a progressive process to do this.
The context returned to Foxit SDK will be used to track application to
progressive process digest calculating steps by
.continueCalcDigest(Object, Object, int)
clientData
- The user-supplied data.sigField
- The Signature
object that to be signed or
verified.file
- FileHandler
object indicates the source file.
When signing a signature, it's the source file object to be
signed.byteRange
- Byte range array.Elements in this array always be in pairs of
offset-size values in order of : offset,size,offset,size...PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Signature
,
FileHandler
public abstract int continueCalcDigest(java.lang.Object clientData, java.lang.Object context, int millisecond) throws PDFException
clientData
- The user-supplied data.context
- The digest calculate context object, returned by startCalcDigest(Object, Signature, FileHandler, int[])
.millisecond
- An integer value which represents millisecond, used to determine break state.
This value should be non-negative. If it's 0
,
the current process will not be paused.Progress.TOBECONTINUED
: if calculating progress hasn't finished yet
and needs to be continued by calling this callback function again.Progress.FINISHED
: if calculating progress is done.PDFException.ERRCODE_ERROR
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Progress
public abstract java.lang.String finishCalcDigest(java.lang.Object clientData, java.lang.Object context) throws PDFException
clientData
- The user-supplied data.context
- The digest calculate context object, returned by startCalcDigest(Object, Signature, FileHandler, int[])
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public abstract java.lang.String sign(java.lang.Object clientData, java.lang.Object context, Signature sigField, java.lang.String digest) throws PDFException
clientData
- The user-supplied data.context
- The digest calculate context object, returned by startCalcDigest(Object, Signature, FileHandler, int[])
.sigField
- The Signature
object to be signed.digest
- The digest value, returned by finishCalcDigest(Object, Object)
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Signature
public abstract void verify(java.lang.Object clientData, java.lang.Object context, Signature sigField, java.lang.String digest, java.lang.String signedData) throws PDFException
clientData
- The user-supplied data.context
- The digest calculate context object, returned by startCalcDigest(Object, Signature, FileHandler, int[])
.sigField
- The Signature
object to be verified.digest
- The digest value, returned by finishCalcDigest(Object, Object)
.signedData
- The signed data, and the a~f(hex value) character will be changed to upperCase.
User needs to confirm this string is the same as the signed data that returned by sign(Object, Object, Signature, String)
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
,
Signature