com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class Signature

  • Direct Known Subclasses:
    PKCS1, PKCS7, PKCS7Detached


    public abstract class Signature
    extends Object

    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.

    • Constructor Detail

      • Signature

        public Signature()

        Inititalizes new instance of the Signature class.

      • Signature

        public Signature(String pfx,
                         String password)

        Inititalizes new instance of the Signature class.

        Parameters:
        pfx - Pfx file which contains certificate for signing.
        password - Password to get access to the private key in the certificate.
      • Signature

        public Signature(InputStream pfx,
                         String password)

        Inititalizes new instance of the Signature class.

        Parameters:
        pfx - Stream with certificate data organized as pfx.
        password - Password to get access to the private key in the certificate.
    • Method Detail

      • getAuthority

        public String getAuthority()

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

        Returns:
        String value
      • setAuthority

        public void setAuthority(String value)

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

        Parameters:
        value - String value
      • getDate

        public Date getDate()

        Gets the time of signing.

        Returns:
        Date value
      • setDate

        public void setDate(Date value)

        Set the time of signing.

        Parameters:
        value - Date object
      • getLocation

        public String getLocation()

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

        Returns:
        String value
      • setLocation

        public void setLocation(String value)

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

        Parameters:
        value - String value
      • getReason

        public String getReason()

        Gets the reason for the signing, such as (I agree…).

        Returns:
        String value
      • setReason

        public void setReason(String value)

        Sets the reason for the signing, such as (I agree…).

        Parameters:
        value - String 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:
        String value
      • setContactInfo

        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:
        value - String 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:
        array of int value
      • getTimestampSettings

        public TimestampSettings getTimestampSettings()
        Gets timestamp settings.
        Returns:
        TimestampSettings
      • setTimestampSettings

        public void setTimestampSettings(TimestampSettings value)
        Sets timestamp settings.
        Parameters:
        value - TimestampSettings
      • getImageInternal

        public com.aspose.ms.System.IO.Stream getImageInternal()

        Gets image stream.

        For internal only usage
        Returns:
        Stream object
      • setImage

        public void setImage(InputStream _signatureAppearanceStream)

        Sets image stream.

        Parameters:
        _signatureAppearanceStream - Steam object
      • setImageInternal

        public void setImageInternal(com.aspose.ms.System.IO.Stream value)
      • getSignatureReferences

        public List<com.aspose.pdf.engine.security.impl.signatures.SignatureReference> getSignatureReferences()
        get Signature References
        Returns:
        java.util.List<SignatureReference> object
      • verify

        public boolean verify()

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

        Returns:
        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 value
      • setShowProperties

        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:
        value - boolean value
      • close

        public void close()

        Destructor which closes temporary streams (if necessary).