Package org.eclipse.jgit.gpg.bc.internal
Class BouncyCastleGpgSigner
- java.lang.Object
-
- org.eclipse.jgit.lib.GpgSigner
-
- org.eclipse.jgit.gpg.bc.internal.BouncyCastleGpgSigner
-
public class BouncyCastleGpgSigner extends GpgSigner
GPG Signer using BouncyCastle library
-
-
Constructor Summary
Constructors Constructor Description BouncyCastleGpgSigner()Create a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanLocateSigningKey(java.lang.String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider)Indicates if a signing key is available for the specified committer and/or signing key.private java.lang.StringextractSignerId(java.lang.String pgpUserId)private BouncyCastleGpgKeylocateSigningKey(java.lang.String gpgSigningKey, PersonIdent committer, BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt)private static voidregisterBouncyCastleProviderIfNecessary()voidsign(CommitBuilder commit, java.lang.String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider)Signs the specified commit.-
Methods inherited from class org.eclipse.jgit.lib.GpgSigner
getDefault, setDefault
-
-
-
-
Method Detail
-
registerBouncyCastleProviderIfNecessary
private static void registerBouncyCastleProviderIfNecessary()
-
canLocateSigningKey
public boolean canLocateSigningKey(@Nullable java.lang.String gpgSigningKey, PersonIdent committer, CredentialsProvider credentialsProvider) throws CanceledException
Description copied from class:GpgSignerIndicates if a signing key is available for the specified committer and/or signing key.- Specified by:
canLocateSigningKeyin classGpgSigner- Parameters:
gpgSigningKey- the signing key to locate (passed as is to the GPG signing tool as is; eg., value ofuser.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:
trueif a signing key is available,falseotherwise- Throws:
CanceledException- when signing was canceled (eg., user aborted when entering passphrase)
-
locateSigningKey
private BouncyCastleGpgKey locateSigningKey(@Nullable java.lang.String gpgSigningKey, PersonIdent committer, BouncyCastleGpgKeyPassphrasePrompt passphrasePrompt) throws CanceledException, UnsupportedCredentialItem, java.io.IOException, java.security.NoSuchAlgorithmException, java.security.NoSuchProviderException, org.bouncycastle.openpgp.PGPException, java.net.URISyntaxException
- Throws:
CanceledExceptionUnsupportedCredentialItemjava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.NoSuchProviderExceptionorg.bouncycastle.openpgp.PGPExceptionjava.net.URISyntaxException
-
sign
public void sign(@NonNull CommitBuilder commit, @Nullable java.lang.String gpgSigningKey, @NonNull PersonIdent committer, CredentialsProvider credentialsProvider) throws CanceledException
Description copied from class:GpgSignerSigns the specified commit.Implementors should obtain the payload for signing from the specified commit via
CommitBuilder.build()and create a properGpgSignature. The generated signature must be set on the specifiedcommit(seeCommitBuilder.setGpgSignature(GpgSignature)).Any existing signature on the commit must be discarded prior obtaining the payload via
CommitBuilder.build().- Specified by:
signin classGpgSigner- Parameters:
commit- the commit to sign (must not benulland 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 ofuser.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:
CanceledException- when signing was canceled (eg., user aborted when entering passphrase)
-
extractSignerId
private java.lang.String extractSignerId(java.lang.String pgpUserId)
-
-