Class OgreConnector


  • public class OgreConnector
    extends Object
    This class serves as a connection between the Offline-Graja-Encryption and other projects in need of using it.
    • Constructor Detail

      • OgreConnector

        public OgreConnector()
    • Method Detail

      • encryptFile

        public static File encryptFile​(File fileToEncrypt,
                                       Map<String,​? extends Object> metaData)
                                throws IOException
        Encrypts the given file using the Offline-Graja-Encryption
        Parameters:
        fileToEncrypt - The file which should be encrypted. The file is converted to a *.dat file with the same file name as the given file. For example a file called task.zip will be encrypted to task.dat. If there already is a file with that name (e. g. when encrypting a *.dat file), the encrypted file is named task_encrypted.dat (in that example - similar for other files). If the file task_encrypted.dat exists already as well, it will be overwritten!
        metaData - A map containing all the meta data which should be stored in the encrypted file. After decryption this meta data will be stored in a JSON file called ogre.inf
        Returns:
        The encrypted *.dat file
        Throws:
        IOException
      • decryptFile

        public static File decryptFile​(File fileToDecrypt)
                                throws IOException
        Encrypts the given file using the Offline-Graja-Encryption
        Parameters:
        fileToDecrypt - The file which should be decrypted. The file is converted to a *.zip file with the same file name as the given file. For example a file called task.dat will be decrypted to task.zip. If there already is a file with that name, the decrypted file is named task_decrypted.zip (in that example - similar for other files). If the file task_decrypted.zip exists already, it will be overwritten! This method will obviously fail and create data garbage if the given file was never encrypted with the ogre.inf
        Returns:
        The created *.zip file containing the original of the encrypted file and a JSON file called ogre.inf, containing all the meta data which was stored in the encrypted file.
        Throws:
        IOException