Class GITExternalGpgSigner


  • public class GITExternalGpgSigner
    extends org.eclipse.jgit.lib.GpgSigner
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean canLocateSigningKey​(java.lang.String gpgSigningKey, org.eclipse.jgit.lib.PersonIdent committer, org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
      Indicates if a signing key is available for the specified committer and/or signing key.
      void sign​(org.eclipse.jgit.lib.CommitBuilder commit, java.lang.String gpgSigningKey, org.eclipse.jgit.lib.PersonIdent committer, org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
      Signs the specified commit.
      • Methods inherited from class org.eclipse.jgit.lib.GpgSigner

        getDefault, setDefault
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GITExternalGpgSigner

        public GITExternalGpgSigner()
    • Method Detail

      • sign

        public void sign​(org.eclipse.jgit.lib.CommitBuilder commit,
                         java.lang.String gpgSigningKey,
                         org.eclipse.jgit.lib.PersonIdent committer,
                         org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
                  throws org.eclipse.jgit.api.errors.CanceledException
        Signs the specified commit.

        Implementors should obtain the payload for signing from the specified commit via CommitBuilder.build() and create a proper GpgSignature. The generated signature must be set on the specified commit (see ObjectBuilder.setGpgSignature(GpgSignature)).

        Any existing signature on the commit must be discarded prior obtaining the payload via CommitBuilder.build().

        Specified by:
        sign in class org.eclipse.jgit.lib.GpgSigner
        Parameters:
        commit - the commit to sign (must not be null and must be complete to allow proper calculation of payload)
        gpgSigningKey - the signing key to locate (passed as is to the GPG signing tool as is; eg., value of user.signingkey)
        committer - the signing identity (to help with key lookup in case signing key is not specified)
        credentialsProvider - provider to use when querying for signing key credentials (eg. passphrase)
        Throws:
        org.eclipse.jgit.api.errors.CanceledException - when signing was canceled (eg., user aborted when entering passphrase)
      • canLocateSigningKey

        public boolean canLocateSigningKey​(java.lang.String gpgSigningKey,
                                           org.eclipse.jgit.lib.PersonIdent committer,
                                           org.eclipse.jgit.transport.CredentialsProvider credentialsProvider)
                                    throws org.eclipse.jgit.api.errors.CanceledException
        Indicates if a signing key is available for the specified committer and/or signing key.
        Specified by:
        canLocateSigningKey in class org.eclipse.jgit.lib.GpgSigner
        Parameters:
        gpgSigningKey - the signing key to locate (passed as is to the GPG signing tool as is; eg., value of user.signingkey)
        committer - the signing identity (to help with key lookup in case signing key is not specified)
        credentialsProvider - provider to use when querying for signing key credentials (eg. passphrase)
        Returns:
        true if a signing key is available, false otherwise
        Throws:
        org.eclipse.jgit.api.errors.CanceledException - when signing was canceled (eg., user aborted when entering passphrase)