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 TypeMethodDescriptionvoidclear()Clears any cached passphrasevoidclose()private URIishchar[]getPassphrase(byte[] keyFingerprint, Path keyLocation) Prompts use for a passphrase unless one was cached from a previous prompt.booleanDetermines 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:
closein 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.PGPExceptionCanceledException- in case passphrase was not entered by userURISyntaxExceptionUnsupportedCredentialItem
-
hasPassphrase
public boolean hasPassphrase()Determines whether a passphrase was already obtained.- Returns:
trueif a passphrase is already set,falseotherwise
-