Interface SOSecureFS

All Known Implementing Classes:
DefaultSecureFS

public interface SOSecureFS
This interface specifies the basis for implementing a class allowing proprietary encrypted files, stored in a secure container, to be accessed by SOLib.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    This class defines the attributes associated with the decrypted file.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    closeFile(Object handle)
    This method closes an open file within the secure container.
    boolean
    copyFile(String src, String dst)
    This method copies a file to a new location within the secure container..

    Both source and destination file paths will reside within the secure container and be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    This method creates a directory, and all non-existent directories in the supplied path, within the secure container.

    The path will be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    This method creates a file within the secure container.

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    This method deletes a file from within the secure container..

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    This method tests for the existence of a file within the secure container.

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    This method returns the relevant attributes of the file located at the supplied path.
    This method opens an existing file, in the secure container, for reading.

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    This method opens an existing file, in the secure container, for updating.

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    This method opens an existing file, in the secure container, for writing.

    The file path will be constructed using the secure container identifier used in isSecurePath(String).
    long
    This method obtains the length of a file within the secure container.
    long
    This method obtains the offset, from the start of the file , of the file pointer.
    Return the physical root of the secure container.
    Return the 'tag' to indicate the file is suitable for decryption.
    This method returns the directory to be used to store temporary files created during file translation/saving.

    This directory must reside within the secure container as identified in isSecurePath(String).
    boolean
    This method determines whether the supplied file path resides within the secure container.

    The path may be a pseudo path on which a mapping can be performed to access the actual file.
    int
    readFromFile(Object handle, byte[] buf)
    This method reads data from a file located within the secure container.
    boolean
    This method recursively deletes the supplied directory, and it's sub-directories, located within the secure container.

    The path will be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    This method renames a file within the secure container.

    Both source and destination file paths will reside within the secure container and be constructed using the secure container identifier used in isSecurePath(String).
    boolean
    seekToFileOffset(Object handle, long ofset)
    This method moves the file pointer to the requested offset from 0.
    boolean
    setFileLength(Object handle, long length)
    This method sets the file length of a file located within the secure container.
    boolean
    syncFile(Object handle)
    This method forces buffered data to be written to the underlying device.
    int
    writeToFile(Object handle, byte[] buf)
    This method writes data to a file located within the secure container.
  • Method Details

    • isSecurePath

      boolean isSecurePath(String path)
      This method determines whether the supplied file path resides within the secure container.

      The path may be a pseudo path on which a mapping can be performed to access the actual file. For example "/SECURE/filename".
      Parameters:
      path - The file path to be analysed.
      Returns:
      True if the file resides within the secure container.
      False otherwise.
    • getTempPath

      String getTempPath()
      This method returns the directory to be used to store temporary files created during file translation/saving.

      This directory must reside within the secure container as identified in isSecurePath(String).
      Returns:
      The (pseudo) path to the temporary directory.
    • getFileAttributes

      SOSecureFS.FileAttributes getFileAttributes(String path)
      This method returns the relevant attributes of the file located at the supplied path. The path will reference a file within the secure container.

      The attributes should refer to the properties of the decrypted file.

      The (pseudo) path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to obtain attributes for.
      Returns:
      A reference to a SOSecureFS.FileAttributes object.
      null on error.
    • renameFile

      boolean renameFile(String src, String dst)
      This method renames a file within the secure container.

      Both source and destination file paths will reside within the secure container and be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      src - The path to the file to be renamed.
      dst - The path to the destination file.
      Returns:
      True on success. False on failure.
    • copyFile

      boolean copyFile(String src, String dst)
      This method copies a file to a new location within the secure container..

      Both source and destination file paths will reside within the secure container and be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      src - The path to the file to be copied.
      dst - The path to the destination file.
      Returns:
      True on success. False on failure.
    • deleteFile

      boolean deleteFile(String path)
      This method deletes a file from within the secure container..

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be deleted.
      Returns:
      True on success. False on failure.
    • fileExists

      boolean fileExists(String path)
      This method tests for the existence of a file within the secure container.

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be checked.
      Returns:
      True if the file exists. False otherwise.
    • recursivelyRemoveDirectory

      boolean recursivelyRemoveDirectory(String path)
      This method recursively deletes the supplied directory, and it's sub-directories, located within the secure container.

      The path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the directory to be deleted.
      Returns:
      True on success. False on failure.
    • createDirectory

      boolean createDirectory(String path)
      This method creates a directory, and all non-existent directories in the supplied path, within the secure container.

      The path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the directory to be created.
      Returns:
      True on success. False on failure.
    • createFile

      boolean createFile(String path)
      This method creates a file within the secure container.

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be created.
      Returns:
      True on success. False on failure.
    • getFileHandleForReading

      Object getFileHandleForReading(String path)
      This method opens an existing file, in the secure container, for reading.

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be opened.
      Returns:
      The file handle object on success.
      null on error.
    • getFileHandleForWriting

      Object getFileHandleForWriting(String path)
      This method opens an existing file, in the secure container, for writing.

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be opened.
      Returns:
      The file handle object on success.
      null on error.
    • getFileHandleForUpdating

      Object getFileHandleForUpdating(String path)
      This method opens an existing file, in the secure container, for updating.

      The file path will be constructed using the secure container identifier used in isSecurePath(String).
      Parameters:
      path - The path to the file to be opened.
      Returns:
      The file handle object on success.
      null on error.
    • closeFile

      boolean closeFile(Object handle)
      This method closes an open file within the secure container.
      Parameters:
      handle - The file handle object to be closed.
      Returns:
      True on success. False on failure.
    • setFileLength

      boolean setFileLength(Object handle, long length)
      This method sets the file length of a file located within the secure container.
      Parameters:
      handle - The file handle object to be used..
      Returns:
      True on success. False on failure.
    • readFromFile

      int readFromFile(Object handle, byte[] buf)
      This method reads data from a file located within the secure container.
      Parameters:
      handle - The file handle object to be used..
      buf - The buffer to put the read data in.
      Returns:
      The amount of data placed in the buffer.
      0 on EOF
      -1 on error.
    • writeToFile

      int writeToFile(Object handle, byte[] buf)
      This method writes data to a file located within the secure container.
      Parameters:
      handle - The file handle object to be used.
      buf - The buffer containing the data.
      Returns:
      The amount of data written. -1 on error.
    • syncFile

      boolean syncFile(Object handle)
      This method forces buffered data to be written to the underlying device.
      Parameters:
      handle - The file handle object to be used.
      Returns:
      True on success. False on failure.
    • getFileLength

      long getFileLength(Object handle)
      This method obtains the length of a file within the secure container.

      The length returned is that of the decrypted file.
      Parameters:
      handle - The file handle object to be used.
      Returns:
      The file length. -1 on error.
    • getFileOffset

      long getFileOffset(Object handle)
      This method obtains the offset, from the start of the file , of the file pointer.

      The offset returned relates to the decrypted file.
      Parameters:
      handle - The file handle object to be used.
      Returns:
      The file pointer offset. -1 on error.
    • seekToFileOffset

      boolean seekToFileOffset(Object handle, long ofset)
      This method moves the file pointer to the requested offset from 0.

      The offset relates to the decrypted file.
      Parameters:
      handle - The file handle object to be used.
      Returns:
      True on success. False on failure.
    • getSecurePath

      String getSecurePath()
      Return the physical root of the secure container.

      Returns:
      The physical path to the secure container.
    • getSecurePrefix

      String getSecurePrefix()
      Return the 'tag' to indicate the file is suitable for decryption.

      Returns:
      The secure 'tag' string.