# Class PgpSignatory

java.lang.Object
org.gradle.plugins.signing.signatory.SignatorySupport
org.gradle.plugins.signing.signatory.pgp.PgpSignatory

All Implemented Interfaces:
  `Signatory`

Direct Known Subclasses:
  `PgpSignatoryInternal`

public class PgpSignatory extends SignatorySupport
PGP signatory from PGP key and password.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PgpSignatory(String name, org.bouncycastle.openpgp.PGPSecretKey secretKey, String password)`
  `PgpSignatory(String name, Provider<org.bouncycastle.openpgp.PGPSecretKey> secretKey, Provider<org.bouncycastle.openpgp.PGPPrivateKey> privateKey)`
  Creates a PGP signatory from secret and private key.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `org.bouncycastle.openpgp.PGPSignatureGenerator`
  `createSignatureGenerator()`
  `String`
  `getKeyId()`
  Returns the id of the key that will be used for signing.
  `final String`
  `getName()`
  An identifying name for this signatory.
  `void`
  `sign(InputStream toSign, OutputStream signatureDestination)`
  Exhausts `toSign`, and writes the signature to `signatureDestination`.

  ### Methods inherited from class SignatorySupport

  `sign`

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### PgpSignatory

    PgpSignatory(String name, Provider<org.bouncycastle.openpgp.PGPSecretKey> secretKey, Provider<org.bouncycastle.openpgp.PGPPrivateKey> privateKey)
    Creates a PGP signatory from secret and private key.

    Warning: the dependencies of providers aren't exposed anywhere. Consider using `PgpSignatoryFactory` to create instances of this class instead.

    Parameters:
      `name` - the name of the signatory
      `secretKey` - the secret key
      `privateKey` - the private key extracted from the secret key

  - ### PgpSignatory

    public PgpSignatory(String name, org.bouncycastle.openpgp.PGPSecretKey secretKey, String password)

- ## Method Details

  - ### getName

    public final String getName()
    Description copied from interface: `Signatory`

    An identifying name for this signatory.

    The name must be constant for the life of the signatory and should uniquely identify it within a project.

  - ### sign

    public void sign(InputStream toSign, OutputStream signatureDestination)
    Exhausts `toSign`, and writes the signature to `signatureDestination`. The caller is responsible for closing the streams, though the output WILL be flushed.
    Parameters:
      `toSign` - The source of the data to be signed
      `signatureDestination` - Where the signature will be written to

  - ### getKeyId

    public String getKeyId()
    Description copied from interface: `Signatory`
    Returns the id of the key that will be used for signing.
    Returns:
      The key id

  - ### createSignatureGenerator

    public org.bouncycastle.openpgp.PGPSignatureGenerator createSignatureGenerator()