# Class SignOperation

java.lang.Object
org.gradle.plugins.signing.SignOperation

All Implemented Interfaces:
  `SignatureSpec`

public abstract class SignOperation extends Object implements SignatureSpec
A sign operation creates digital signatures for one or more files.

The external representation of the signature is specified by `getSignatureType()`, while the `getSignatory()` specifies how to sign. The `sign` methods are used to register files to generate signatures for. The `execute()` method generates the signatures for all the registered items at that time.

Since:
  1.0

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SignOperation()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SignOperation`
  `configure(Closure closure)`
  Executes the given closure against this object.
  `SignOperation`
  `execute()`
  Generates actual signature files for all of the registered signatures.
  `String`
  `getDisplayName()`
  Returns the display name.
  `FileCollection`
  `getFilesToSign()`
  All of the files that will be signed by this operation.
  `Signatory`
  `getSignatory()`
  The signatory that will be performing the signing.
  `FileCollection`
  `getSignatureFiles()`
  All of the signature files that will be generated by this operation.
  `List<Signature>`
  `getSignatures()`
  Deprecated.
  This method will be removed in Gradle 10.
  `SignatureType`
  `getSignatureType()`
  The signature representation that will be created.
  `Signature`
  `getSingleSignature()`
  Deprecated.
  This method will be removed in Gradle 10.
  `boolean`
  `isRequired()`
  Whether or not it is required that this signature be generated.
  `void`
  `setRequired(boolean required)`
  Whether or not it is required that this signature be generated.
  `void`
  `setSignatory(Signatory signatory)`
  Sets the signatory that will be signing the input.
  `void`
  `setSignatureType(SignatureType signatureType)`
  Sets the signature representation that the signatures will be produced as.
  `SignOperation`
  `sign(File... files)`
  Registers signatures for the given files.
  `SignOperation`
  `sign(String ignoredClassifier, File... files)`
  Deprecated.
  This method will be removed in Gradle 10.
  `SignOperation`
  `sign(PublishArtifact... artifacts)`
  Registers signatures for the given artifacts.
  `SignOperation`
  `signatory(Signatory signatory)`
  Change the signatory for signature generation.
  `SignOperation`
  `signatureType(SignatureType type)`
  Change the signature type for signature generation.
  `protected abstract FileCollection`
  `toFileCollection(List<File> files)`
  To file collection.
  `String`
  `toString()`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### SignOperation

    public SignOperation()

- ## Method Details

  - ### getDisplayName

    public String getDisplayName()
    Returns the display name.
    Since:
      1.0

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### setSignatureType

    public void setSignatureType(SignatureType signatureType)
    Description copied from interface: `SignatureSpec`
    Sets the signature representation that the signatures will be produced as.
    Specified by:
      `setSignatureType` in interface `SignatureSpec`
    Parameters:
      `signatureType` - the signature type to use

  - ### getSignatureType

    public SignatureType getSignatureType()
    Description copied from interface: `SignatureSpec`
    The signature representation that will be created.
    Specified by:
      `getSignatureType` in interface `SignatureSpec`
    Returns:
      the signature type, or `null` if none specified.

  - ### setSignatory

    public void setSignatory(Signatory signatory)
    Description copied from interface: `SignatureSpec`
    Sets the signatory that will be signing the input.
    Specified by:
      `setSignatory` in interface `SignatureSpec`
    Parameters:
      `signatory` - The signatory

  - ### getSignatory

    public Signatory getSignatory()
    Description copied from interface: `SignatureSpec`
    The signatory that will be performing the signing.
    Specified by:
      `getSignatory` in interface `SignatureSpec`
    Returns:
      the signatory, or `null` if none specified.

  - ### setRequired

    public void setRequired(boolean required)
    Description copied from interface: `SignatureSpec`
    Whether or not it is required that this signature be generated.
    Specified by:
      `setRequired` in interface `SignatureSpec`
    Parameters:
      `required` - Whether or not it is required that this signature be generated.
    See Also:
      - `SignatureSpec.isRequired()`

  - ### isRequired

    public boolean isRequired()
    Description copied from interface: `SignatureSpec`
    Whether or not it is required that this signature be generated. A signature may not be able to be generated if a signatory and/or a signature type have not been specified. If it is required and cannot be generated, an exception will be thrown. Otherwise, it will not be generated.
    Specified by:
      `isRequired` in interface `SignatureSpec`
    Returns:
      Whether or not it is required that this signature be generated.

  - ### sign

    public SignOperation sign(PublishArtifact... artifacts)
    Registers signatures for the given artifacts.
    Returns:
      this
    Since:
      1.0

  - ### sign

    public SignOperation sign(File... files)
    Registers signatures for the given files.
    Returns:
      this
    Since:
      1.0

  - ### sign

    @Deprecated public SignOperation sign(String ignoredClassifier, File... files)
    Deprecated.
    This method will be removed in Gradle 10. Use `sign(File...)` instead.
    Registers signatures (with the given classifier) for the given files
    Returns:
      this
    Since:
      1.0

  - ### signatureType

    public SignOperation signatureType(SignatureType type)
    Change the signature type for signature generation.
    Since:
      1.0

  - ### signatory

    public SignOperation signatory(Signatory signatory)
    Change the signatory for signature generation.
    Since:
      1.0

  - ### configure

    public SignOperation configure(Closure closure)
    Executes the given closure against this object.
    Since:
      1.0

  - ### execute

    public SignOperation execute()
    Generates actual signature files for all of the registered signatures.

    The signatures are generated with the configuration they have at this time, which includes the signature type and signatory of this operation at this time.

    This method can be called multiple times, with the signatures being generated with their current configuration each time.

    Returns:
      this
    Since:
      1.0

  - ### getSignatures

    @Deprecated public List<Signature> getSignatures()
    Deprecated.
    This method will be removed in Gradle 10. Use `getFilesToSign()` or `getSignatureFiles()` instead.
    The registered signatures.
    Since:
      1.0

  - ### getSingleSignature

    @Deprecated public Signature getSingleSignature()
    Deprecated.
    This method will be removed in Gradle 10. Use `getFilesToSign()` or `getSignatureFiles()` instead.
    Returns the single registered signature.
    Returns:
      The signature.
    Throws:
      `IllegalStateException` - if there is not exactly one registered signature.
    Since:
      1.0

  - ### getFilesToSign

    public FileCollection getFilesToSign()
    All of the files that will be signed by this operation.
    Since:
      1.0

  - ### getSignatureFiles

    public FileCollection getSignatureFiles()
    All of the signature files that will be generated by this operation.
    Since:
      1.0

  - ### toFileCollection

    protected abstract FileCollection toFileCollection(List<File> files)
    To file collection.
    Since:
      6.3