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.

    @FunctionalInterface
    public interface FilePasswordProvider
    Author:
    Apache MINA SSHD Project
    • Field Detail

      • EMPTY

        static final FilePasswordProvider EMPTY
        An "empty" provider that returns null - i.e., unprotected key file
    • Method Detail

      • 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 - The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
        resourceKey - The resource key representing the private file
        retryIndex - 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 succeed
        password - The password that was attempted
        err - 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 as FilePasswordProvider.ResourceDecodeResult.TERMINATE.
        Throws:
        IOException - If cannot resolve a new password
        GeneralSecurityException - If not attempting to resolve a new password