Signature

Inheritance: java.lang.Object

public abstract class Signature

An abstract class which represents signature object in the pdf document. Signatures are fields with values of signature objects, the last contain data which is used to verify the document validity.

Constructors

ConstructorDescription
Signature()Inititalizes new instance of the Signature class.
Signature(String pfx, String password)Inititalizes new instance of the Signature class.
Signature(InputStream pfx, String password)Inititalizes new instance of the Signature class.

Methods

MethodDescription
getCustomAppearance()Gets/sets the custom appearance.
setCustomAppearance(SignatureCustomAppearance value)Gets/sets the custom appearance.
getAuthority()The name of the person or authority signing the document.
setAuthority(String value)Sets the name of the person or authority signing the document.
getDate()Gets the time of signing.
setDate(Date value)Set the time of signing.
getLocation()Gets the CPU host name or physical location of the signing.
setLocation(String value)Sets the CPU host name or physical location of the signing.
getReason()Gets the reason for the signing, such as (I agreed!).
setReason(String value)Sets the reason for the signing, such as (I agreed!).
getContactInfo()Get information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g.
setContactInfo(String value)Set information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g.
getByteRange()Get array of pairs of integers (starting byte offset, length in bytes) that shall describe the exact byte range for the digest calculation.
getTimestampSettings()Gets timestamp settings.
setTimestampSettings(TimestampSettings value)Sets timestamp settings.
getOcspSettings()Gets/sets ocsp settings.
setOcspSettings(OcspSettings value)Gets/sets ocsp settings.
getUseLtv()Gets/sets ltv validation flag.
setUseLtv(boolean value)Gets/sets ltv validation flag.
getImageInternal()Gets image stream.
setImage(InputStream _signatureAppearanceStream)Sets image stream.
setImageInternal(System.IO.Stream value)
getSignatureReferences()get Signature References
getCustomSignHash()The delegate for custom sign the document hash (Beta).
setCustomSignHash(Signature.SignHash value)The delegate for custom sign the document hash (Beta).
verify()Verify the document regarding this signature and return true if document is valid or otherwise false.
isShowProperties()Force to show/hide signature properties.
setShowProperties(boolean value)Force to show/hide signature properties.
close()Destructor which closes temporary streams (if necessary).

Signature()

public Signature()

Inititalizes new instance of the Signature class.

Signature(String pfx, String password)

public Signature(String pfx, String password)

Inititalizes new instance of the Signature class.

Parameters:

ParameterTypeDescription
pfxjava.lang.StringPfx file which contains certificate for signing.
passwordjava.lang.StringPassword to get access to the private key in the certificate.

Signature(InputStream pfx, String password)

public Signature(InputStream pfx, String password)

Inititalizes new instance of the Signature class.

Parameters:

ParameterTypeDescription
pfxjava.io.InputStreamStream with certificate data organized as pfx.
passwordjava.lang.StringPassword to get access to the private key in the certificate.

getCustomAppearance()

public final SignatureCustomAppearance getCustomAppearance()

Gets/sets the custom appearance.

Returns: SignatureCustomAppearance - SignatureCustomAppearance instance

setCustomAppearance(SignatureCustomAppearance value)

public final void setCustomAppearance(SignatureCustomAppearance value)

Gets/sets the custom appearance.

Parameters:

ParameterTypeDescription
valueSignatureCustomAppearanceSignatureCustomAppearance instance

getAuthority()

public final String getAuthority()

The name of the person or authority signing the document.

Returns: java.lang.String - String value

setAuthority(String value)

public void setAuthority(String value)

Sets the name of the person or authority signing the document.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getDate()

public Date getDate()

Gets the time of signing.

Returns: Date - Date value

setDate(Date value)

public void setDate(Date value)

Set the time of signing.

Parameters:

ParameterTypeDescription
valuejava.util.DateDate object

getLocation()

public String getLocation()

Gets the CPU host name or physical location of the signing.

