"Fossies" - the Fresh Open Source Software Archive

Member "src/Volume/Keyfile.h" (10 Oct 2018, 1775 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Keyfile.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #ifndef TC_HEADER_Encryption_Keyfile
   14 #define TC_HEADER_Encryption_Keyfile
   15 
   16 #include "Platform/Platform.h"
   17 #include "Platform/Stream.h"
   18 #include "VolumePassword.h"
   19 
   20 namespace VeraCrypt
   21 {
   22     class Keyfile;
   23     typedef list < shared_ptr <Keyfile> > KeyfileList;
   24 
   25     class Keyfile
   26     {
   27     public:
   28         Keyfile (const FilesystemPath &path) : Path (path) { }
   29         virtual ~Keyfile () { };
   30 
   31         operator FilesystemPath () const { return Path; }
   32         static shared_ptr <VolumePassword> ApplyListToPassword (shared_ptr <KeyfileList> keyfiles, shared_ptr <VolumePassword> password);
   33         static shared_ptr <KeyfileList> DeserializeList (shared_ptr <Stream> stream, const string &name);
   34         static void SerializeList (shared_ptr <Stream> stream, const string &name, shared_ptr <KeyfileList> keyfiles);
   35         static bool WasHiddenFilePresentInKeyfilePath() { bool r = HiddenFileWasPresentInKeyfilePath; HiddenFileWasPresentInKeyfilePath = false; return r; }
   36 
   37         static const size_t MinProcessedLength = 1;
   38         static const size_t MaxProcessedLength = 1024 * 1024;
   39 
   40     protected:
   41         void Apply (const BufferPtr &pool) const;
   42 
   43         static bool HiddenFileWasPresentInKeyfilePath;
   44 
   45         FilesystemPath Path;
   46 
   47     private:
   48         Keyfile (const Keyfile &);
   49         Keyfile &operator= (const Keyfile &);
   50     };
   51 }
   52 
   53 #endif // TC_HEADER_Encryption_Keyfile