Package ghidra.formats.gfilesystem.crypto

# Interface CryptoSession

All Superinterfaces:
  `AutoCloseable`, `Closeable`

All Known Implementing Classes:
  `CryptoProviderSessionChildImpl`

public interface CryptoSession extends Closeable
Provides the caller with the ability to perform crypto querying operations for a group of related files.

Typically used to query passwords and to add known good passwords to caches for later re-retrieval.

Closing a CryptoSession instance does not invalidate the instance, instead is is a suggestion that the instance should not be used for any further nested sessions.

See `CryptoProviders.newSession()`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addSuccessfulPassword(FSRL fsrl, Password password)`
  Pushes a known good password into a cache for later re-retrieval.
  `void`
  `close()`
  Closes this session.
  `Iterator<Password>`
  `getPasswordsFor(FSRL fsrl, String prompt)`
  Returns a sequence of passwords (sorted by quality) that may apply to the specified file.
  `boolean`
  `isClosed()`
  Returns true if this session has been closed.

- ## Method Details

  - ### getPasswordsFor

    Iterator<Password> getPasswordsFor(FSRL fsrl, String prompt)
    Returns a sequence of passwords (sorted by quality) that may apply to the specified file.
    Parameters:
      `fsrl` - `FSRL` path to the password protected file
      `prompt` - optional prompt that may be displayed to a user
    Returns:
      `Iterator` of possible passwords

  - ### addSuccessfulPassword

    void addSuccessfulPassword(FSRL fsrl, Password password)
    Pushes a known good password into a cache for later re-retrieval.
    Parameters:
      `fsrl` - `FSRL` path to the file that was unlocked by the password
      `password` - the good password

  - ### isClosed

    boolean isClosed()
    Returns true if this session has been closed.
    Returns:
      boolean true if closed

  - ### close

    void close()
    Closes this session.
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`