Package org.eclipse.jgit.gpg.bc.internal
Class BouncyCastleGpgKeyPassphrasePrompt
java.lang.Object
org.eclipse.jgit.gpg.bc.internal.BouncyCastleGpgKeyPassphrasePrompt
- All Implemented Interfaces:
AutoCloseable
Prompts for a passphrase and caches it until
cleared
.
Implements AutoCloseable
so it can be used within a
try-with-resources block.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears any cached passphrasevoid
close()
private URIish
char[]
getPassphrase
(byte[] keyFingerprint, Path keyLocation) Prompts use for a passphrase unless one was cached from a previous prompt.boolean
Determines whether a passphrase was already obtained.
-
Field Details
-
passphrase
-
credentialsProvider
-
-
Constructor Details
-
BouncyCastleGpgKeyPassphrasePrompt
-
-
Method Details
-
clear
public void clear()Clears any cached passphrase -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
createURI
- Throws:
URISyntaxException
-
getPassphrase
public char[] getPassphrase(byte[] keyFingerprint, Path keyLocation) throws org.bouncycastle.openpgp.PGPException, CanceledException, UnsupportedCredentialItem, URISyntaxException Prompts use for a passphrase unless one was cached from a previous prompt.- Parameters:
keyFingerprint
- the fingerprint to show to the user during promptingkeyLocation
- the location the key was loaded from- Returns:
- the passphrase (maybe
null
) - Throws:
org.bouncycastle.openpgp.PGPException
CanceledException
- in case passphrase was not entered by userURISyntaxException
UnsupportedCredentialItem
-
hasPassphrase
public boolean hasPassphrase()Determines whether a passphrase was already obtained.- Returns:
true
if a passphrase is already set,false
otherwise
-