|
||||||||||
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.EGIZSignatureHandler
public class EGIZSignatureHandler
The EGIZSignatureHandler SignatureHandler
provides the framework for signing
documents according to the requirements set by
http://www.egiz.gv.at/. In order for
this class to do anything useful, a EGIZSignatureHandler.Factory
must be created.
Nested Class Summary | |
---|---|
static interface |
EGIZSignatureHandler.Factory
An implementation of this Factory is required to create and control the EGIZSignatureHandler |
Nested classes/interfaces inherited from class org.faceless.pdf2.SignatureHandler |
---|
SignatureHandler.Placeholder |
Field Summary | |
---|---|
static int |
FONTCONSTANT
A constant that must be added to the value passed in to the StandardFont
constructor for any fonts used within the populateCanvas method |
Constructor Summary | |
---|---|
EGIZSignatureHandler(EGIZSignatureHandler.Factory factory)
Create a a new EGIZSignatureHandler from the specified Factory |
Method Summary | |
---|---|
String |
createToken(String type,
int line,
int length)
Create a new token to be inserted into the canvas. |
X509Certificate[] |
getCertificates()
Get the X.509 Certificates used to sign this Signature |
int |
getCertificationType()
Return the value of EGIZSignatureHandler.Factory.getCertificationType(org.faceless.pdf2.EGIZSignatureHandler) |
String |
getFilter()
Return the name of the filter, eg "Adobe.PPKLite". |
String |
getIssuerInfo()
Return the "Issuer Information" field of this siganture |
PDFCanvas |
getLayerAppearance(String value,
PDFStyle style)
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. |
String |
getParameter()
Get the "Parameter" field of this Signature |
BigInteger |
getSerialNumber()
Get the "Serial Number" field of this Signature |
byte[] |
getSignatureValue()
Get the "Signature Value" of this signature. |
Calendar |
getSignDate()
Get the time this signature was applied |
Map |
getVariables()
Return the list of "variables" which will be set by the handler after the PDF is rendered. |
void |
postDigest(long filelength,
Map variables)
Update any Variables that need to be updated after the Digest is calculated (eg Contents). |
void |
preDigest(long filelength,
Map variables)
Update any Variables that need to be updated before the Digest is calculated (eg ByteRange). |
void |
prepareToSign(KeyStore keystore,
String alias,
char[] password)
This method initialized the handler using the specified values into a state where it's ready to sign. |
void |
setCertificates(X509Certificate[] certs)
Set the X.509 Certificates for this signature. |
void |
setIssuerInfo(String value)
Set the "Issuer Information" field of this siganture. |
void |
setParameter(String value)
Set the "Parameter" field of this Signature |
void |
setSerialNumber(BigInteger serial)
Set the "Serial Number" field of this Signature |
void |
setSignatureValue(byte[] data)
Set the "Signature Value" of this signature. |
void |
setSignDate(Calendar calender)
Set the time this signature was applied |
void |
setSignerInfo(String value)
Set the "Signer Information" field of this siganture. |
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 |
---|
containsKey, getArrayValueSize, getBooleanValue, getDefaultName, getDictionaryValueKeys, getEstimatedContentSize, getFormSignature, getNameValue, getNumericValue, getStreamValue, getStringValue, getTextStringValue, putArrayValue, putBooleanValue, putDictionaryValue, putNameValue, putNumericValue, putStreamValue, putStringValue, putTextStringValue, sign |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FONTCONSTANT
StandardFont
constructor for any fonts used within the populateCanvas
method
Constructor Detail |
---|
public EGIZSignatureHandler(EGIZSignatureHandler.Factory factory)
Method Detail |
---|
public String getFilter()
SignatureHandler
getFilter
in class SignatureHandler
public String createToken(String type, int line, int length)
Create a new token to be inserted into the canvas. The token type must be one of "date" for the signature date, "serial" for the serial number, "parameter" for the parameter field, "value" for the signature value, "issuer" or "signer" for the signature issuer/signer, or "method" for the signature method. All these fields except for method can be split over multiple lines if necessary - the "line" parameter can range from 0 to 9.
This method should be called by the populateCanvas
method, which is passed a reference to this EGIZSignatureHandler
for this reason.
type
- one of "date", "serial", "signer", "issuer", "method", "parameter" or "value"line
- the line number, from 0 to 9 (for type="method", this must be 0)length
- the length of the field in the canvas
public void prepareToSign(KeyStore keystore, String alias, char[] password) throws GeneralSecurityException
SignatureHandler
This method initialized the handler using the specified values into a state where it's ready to sign. This method should be used to set any additional fields in the Signature dictionary, for example "Certs" for the Self-Sign handler.
Those overriding this method must call super.prepareToSign()
before doing anything else.
prepareToSign
in class SignatureHandler
keystore
- the KeyStorealias
- which key to usepassword
- the password to use to decode the key
GeneralSecurityException
public void setSignatureValue(byte[] data)
EGIZSignatureHandler.Factory.doSign(org.faceless.pdf2.EGIZSignatureHandler, java.security.MessageDigest)
public void setCertificates(X509Certificate[] certs)
EGIZSignatureHandler.Factory.doSign(org.faceless.pdf2.EGIZSignatureHandler, java.security.MessageDigest)
public byte[] getSignatureValue()
public void setSignerInfo(String value)
public X509Certificate[] getCertificates()
public String getIssuerInfo()
public void setIssuerInfo(String value)
public void setSignDate(Calendar calender)
public Calendar getSignDate()
public void setSerialNumber(BigInteger serial)
public BigInteger getSerialNumber()
public String getParameter()
public void setParameter(String value)
public MessageDigest getMessageDigest()
SignatureHandler
SignatureHandler.sign()
- see the API docs
for that method for more details.
getMessageDigest
in class SignatureHandler
public Map getVariables() throws GeneralSecurityException
SignatureHandler
Return the list of "variables" which will be set by the handler after the
PDF is rendered. Entries in the returned map should have a String
as a key and a SignatureHandler.Placeholder
as a value. These placeholders will be
inserted into the PDF at the correct points.
For most SignatureHandlers, the only variables are the "ByteRange" and "Contents" array containing the signature token, which is what this method returns (it may be overridden if more variables are required).
This method was updated for a new signing architecture in release 2.11.12.
getVariables
in class SignatureHandler
GeneralSecurityException
AcrobatSignatureHandlerFactory.setContentSize(int)
public void preDigest(long filelength, Map variables) throws IOException, GeneralSecurityException, CertificateException
SignatureHandler
preDigest
in class SignatureHandler
filelength
- the length of the PDF file, in bytesvariables
- the Map of variables, ordered by their position in the file.
IOException
GeneralSecurityException
CertificateException
public void postDigest(long filelength, Map variables) throws Exception
SignatureHandler
postDigest
in class SignatureHandler
filelength
- the length of the PDF file, in bytesvariables
- the Map of variables, ordered by their position in the file.
Exception
public int getCertificationType()
EGIZSignatureHandler.Factory.getCertificationType(org.faceless.pdf2.EGIZSignatureHandler)
getCertificationType
in class SignatureHandler
FormSignature.getCertificationType()
,
FormSignature.setCertificationType(int, java.lang.String)
public boolean verify(InputStream in) throws IOException, GeneralSecurityException
SignatureHandler
InputStream
.
verify
in class SignatureHandler
IOException
- if the InputStream cannot be read
GeneralSecurityException
- if the signature cannot be verified for some cryptographic reasonpublic String[] getLayerNames()
SignatureHandler
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.
As an example, both the Verisign and the SelfSign handlers return the array
[ "n0", "n1", "n2", "n3" ]
.
getLayerNames
in class SignatureHandler
SignatureHandler.getLayerAppearance(java.lang.String, org.faceless.pdf2.PDFStyle)
public PDFCanvas getLayerAppearance(String value, PDFStyle style)
SignatureHandler
PDFCanvas
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 SignatureHandler
value
- the layer to create (from the list returned by SignatureHandler.getLayerNames()
)style
- the style in which to draw the text, if any
PDFCanvas
of any size containing the specified layer.SignatureHandler.getLayerNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |