|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.faceless.pdf2.SignatureHandler
org.faceless.pdf2.PKCS7SignatureHandler
public abstract class PKCS7SignatureHandler
This class represents the subclass of digital signatures that rely on Public/Private key pairs and that meet the requirements laid down in the document "PDF Public-Key Digital Signature and Encryption Specification", published by Adobe. Currently we know of three handlers that meet this requirement - the general purpose PKCS#7 handler supplied with Acrobat 6.0 and later, or (for earlier versions) the Adobe "Self-Sign" handler and the plugin supplied by VeriSign.
AcrobatSignatureHandlerFactory| Method Summary | |
|---|---|
X509Certificate[] |
getCertificates()
Return the list of certificates included in this signature. |
PDFCanvas |
getLayerAppearance(String layername,
PDFStyle textstyle)
Return a PDFCanvas for the specified layer. |
String[] |
getLayerNames()
Return the list of appearance layer names used by this Signature Handler to create a visible appearance on the page, in the order they should be drawn. |
MessageDigest |
getMessageDigest()
Return a MessageDigest that will be used to calculate the digest of the PDF for signing. |
X509Certificate[] |
getTimeStampCertificates()
If the PKCS#7 object was digitally time-stamped using an RFC3161 time-stamp server, this method verifies and returns the list of X.509 certificates that verify the timestamp, with the actual signing certificate first and the rest in no particular order. |
void |
setCustomAppearance(PDFCanvas canvas,
float x1,
float y1,
float x2,
float y2)
Set a custom appearance for this signature. |
byte[] |
sign()
Finish the digest calculation on the digest returned from SignatureHandler.getMessageDigest()
and return a signature token the signs it. |
boolean |
verify(InputStream in)
Return a boolean indicating whether or not the signature handler can verify the specified InputStream. |
| Methods inherited from class org.faceless.pdf2.SignatureHandler |
|---|
getFilter, getVariable, getVariables, isVariableEncrypted |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public MessageDigest getMessageDigest()
SignatureHandler
getMessageDigest in class SignatureHandler
public byte[] sign()
throws GeneralSecurityException,
IOException
SignatureHandlerSignatureHandler.getMessageDigest()
and return a signature token the signs it.
This method will be called more than once - the first time with a
zero-length stream, to calculate the length of the token, the second time
with the actual data to sign. The returned byte array will be stored
as the "Contents" value of the Signature dictionary.
sign in class SignatureHandlerGeneralSecurityException - if the signature cannot be applied for some cryptographic reason
IOException - if the InputStream cannot be read
public final boolean verify(InputStream in)
throws GeneralSecurityException,
IOException
SignatureHandlerInputStream.
verify in class SignatureHandlerGeneralSecurityException - if the signature cannot be verified for some cryptographic reason
IOException - if the InputStream cannot be read
public final X509Certificate[] getCertificates()
throws CertificateException
CertificateExceptionpublic String[] getLayerNames()
SignatureHandlerFormSignature class
when drawing the signature annotations on the page.
For more information see the document "Digital Signature Appearances for Public-Key Interoperability", from Adobes website.
As an example, both the Verisign and the SelfSign handlers return the array
[ "n0", "n1", "n2", "n3" ].
getLayerNames in class SignatureHandlerSignatureHandler.getLayerAppearance(java.lang.String, org.faceless.pdf2.PDFStyle)
public PDFCanvas getLayerAppearance(String layername,
PDFStyle textstyle)
SignatureHandlerPDFCanvas for the specified layer.
This method is called internally by the FormSignature class
when drawing the signature annotations on the page.
For more information see the document "Digital Signature Appearances for Public-Key Interoperability", from Adobes website.
getLayerAppearance in class SignatureHandlerlayername - the layer to create (from the list returned by SignatureHandler.getLayerNames())textstyle - the style in which to draw the text, if any
PDFCanvas of any size containing the specified layer.SignatureHandler.getLayerNames()
public void setCustomAppearance(PDFCanvas canvas,
float x1,
float y1,
float x2,
float y2)
Set a custom appearance for this signature. See the AcrobatSignatureHandlerFactory.setCustomAppearance(org.faceless.pdf2.PDFCanvas, float, float, float, float) method for more details -
unless you're manually overriding this class, that's the method you
should be calling.
canvas - the canvas to display as the "n2" layer of the signature appearance.x1 - the left-most X co-ordinate to place the (optional) certificate texty1 - the bottom-most Y co-ordinate to place the (optional) certificate textx2 - the right-most X co-ordinate to place the (optional) certificate texty2 - the top-most Y co-ordinate to place the (optional) certificate text
public X509Certificate[] getTimeStampCertificates()
throws GeneralSecurityException,
IOException
If the PKCS#7 object was digitally time-stamped using an RFC3161 time-stamp
server, this method verifies and returns the list of X.509 certificates that
verify the timestamp, with the actual signing certificate first and the rest
in no particular order. If this method succeeds, then the date returned by
FormSignature.getSignDate() is the date guaranteed by the time-stamp.
If the signature was time-stamped but the timestamp is corrupt or invalid,
thie method will throw either a GeneralSecurityException or a
IOException detailing why.
null.
X509Certificate objects that authorized the timestamp, or null if there isn't a timestamp.
GeneralSecurityException - if the TimeStamp is invalid
IOException - if the TimeStamp is corrupt or can't be parsed
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||