[]
        
(Showing Draft Content)

ISignature

Interface ISignature


public interface ISignature
Corresponds to a digital signature that is attached to a document.

An ISignature represents either a visible signature line in a worksheet or a non-visible signature attached to a workbook. Use this interface to configure signature line information, inspect signature details, validate whether a document has been signed successfully, and remove or countersign an existing signature.


 ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
 ISignatureSetup setup = signature.getSetup();
 setup.setSuggestedSigner("Shinzo Nagama");
 setup.setSigningInstructions("Please check the content before signing.");
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    countersign(KeyStore certificate, String certificatePassword)
    Countersign the signature line, if the signature has been signed.
    void
    Deletes the signature.
    boolean
    Gets a Boolean value indicating whether the user can set properties of the ISignature object.
    Gets information about a signature.
    boolean
    Gets a value indicating whether this is a signature line.
    boolean
    Gets a Boolean value indicating whether the document was signed successfully.
    boolean
    Determines if the digital signature that corresponds to the ISignature object is a valid signature.
    Returns the parent object of this signature.
    Gets an ISignatureSetup object used to access various properties of a signature packet.
    Gets the IShape object associated with an ISignature object that is a signature line.
    Returns an Object representing the date and time that the digital certificate corresponding to the ISignature object was attached to the document.
    void
    sign(KeyStore certificate, String certificatePassword, SignatureDetails details)
    Creates a signature packet for a non-visible signature.
    void
    sign(KeyStore certificate, String certificatePassword, InputStream signatureImage, SignatureDetails details)
    Creates a signature packet for visible signature line.
    void
    sign(KeyStore certificate, String certificatePassword, String signatureText, SignatureDetails details)
    Creates a signature packet for visible signature line.
  • Method Details

    • getCanSetup

      boolean getCanSetup()
      Gets a Boolean value indicating whether the user can set properties of the ISignature object. Read-only.

      This value can be checked before working with the setup information returned by getSetup().

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       boolean canSetup = signature.getCanSetup();
       ISignatureSetup setup = canSetup ? signature.getSetup() : null;
       
      Returns:
      true if the user can set properties of the ISignature object; otherwise, false.
    • getDetails

      Gets information about a signature. Read-only.

      Use this method to read the persisted signature metadata associated with this ISignature, such as the signature text, image, and certificate information exposed by IReadOnlySignatureDetails.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       IReadOnlySignatureDetails details = signature.getDetails();
       String signatureText = details != null ? details.getSignatureText() : null;
       
      Returns:
      The read-only signature details, or null if this signature does not contain stored signature details.
    • getIsSignatureLine

      boolean getIsSignatureLine()
      Gets a value indicating whether this is a signature line. Read-only.

      Use this property to distinguish a visible signature line added by ISignatureSet.addSignatureLine(IWorksheet,double,double) from a non-visible signature created by ISignatureSet.addNonVisibleSignature().

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       boolean isSignatureLine = signature.getIsSignatureLine();
       
      Returns:
      true if this ISignature represents a signature line; otherwise, false.
    • getIsSigned

      boolean getIsSigned()
      Gets a Boolean value indicating whether the document was signed successfully. Read-only.

      Use this property to determine whether the ISignature currently has a completed digital signature. To determine whether an existing signature is valid, use getIsValid().

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       boolean isSigned = signature.getIsSigned();
       
      Returns:
      true if the document was signed successfully; otherwise, false.
    • getIsValid

      boolean getIsValid()
      Determines if the digital signature that corresponds to the ISignature object is a valid signature.

      This value is true only when the signature has been signed and the signature is considered valid for the current workbook.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       boolean isValid = signature.getIsValid();
       
      Returns:
      true if the digital signature corresponding to this ISignature is valid; otherwise, false.
    • getParent

      ISignatureSet getParent()
      Returns the parent object of this signature.

      The returned parent is the ISignatureSet that contains this signature.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       ISignatureSet parent = signature.getParent();
       int count = parent.getCount();
       
      Returns:
      The ISignatureSet that contains this signature.
    • getSetup

      ISignatureSetup getSetup()
      Gets an ISignatureSetup object used to access various properties of a signature packet. Read-only.

      Use the returned object to configure signature line information such as the suggested signer, signing instructions, comment permission, and whether the signing date is displayed.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       ISignatureSetup setup = signature.getSetup();
       setup.setSuggestedSigner("Test User");
       setup.setSigningInstructions("Review the workbook before signing.");
       
      Returns:
      The ISignatureSetup object for the signature packet.
    • getSignatureLineShape

      IShape getSignatureLineShape()
      Gets the IShape object associated with an ISignature object that is a signature line.

      Use this method when you need to work with the signature line as a shape, for example to move, copy, or delete the visible signature line. This property is read-only.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       IShape shape = signature.getSignatureLineShape();
       shape.setTop(shape.getTop() + 20);
       
      Returns:
      The shape object associated with the signature line.
    • getSignDate

      Calendar getSignDate()
      Returns an Object representing the date and time that the digital certificate corresponding to the ISignature object was attached to the document.

      This method returns the signing date for the current digital signature.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       Calendar signDate = signature.getSignDate();
       
      Returns:
      A Calendar that represents the date and time when the digital certificate corresponding to the ISignature object was attached to the document.
    • delete

      void delete()
      Deletes the signature.

      Use this method to remove the current signature from its parent ISignatureSet. For a visible signature line, deleting the signature removes that signature entry from the workbook. In digital signature only mode, this method can be used to remove the digital signature from a signed signature line or to remove a non-visible signature.

      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       signature.getSetup().setSuggestedSigner("Kenji Tenzai");
       signature.delete();
       
      Throws:
      IllegalStateException - if the workbook is opened in digital signature only mode and the current signature is an unsigned visible signature line.
    • sign

      void sign(KeyStore certificate, String certificatePassword, InputStream signatureImage, SignatureDetails details)
      Creates a signature packet for visible signature line.
      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       KeyStore certificate = getSigningCertificate();
       String certificatePassword = getCertificatePasswordFromSecureSource();
       InputStream signatureImage = getSignatureImageStream();
       SignatureDetails details = new SignatureDetails();
       details.setSignatureComments("Approved for release");
       signature.sign(certificate, certificatePassword, signatureImage, details);
       
      Parameters:
      certificate - The certificate that will be used to sign the workbook.
      certificatePassword - The password that is used to open the certificate.
      signatureImage - The signature image of the signature line.
      details - The signature detail of the signature.
      Throws:
      IllegalStateException - Attempted to sign a non-visible signature
    • sign

      void sign(KeyStore certificate, String certificatePassword, String signatureText, SignatureDetails details)
      Creates a signature packet for visible signature line.
      
       ISignature signature = workbook.getSignatures().addSignatureLine(worksheet, 100.0, 50.0);
       KeyStore certificate = getSigningCertificate();
       String certificatePassword = getCertificatePasswordFromSecureSource();
       SignatureDetails details = new SignatureDetails();
       details.setSignatureComments("Approved for release");
       signature.sign(certificate, certificatePassword, "Approved by QA", details);
       
      Parameters:
      certificate - The certificate that will be used to sign the workbook.
      certificatePassword - The password that is used to open the certificate.
      signatureText - The signature text of the signature line.
      details - The signature detail of the signature.
      Throws:
      IllegalStateException - Attempted to sign a non-visible signature
    • sign

      void sign(KeyStore certificate, String certificatePassword, SignatureDetails details)
      Creates a signature packet for a non-visible signature.
      
       ISignature signature = workbook.getSignatures().addNonVisibleSignature();
       KeyStore certificate = getSigningCertificate();
       String certificatePassword = getCertificatePasswordFromSecureSource();
       SignatureDetails details = new SignatureDetails();
       details.setSignatureComments("Approved for release");
       signature.sign(certificate, certificatePassword, details);
       
      Parameters:
      certificate - The certificate that will be used to sign the workbook.
      certificatePassword - The password that is used to open the certificate.
      details - The signature detail of the signature.
      Throws:
      IllegalStateException - Attempted to sign a visible signature line
    • countersign

      void countersign(KeyStore certificate, String certificatePassword)
      Countersign the signature line, if the signature has been signed.
      
       workbook.open(getSignedWorkbookStream());
       ISignature signature = workbook.getSignatures().get(0);
       KeyStore certificate = getSigningCertificate();
       String certificatePassword = getCertificatePasswordFromSecureSource();
       signature.countersign(certificate, certificatePassword);
       
      Parameters:
      certificate - The certificate that will be used to countersign the workbook.
      certificatePassword - The password that is used to open the certificate.
      Throws:
      IllegalStateException - The signature has not been signed.