Class CmdLinePasswordProvider

  • All Implemented Interfaces:
    CryptoProvider, PasswordProvider

    public class CmdLinePasswordProvider
    extends java.lang.Object
    implements PasswordProvider
    A PasswordProvider that supplies passwords to decrypt files via the java jvm invocation.

    Example:

    java -Dfilesystem.passwords=/fullpath/to/textfile

    The password file is a plain text tabbed-csv file, where each line specifies a password and an optional file identifier.

    Example file contents, where each line is divided into fields by a tab character where the first field is the password and the second optional field is the file's identifying information (name, path, etc):

     password1   [tab]   myfirstzipfile.zip ← supplies a password for the named file located in any directory
     someOtherPassword   [tab]   /full/path/tozipfile.zip ← supplies password for file at specified location 
     anotherPassword [tab]   file:///full/path/tozipfile.zip|zip:///subdir/in/zip/somefile.txt ← supplies password for file embedded inside a zip
     yetAnotherPassword ← a password to try for any file that needs a password
     
    • Field Detail

      • CMDLINE_PASSWORD_PROVIDER_PROPERTY_NAME

        public static final java.lang.String CMDLINE_PASSWORD_PROVIDER_PROPERTY_NAME
        See Also:
        Constant Field Values
    • Constructor Detail

      • CmdLinePasswordProvider

        public CmdLinePasswordProvider()
    • Method Detail

      • getPasswordsFor

        public java.util.Iterator<PasswordValue> getPasswordsFor​(FSRL fsrl,
                                                                 java.lang.String prompt,
                                                                 CryptoProvider.Session session)
        Description copied from interface: PasswordProvider
        Returns a sequence of passwords (ordered by quality) that may apply to the specified file.
        Specified by:
        getPasswordsFor in interface PasswordProvider
        Parameters:
        fsrl - FSRL path to the password protected file
        prompt - optional prompt that may be displayed to a user
        session - a place to hold state values that persist across related queries
        Returns:
        Iterator of possible passwords