public class SigningInformation extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
FORMAT_PADES
Signature format for PAdES.
|
static int |
FORMAT_PKCS7
Signature format for PKCS7.
|
static int |
PERM_FORMFILL_SIGNATURE
Certifying signature permission to allow form fill and signing.
|
static int |
PERM_FORMFILL_SIGNATURE_COMMENTS
Certifying signature permission to allow form fill, signing, and comments.
|
static int |
PERM_NOCHANGES
Certifying signature permission to indicate the document is intended to be final.
|
| Constructor and Description |
|---|
SigningInformation(KeyStore ks,
String entryAlias,
String aliasPWD)
Constructs a SigningInformation object and gets the digital ID from a Java KeyStore object.
|
SigningInformation(PrivateKey pk,
Certificate signerCert,
Certificate[] certChain,
String provider)
Constructs a SigningInformation object given a private key, signer certificate and certificate chain.
|
SigningInformation(String pkcs12File,
String ksPWD,
String entryAlias,
String aliasPWD)
Constructs a SigningInformation object and gets the digital ID from a named PKCS#12 file.
|
| Modifier and Type | Method and Description |
|---|---|
Certificate[] |
getCertificateChain()
Returns the certificate chain for the issuers of the certificate in the key store.
|
String |
getContactInformation()
Returns the contact information used in the signature.
|
Map<String,String> |
getCustomProperties()
Returns the custom properties table.
|
String |
getCustomProperty(String key)
This method can be used to retrieve the values of custom properties
|
String |
getJCEProvider()
Returns the name of the JCE provider to use when accessing the Private Key.
|
String |
getLocation()
Gets the location to be used in the signature.
|
int |
getPermissions()
Returns the level of permissions for a certifying signature.
|
PrivateKey |
getPrivateKey()
Returns the private key retrieved from the KeyStore or PKCS #12 file.
|
String |
getReason()
Gets the reason for signing to be used in the signature.
|
SignatureAppearance |
getSignatureAppearance()
Returns the
SignatureAppearance to use when creating the
signature appearance stream. |
int |
getSignatureFormat()
Returns the format of the signature.
|
Certificate |
getSignerCertificate()
Returns the certificate for the digital id retrieved from the KeyStore or the PKCS#12 file.
|
TimestampServer |
getTimestampServer()
Returns the Timestamp Server information
|
boolean |
isCertifyingSignature()
Returns true if this is a certifying signature.
|
void |
setCertifyingSignature(boolean certifyingSignature)
To create a certifying signature, set this property to true.
|
void |
setContactInformation(String contactInformation)
Sets the contact information to be used in the signature.
|
void |
setCustomProperty(String key,
String value)
This method can be used to add additional custom properties to the signature dictionary.
|
void |
setLocation(String location)
Sets the location to be used in the signature.
|
void |
setPermissions(int permissions)
This property is meaningful only if this is a certifying signature.
|
void |
setReason(String reason)
Sets the reason for signing to be used in the signature.
|
void |
setSignatureAppearance(SignatureAppearance signAppearance)
Sets the
SignatureAppearance to use when creating the
signature appearance stream. |
void |
setSignatureFormat(int signatureFormat)
Set the signature format.
|
void |
setTimestampServer(TimestampServer server)
Set the Timestamp server information
|
public static int PERM_NOCHANGES
public static int PERM_FORMFILL_SIGNATURE
public static int PERM_FORMFILL_SIGNATURE_COMMENTS
public static int FORMAT_PKCS7
public static int FORMAT_PADES
public SigningInformation(String pkcs12File, String ksPWD, String entryAlias, String aliasPWD) throws GeneralSecurityException, IOException, PDFException
pkcs12File - The name of the PKCS#12 key store fileksPWD - The key store passwordentryAlias - The alias of the entry to be used in signing.aliasPWD - The password to the alias entry.GeneralSecurityExceptionIOExceptionPDFExceptionpublic SigningInformation(KeyStore ks, String entryAlias, String aliasPWD) throws GeneralSecurityException, PDFException
ks - The KeyStore object that contains the digital ID.entryAlias - The alias of the entry to be used in signing.aliasPWD - The password to the alias entry.GeneralSecurityExceptionPDFExceptionpublic SigningInformation(PrivateKey pk, Certificate signerCert, Certificate[] certChain, String provider) throws PDFException
pk - The private key to use in signing.signerCert - The singer's certificate.certChain - The signer's certificate chainprovider - The JCE provider to use when accessing teh private key. If left null, we will use the default
Java JCE provider.GeneralSecurityExceptionPDFExceptionpublic String getContactInformation()
public void setContactInformation(String contactInformation)
contactInformation - The new contact information.public String getLocation()
public void setLocation(String location)
location - The new location.public String getReason()
public void setReason(String reason)
reason - The new reason.public PrivateKey getPrivateKey()
public String getJCEProvider()
public Certificate getSignerCertificate()
public Certificate[] getCertificateChain()
public void setSignatureAppearance(SignatureAppearance signAppearance)
SignatureAppearance to use when creating the
signature appearance stream.signAppearance - the signAppearance to use when creating the signature appearance streampublic SignatureAppearance getSignatureAppearance()
SignatureAppearance to use when creating the
signature appearance stream.public String getCustomProperty(String key)
key - The key for the custom propertypublic void setCustomProperty(String key, String value) throws PDFException
key - A unique key for the custom propertyvalue - The vale of the custom propertyPDFExceptionpublic Map<String,String> getCustomProperties()
public TimestampServer getTimestampServer()
public void setTimestampServer(TimestampServer server)
server - public void setCertifyingSignature(boolean certifyingSignature)
public boolean isCertifyingSignature()
public void setPermissions(int permissions)
throws PDFException
permissions - PDFExceptionpublic int getPermissions()
public void setSignatureFormat(int signatureFormat)
signatureFormat - the signature format (SigningInformation.FORMAT_PKCS7 or SigningInformation.FORMAT_PADES).public int getSignatureFormat()