com.aspose.words
Class DigitalSignatureUtil

java.lang.Object
    extended by com.aspose.words.DigitalSignatureUtil

public abstract class DigitalSignatureUtil 
extends java.lang.Object

Provides methods for signing document.

Since digital signature works with file content rather than Document Object Model these methods are put into a separate class.

Supported formats are #Error Cref: F:Aspose.FileFormat.Doc and #Error Cref: F:Aspose.FileFormat.Docx.


Method Summary
static DigitalSignatureCollectionloadSignatures(java.lang.String fileName)
           Loads digital signatures from document.
static voidremoveAllSignatures(java.lang.String srcFileName, java.lang.String dstFileName)
           Removes all digital signatures from source file and writes unsigned file to destination file.
static voidsign(java.lang.String srcFileName, java.lang.String dstFileName, CertificateHolder certHolder)
           Signs source document using given CertificateHolder with digital signature and writes signed document to destination file.

Document should be either LoadFormat.DOC or LoadFormat.DOCX.

static voidsign(java.lang.String srcFileName, java.lang.String dstFileName, CertificateHolder certHolder, SignOptions signOptions)
           Signs source document using given CertificateHolder and SignOptions with digital signature and writes signed document to destination file.

Document should be either LoadFormat.DOC or LoadFormat.DOCX.

 

Method Detail

loadSignatures

public static DigitalSignatureCollection loadSignatures(java.lang.String fileName)
                                                     throws java.lang.Exception
Loads digital signatures from document.
Parameters:
fileName - Path to the document.
Returns:
Collection of digital signatures. Returns empty collection if file is not signed.

removeAllSignatures

public static void removeAllSignatures(java.lang.String srcFileName, java.lang.String dstFileName)
                                    throws java.lang.Exception
Removes all digital signatures from source file and writes unsigned file to destination file.

sign

public static void sign(java.lang.String srcFileName, java.lang.String dstFileName, CertificateHolder certHolder)
                     throws java.lang.Exception
Signs source document using given CertificateHolder with digital signature and writes signed document to destination file.

Document should be either LoadFormat.DOC or LoadFormat.DOCX.

Parameters:
srcFileName - The file name of the document to sign.
dstFileName - The file name of the signed document output.
certHolder - CertificateHolder object with certificate that used to sign file.

sign

public static void sign(java.lang.String srcFileName, java.lang.String dstFileName, CertificateHolder certHolder, SignOptions signOptions)
                     throws java.lang.Exception
Signs source document using given CertificateHolder and SignOptions with digital signature and writes signed document to destination file.

Document should be either LoadFormat.DOC or LoadFormat.DOCX.

Parameters:
srcFileName - The file name of the document to sign.
dstFileName - The file name of the signed document output.
certHolder - CertificateHolder object with certificate that used to sign file.
signOptions - SignOptions object with various signing options.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.