Removing Digital Signatures

Digital signatures must be removed from a signature field before a newer digital signature can be applied. A digital signature cannot be overwritten. If you attempt to apply a digital signature to a signature field that contains a signature, an exception occurs.

Note: For more information about the Signature service, see Services Reference for LiveCycle .

Summary of steps

To remove a digital signature from a signature field, perform the following tasks:

  1. Include project files.

  2. Create a Signature client.

  3. Get the PDF document that contains a signature to remove.

  4. Remove the digital signature from the signature field.

  5. Save the PDF document as a PDF file.

Include project files

Include necessary files into your development project. If you are creating a client application using Java, then include the necessary JAR files. If you are using web services, then make sure that you include the proxy files.

The following JAR files must be added to your project’s classpath:

  • adobe-livecycle-client.jar

  • adobe-usermanager-client.jar

  • adobe-signatures-client.jar

  • adobe-utilities.jar (required if LiveCycle is deployed on JBoss)

  • jbossall-client.jar (required if LiveCycle is deployed on JBoss)

For information about the location of these JAR files, see Including LiveCycle Java library files .

Create a Signature client

Before you can programmatically perform a Signature service operation, you must create a Signature service client.

Get the PDF document that contains a signature to remove

To remove a signature from a PDF document, you must obtain a PDF document that contains a signature.

Remove the digital signature from the signature field

To successfully remove a digital signature from a PDF document, you must specify the name of the signature field that contains the digital signature. Also, you must have permission to remove the digital signature; otherwise, an exception occurs.

Save the PDF document as a PDF file

After the Signature service removes a digital signature from a signature field, you can save the PDF document as a PDF file so that users can open it in Acrobat or Adobe Reader.

Remove digital signatures using the Java API

Remove a digital signature by using the Signature API (Java):

  1. Include project files

    Include client JAR files, such as adobe-signatures-client.jar, in your Java project’s class path.

  2. Create a Signature client

    • Create a ServiceClientFactory object that contains connection properties.

    • Create a SignatureServiceClient object by using its constructor and passing the ServiceClientFactory object.

  3. Get the PDF document that contains a signature to remove

    • Create a java.io.FileInputStream object that represents the PDF document that contains the signature to remove by using its constructor and passing a string value that specifies the location of the PDF document.

    • Create a com.adobe.idp.Document object by using its constructor and passing the java.io.FileInputStream object.

  4. Remove the digital signature from the signature field

    Remove a digital signature from a signature field by invoking the SignatureServiceClient object’s clearSignatureField method and passing the following values:

    • A com.adobe.idp.Document object that represents the PDF document that contains the signature to remove.

    • A string value that specifies the name of the signature field that contains the digital signature.

    The clearSignatureField method returns a com.adobe.idp.Document object that represents the PDF document from which the digital signature was removed.

  5. Save the PDF document as a PDF file

    • Create a java.io.File object and ensure that the file extension is .pdf.

    • Invoke the com.adobe.idp.Document object’s copyToFile method. Pass the java.io.File object to copy the contents of the com.adobe.idp.Document object to the file. Ensure that you use the Document object that was returned by the clearSignatureField method.

Remove digital signatures using the web service API

Remove a digital signature by using the Signature API (web service):

  1. Include project files

    Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition: http://localhost:8080/soap/services/SignatureService?WSDL&lc_version=9.0.1 .

    Note: Replace localhost with the IP address of the server hosting LiveCycle.
  2. Create a Signature client

    • Create a SignatureServiceClient object by using its default constructor.

    • Create a SignatureServiceClient.Endpoint.Address object by using the System.ServiceModel.EndpointAddress constructor. Pass a string value that specifies the WSDL to the LiveCycle service (for example, http://localhost:8080/soap/services/SignatureService?WSDL ). You do not need to use the lc_version attribute. This attribute is used when you create a service reference.)

    • Create a System.ServiceModel.BasicHttpBinding object by getting the value of the SignatureServiceClient.Endpoint.Binding field. Cast the return value to BasicHttpBinding .

    • Set the System.ServiceModel.BasicHttpBinding object’s MessageEncoding field to WSMessageEncoding.Mtom . This value ensures that MTOM is used.

    • Enable basic HTTP authentication by performing the following tasks:

      • Assign the AEM forms user name to the field SignatureServiceClient.ClientCredentials.UserName.UserName .

      • Assign the corresponding password value to the field SignatureServiceClient.ClientCredentials.UserName.Password .

      • Assign the constant value HttpClientCredentialType.Basic to the field BasicHttpBindingSecurity.Transport.ClientCredentialType .

      • Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly to the field BasicHttpBindingSecurity.Security.Mode .

  3. Get the PDF document that contains a signature to remove

    • Create a BLOB object by using its constructor. The BLOB object is used to store a PDF document that contains a digital signature to remove.

    • Create a System.IO.FileStream object by invoking its constructor and passing a string value that represents the file location of the signed PDF document and the mode in which to open the file.

    • Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property.

    • Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method. Pass the byte array, the starting position, and the stream length to read.

    • Populate the BLOB object by assigning its MTOM property with the contents of the byte array.

  4. Remove the digital signature from the signature field

    Remove the digital signature by invoking the SignatureServiceClient object’s clearSignatureField method and passing the following values:

    • A BLOB object that contains the signed PDF document.

    • A string value that represents the name of the signature field that contains the digital signature to remove.

    The clearSignatureField method returns a BLOB object that represents the PDF document from which the digital signature was removed.

  5. Save the PDF document as a PDF file

    • Create a System.IO.FileStream object by invoking its constructor and passing a string value that represents the file location of the PDF document that contains an empty signature field and the mode in which to open the file.

    • Create a byte array that stores the content of the BLOB object that was returned by the sign method. Populate the byte array by getting the value of the BLOB object’s MTOM data member.

    • Create a System.IO.BinaryWriter object by invoking its constructor and passing the System.IO.FileStream object.

    • Write the contents of the byte array to the PDF file by invoking the System.IO.BinaryWriter object’s Write method and passing the byte array.

See also

Removing Digital Signatures

Quick Start (MTOM): Removing a digital signature using the web service API

Quick Start (SwaRef): Removing a digital signature using the web service API

Invoking LiveCycle using MTOM

Invoking LiveCycle using SwaRef

// Ethnio survey code removed