public class SigningInformation extends Object
Modifier and Type | Field and Description |
---|---|
static int |
FORMAT_DOCUMENT_TIMESTAMP
Signature format for Document Timestamp
|
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(org.bouncycastle.operator.ContentSigner signer,
Certificate signerCert,
Certificate[] certChain)
Constructs a SigningInformation object that will use an external content signer.
|
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.
|
SigningInformation(TimestampServer timestampServer)
Constructs a SigningInformation object with only a TimestampServer.
|
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.
|
org.bouncycastle.operator.ContentSigner |
getContentSigner()
Deprecated.
|
org.bouncycastle.operator.ContentSigner |
getContentSigner(String pdfVersion)
Get the content signer based on the PDF file version.
|
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()
Deprecated.
|
String |
getLocation()
Gets the location to be used in the signature.
|
int |
getPermissions()
Returns the level of permissions for a certifying signature.
|
PrivateKey |
getPrivateKey()
Deprecated.
|
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.
|
boolean |
isLock()
Returns true if fields will be locked when the signature is applied.
|
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 |
setLock(boolean lock)
Set the lock to true to lock fields when the signature is applied.
|
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 static int FORMAT_DOCUMENT_TIMESTAMP
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.GeneralSecurityException
IOException
PDFException
public 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.GeneralSecurityException
PDFException
public 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 the private key. If left null, we will use the default
Java JCE provider.PDFException
- When the key usage is invalid.public SigningInformation(org.bouncycastle.operator.ContentSigner signer, Certificate signerCert, Certificate[] certChain)
signer
- The signer.signerCert
- The signer's certificate.certChain
- The signer's certificate chain.public SigningInformation(TimestampServer timestampServer)
timestampServer
- the timestamp server.public org.bouncycastle.operator.ContentSigner getContentSigner()
getContentSigner(String)
public org.bouncycastle.operator.ContentSigner getContentSigner(String pdfVersion) throws PDFException
PDFException
public 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 propertyPDFException
public 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
- PDFException
public int getPermissions()
public void setSignatureFormat(int signatureFormat)
signatureFormat
- the signature format (SigningInformation.FORMAT_PKCS7 or SigningInformation.FORMAT_PADES).public int getSignatureFormat()
public boolean isLock()
public void setLock(boolean lock)
lock
- Set to true to lock fields when the signature is applied.