Interface FilePasswordProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FilePasswordProvider
An "empty" provider that returnsnull
- i.e., unprotected key file -
Method Summary
Modifier and TypeMethodDescriptiongetPassword
(SessionContext session, NamedResource resourceKey, int retryIndex) handleDecodeAttemptResult
(SessionContext session, NamedResource resourceKey, int retryIndex, String password, Exception err) Invoked to inform the password provide about the decoding result.static FilePasswordProvider
-
Field Details
-
EMPTY
An "empty" provider that returnsnull
- i.e., unprotected key file
-
-
Method Details
-
getPassword
String getPassword(SessionContext session, NamedResource resourceKey, int retryIndex) throws IOException - Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey
- The resource key representing the private fileretryIndex
- The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource)- Returns:
- The password - if
null
/empty then no password is required - Throws:
IOException
- if cannot resolve password- See Also:
-
handleDecodeAttemptResult
default FilePasswordProvider.ResourceDecodeResult handleDecodeAttemptResult(SessionContext session, NamedResource resourceKey, int retryIndex, String password, Exception err) throws IOException, GeneralSecurityException Invoked to inform the password provide about the decoding result. Note: any exception thrown from this method (including if called to inform about success) will be propagated instead of the original (if any was reported)- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey
- The resource key representing the private fileretryIndex
- The zero-based index of the invocation for the specific resource (in case invoked several times for the same resource). If success report, it indicates the number of retries it took to succeedpassword
- The password that was attemptederr
- The attempt result -null
for success- Returns:
- How to proceed in case of error - ignored if invoked in order to report
success. Note:
null
is same asFilePasswordProvider.ResourceDecodeResult.TERMINATE
. - Throws:
IOException
- If cannot resolve a new passwordGeneralSecurityException
- If not attempting to resolve a new password
-
of
-