public interface KeyPasswordProvider
KeyPasswordProvider provides passwords for encrypted private keys.| Modifier and Type | Method and Description |
|---|---|
default int |
getAttempts()
Gets the maximum number of attempts to get a passphrase that should be
attempted for one identity resource through this provider.
|
char[] |
getPassphrase(URIish uri,
int attempt)
Obtains a passphrase to use to decrypt an ecrypted private key.
|
boolean |
keyLoaded(URIish uri,
int attempt,
Exception error)
Invoked after a key has been loaded.
|
void |
setAttempts(int maxNumberOfAttempts)
Define the maximum number of attempts to get a passphrase that should be
attempted for one identity resource through this provider.
|
char[] getPassphrase(URIish uri, int attempt) throws IOException
null or an empty array will skip this key. To cancel completely,
the operation should raise
CancellationException.uri - identifying the key resource that is being attempted to be
loadedattempt - the number of previous attempts to get a passphrase; >= 0IOException - if no password can be obtainedvoid setAttempts(int maxNumberOfAttempts)
maxNumberOfAttempts - number of times to ask for a passphrase;
IllegalArgumentException may be thrown if <= 0default int getAttempts()
boolean keyLoaded(URIish uri, int attempt, Exception error) throws IOException, GeneralSecurityException
error is lost unless it is attached to that exception.uri - identifying the key resource the key was attempted to be
loaded fromattempt - the number of times getPassphrase(URIish, int) had
been called; zero indicates that uri refers to a
non-encrypted keyerror - null if the key was loaded successfully; otherwise an
exception indicating why the key could not be loadedtrue to re-try again; false to re-raise the
error exception; Ignored if the key was loaded
successfully, i.e., if error == null.IOExceptionGeneralSecurityExceptionCopyright © 2019 Eclipse JGit Project. All rights reserved.