api / org.gradle.plugins.signing / Signature

Signature

open class Signature : AbstractPublishArtifact

A digital signature file artifact.

A signature file is always generated from another file, which may be a PublishArtifact.

Constructors

<init>

Signature(toSign: PublishArtifact, signatureSpec: SignatureSpec, vararg tasks: Any)

Creates a signature artifact for the given public artifact.

The file to sign will be the file of the given artifact and the classifier of this signature artifact will default to the classifier of the given artifact to sign.

The artifact to sign may change after being used as the source for this signature.

Signature(toSign: File, signatureSpec: SignatureSpec, vararg tasks: Any)

Creates a signature artifact for the given file.

Signature(toSign: File, classifier: String, signatureSpec: SignatureSpec, vararg tasks: Any)

Creates a signature artifact for the given file, with the given classifier.

Signature(toSign: Closure<File>, classifier: Closure<String>, signatureSpec: SignatureSpec, vararg tasks: Any)
Signature(toSign: Callable<File>, classifier: Callable<String>, signatureSpec: SignatureSpec, vararg tasks: Any)

Creates a signature artifact for the file returned by the toSign closure.

The closures will be “evaluated” on demand whenever the value is needed (e.g. at generation time)

Functions

generate

open fun generate(): Unit

Generates the signature file.

In order to generate the signature, the file to sign, signatory and signature type must be known (i.e. non null).

getClassifier

open fun getClassifier(): String

The classifier of the signature artifact.

Defaults to the classifier of the source artifact (if signing an artifact) or the given classifier at construction (if given).

getDate

open fun getDate(): Date

The date of the signature artifact.

Defaults to the last modified time of the signature file (if exists)

getExtension

open fun getExtension(): String

The extension of the signature artifact.

Defaults to the specified file extension of the signature type.

getFile

open fun getFile(): File

The file for the generated signature, which may not yet exist.

The file will be placed alongside the file to sign with the extension of the signature type.

getName

open fun getName(): String

The name of the signature artifact.

Defaults to the name of the signature file.

getSignatory

open fun getSignatory(): Signatory

The signatory of this signature file.

getSignatureSpec

open fun getSignatureSpec(): SignatureSpec

getSignatureType

open fun getSignatureType(): SignatureType

The file representation type of the signature.

getToSign

open fun getToSign(): File

The file that is to be signed.

getToSignArtifact

fun getToSignArtifact(): PublishArtifact

Get the artifact that this signature is for, if available.

getType

open fun getType(): String

The type of the signature artifact.

Defaults to the extension of the file to sign plus the extension of the signature type. For example, when signing the file ‘my.zip’ with a signature type with extension ‘sig’, the default type is ‘zip.sig’.

setClassifier

open fun setClassifier(classifier: String): Unit

setDate

open fun setDate(date: Date): Unit

setExtension

open fun setExtension(extension: String): Unit

setFile

open fun setFile(file: File): Unit

Set the file for the generated signature.

setName

open fun setName(name: String): Unit

setSignatureSpec

open fun setSignatureSpec(signatureSpec: SignatureSpec): Unit

setType

open fun setType(type: String): Unit