How to get rid of the GUI access from shared library.

Posted by Inso Reiges on Stack Overflow See other posts from Stack Overflow or by Inso Reiges
Published on 2010-03-24T05:59:37Z Indexed on 2010/03/24 6:03 UTC
Read the original article Hit count: 327

Filed under:
|

Hello,

In my project i have a shared library with cross-platform code that provides a very convenient abstraction for a number of its clients. To be more specific, this library provides data access to encrypted files generated by main application on a number of platforms. There is a great deal of complicated code there that implements cryptographic protocols and as such is very error-prone and should be shared as much as possible across clients and platforms.

However parsing all this encrypted stuff requires asking user for a number of different secrets ones in a while. The secret can be either a password, a number of shared passwords or a public key file and this list is a hot target for extension in the future. I can't really ask the user for any of those secrets beforehand from main application, because i really don't know what i need to ask for until i start working with the encrypted data directly in the library code. So i will have to create dialogs and call them from the library code. However i really see this as a bad idea, because (among other things) there is a possibility of a windows service using it and services can't have GUI access.

The question is, are there any known ways or patterns to get rid of the GUI calls that are suitable for my case?

Thank you.

© Stack Overflow or respective owner

Related posts about best-practices

Related posts about library