Returns: java.lang.String - String value

setLocation(String value)

public void setLocation(String value)

Sets the CPU host name or physical location of the signing.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getReason()

public String getReason()

Gets the reason for the signing, such as (I agreed!).

Returns: java.lang.String - String value

setReason(String value)

public void setReason(String value)

Sets the reason for the signing, such as (I agreed!).

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getContactInfo()

public String getContactInfo()

Get information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number.

Returns: java.lang.String - String value

setContactInfo(String value)

public void setContactInfo(String value)

Set information provided by the signer to enable a recipient to contact the signer to verify the signature, e.g. a phone number.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString value

getByteRange()

public int[] getByteRange()

Get array of pairs of integers (starting byte offset, length in bytes) that shall describe the exact byte range for the digest calculation.

Returns: int[] - array of int value

getTimestampSettings()

public TimestampSettings getTimestampSettings()

Gets timestamp settings.

Returns: TimestampSettings - TimestampSettings

setTimestampSettings(TimestampSettings value)

public void setTimestampSettings(TimestampSettings value)

Sets timestamp settings.

Parameters:

ParameterTypeDescription
valueTimestampSettingsTimestampSettings

getOcspSettings()

public OcspSettings getOcspSettings()

Gets/sets ocsp settings.

Returns: OcspSettings - OcspSettings instance

setOcspSettings(OcspSettings value)

public void setOcspSettings(OcspSettings value)

Gets/sets ocsp settings.

Parameters:

ParameterTypeDescription
valueOcspSettingsOcspSettings instance

getUseLtv()

public final boolean getUseLtv()

Gets/sets ltv validation flag.

Returns: boolean - boolean value

setUseLtv(boolean value)

public final void setUseLtv(boolean value)

Gets/sets ltv validation flag.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getImageInternal()

public System.IO.Stream getImageInternal()

Gets image stream.

For internal only usage

Returns: com.aspose.ms.System.IO.Stream - Stream object

setImage(InputStream _signatureAppearanceStream)

public void setImage(InputStream _signatureAppearanceStream)

Sets image stream.

Parameters:

ParameterTypeDescription
_signatureAppearanceStreamjava.io.InputStreamSteam object

setImageInternal(System.IO.Stream value)

public void setImageInternal(System.IO.Stream value)

Parameters:

ParameterTypeDescription
valuecom.aspose.ms.System.IO.Stream

getSignatureReferences()

public List<SignatureReference> getSignatureReferences()

get Signature References

Returns: java.util.List<com.aspose.pdf.engine.security.impl.signatures.SignatureReference> - java.util.List object

getCustomSignHash()

public final Signature.SignHash getCustomSignHash()

The delegate for custom sign the document hash (Beta).

Returns: SignHash - SignHash instance

setCustomSignHash(Signature.SignHash value)

public final void setCustomSignHash(Signature.SignHash value)

The delegate for custom sign the document hash (Beta).

Parameters:

ParameterTypeDescription
valueSignHashSignHash instance

verify()

public boolean verify()

Verify the document regarding this signature and return true if document is valid or otherwise false.

Returns: boolean - true if document is valid.

isShowProperties()

public boolean isShowProperties()

Force to show/hide signature properties. In case ShowProperties is true signature field has predefined format of appearance (strings to represent): ——————————————- Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason} Location: {signature.Location} ——————————————- where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default.

Returns: boolean - boolean value

setShowProperties(boolean value)

public void setShowProperties(boolean value)

Force to show/hide signature properties. In case ShowProperties is true signature field has predefined format of appearance (strings to represent): ——————————————- Digitally signed by {certificate subject} Date: {signature.Date} Reason: {signature.Reason} Location: {signature.Location} ——————————————- where {X} is placeholder for X value. Also signature can have image, in this case listed strings are placed over image. ShowProperties is true by default.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

close()

public void close()

Destructor which closes temporary streams (if necessary).