Results 1 to 4 of 4

Thread: QPluginloader load plugin from RAM

  1. #1
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QPluginloader load plugin from RAM

    Hi,

    I have an application that supports plugins via QPluginLoader and everything's working fine. Now I would like to load a Plugin from some memory location (e.g. char* or QByteArray) instead of loading it directly from a file denoted by its filename.

    The background is as follows: I would like to encrypt the myplugin.dll file (say to encryptedplugin.cdll) and then load all file content to some memory location, do a raw byte decryption and then pass the decrypted content to the QPluginLoader:

    pseudocode:
    char* encryptedcode = LoadFile(encryptedplugin.cdll)
    char* code = decryptCode(encryptedcode, key) //provided separately
    QPluginLoader loader
    loader.loadFromRAM(code)
    ....

    Is there any possibility to do that? (PS: I don't want to create a decrypted temporary dll-file on the file system)

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QPluginloader load plugin from RAM

    I think you will need some RAM disk utility to which you can in runtime create your decrypted DLL, then load it from there.
    If this is considered by your requirements as not secure, I think you will have to implement such RAM disk functionality by your self, which you then can contain in your executable.
    But would explore throughly the options of available RAM disk utilities/libs, or similar solutions.

    Another way would be to take the original code for QLibrary (on which QPluginLoader is based) and and change it to take your binary content.

    Not trivial.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QPluginloader load plugin from RAM

    There is no security here anyway so I don't really see why to do all that in the first place. If you keep a decrypted image of the library in memory, one can just dump this block of memory to the disk to have a decrypted version of the dll. Besides, this is more an OS-level issue than a Qt one.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Feb 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPluginloader load plugin from RAM

    Maybe you're right and the gain of security is minimal... so it's probably not worth the effort...

    Thanks anyway!

Similar Threads

  1. Why can Qt Creator use QPluginLoader to load plugins?
    By MorrisLiang in forum Qt Programming
    Replies: 4
    Last Post: 25th April 2010, 16:00
  2. Replies: 8
    Last Post: 27th December 2009, 14:57
  3. QPluginLoader doesn't load plugin
    By BeS in forum Qt Programming
    Replies: 6
    Last Post: 26th November 2008, 19:12
  4. QPluginLoader not recognizing a plugin
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 29th June 2007, 14:13

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.