Technical discussions | Discussions techniques
Subscription date : 28 October 2009
Messages : 415
|
Heya
I've looked at the mail applet to see how the conf file deals with accounts and password. I've got few questions about that:
- Does the widget automatically encrypts the password to the conf file?
- Do i need to call a specific function to decrypt the password in the get_config() method? Is it keyfile.getpassword() or something?
- How do you pick up account details from the keyfile before knowing the account names? I mean: i don't know before hand the name of accounts, but i'd need to specify the tab name, which is the account name written in brackets, as a first argument in the keyfile.getsomething() function. So is there any way to iterate the various accounts / tabs?
Thanks.
B. |
matttbe, Thursday 05 May 2011 à 19:01
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Hello,
Does the widget automatically encrypts the password to the conf file? We can do that in C because we can use a function of the C API of Cairo-Dock to encrypt/decrypt a password. I guess you've to use a function in python to encrypt passwords but I don't know which function... So I guess the you've to look at Google!
But if you've to decrypt a password, the security wont be very high... (just unreadable for the user...)
How do you pick up account details from the keyfile before knowing the account names? I mean: i don't know before hand the name of accounts, but i'd need to specify the tab name, which is the account name written in brackets, as a first argument in the keyfile.getsomething() function. So is there any way to iterate the various accounts / tabs? Maybe you can create one account (twitter/gmail/etc.) by section but if you want to access to 2 twitters accounts at the same time, you have to edit the .conf file. It seems you can easily do that with ConfigParser: http://docs.python.org/library/configparser.html (have a look to the first example: http://docs.python.org/library/configparser.html#examples => keyfile.add_section('Section1'); keyfile.set('Section1', 'int', '15')) |
Subscription date : 28 October 2009
Messages : 415
|
Ha. I will look for encryption the.
Thanks for the tips. |
Subscription date : 28 October 2009
Messages : 415
|
Hi there,
with regard to multiple accounts: i tried to copy the mail.conf file section which adds a new account to my own conf file but the same widget is not reproduced.
The section i am talking about is:
A helpful alternative for me would be a keyfile method to write to the conf file.
Any suggestions? |
Subscription date : 28 October 2009
Messages : 415
|
OK i completely missed out Matttbe's comment on how to write to the conf file |
Subscription date : 28 October 2009
Messages : 415
|
@Matttbe
What encryption base is used to encrypt password? I thought it was base64 but i was wrong  |
matttbe, Wednesday 11 May 2011 à 23:16
|
|
Subscription date : 28 October 2009
Messages : 415
|
Wow... i can't read c really and even if i did i don't believe i could follow the encryption thing.
Can you tell me how that works or could you guys make a python binding for decryption? |
matttbe, Wednesday 11 May 2011 à 23:56
|
|
Subscription date : 24 January 2009
Messages : 12573
|
No I think it's better to use a python module like base64 or bzip2. It's just to have something in a non-human readable form... |
Subscription date : 28 October 2009
Messages : 415
|
matttbe : No I think it's better to use a python module like base64 or bzip2. It's just to have something in a non-human readable form...
OK i'm fine with that but how do i get the password input widget on the configurations screen without it using your custom encryption? |
matttbe, Thursday 12 May 2011 à 10:13
|
|
Subscription date : 24 January 2009
Messages : 12573
|
Ok I forgot that
So it's currently not possible... |
Subscription date : 28 October 2009
Messages : 415
|
OK
then perhaps i can use a dialogue to request passwords for now?
let me know if/when you are planning to provide an alternative password widget please. |
Subscription date : 30 November 2007
Messages : 17118
|
hmm, so you want to use the password widget (an entry with hidden characters, 'k'), but then you can't read the text in the conf file because it's encrypted ?
so what about a python function that would decrypt it ?
I think it's feasible to translate the C code into a small python function. |
Subscription date : 28 October 2009
Messages : 415
|
fabounet : hmm, so you want to use the password widget (an entry with hidden characters, 'k'), but then you can't read the text in the conf file because it's encrypted ?
so what about a python function that would decrypt it ?
I think it's feasible to translate the C code into a small python function.
By all means, i'd like the python binding for descryption function |
matttbe, Friday 13 May 2011 à 13:43
|
|
Subscription date : 24 January 2009
Messages : 12573
|
And why not just an entry with hidden characters? and then the dev can use the encryption that he wants to have... |
Subscription date : 30 November 2007
Messages : 17118
|
agreed, although we don't need to add a Dbus method for that, since it's a small function it can be added inside the interface directly.
the C code is in cairo-dock-config.c, in case you want to try yourself |
Subscription date : 28 October 2009
Messages : 415
|
fabounet : agreed, although we don't need to add a Dbus method for that, since it's a small function it can be added inside the interface directly.
the C code is in cairo-dock-config.c, in case you want to try yourself
I have no idea as to how i should bind python to c code
@ Matttbe:
I'm ok with a plain password widget, but that means i have get the password from the config, encrypt it, and rewrite it to the config right? |
matttbe, Friday 13 May 2011 à 13:58
|
|
Subscription date : 24 January 2009
Messages : 12573
|
but that means i have get the password from the config, encrypt it, and rewrite it to the config right? yes... maybe not so easy?  |
Subscription date : 28 October 2009
Messages : 415
|
matttbe : but that means i have get the password from the config, encrypt it, and rewrite it to the config right? yes... maybe not so easy? :-?
it's do-able with two keys in the config. If there is a password entry, i get it, ecnrypt it, write it to password log, and clean password entry. It's just not the most elegant way of solving this though. |
Subscription date : 28 October 2009
Messages : 415
|
OK i'm having some trouble with the keyfile (RawConfigParser Object) as i am trying to add and remove email accounts from the config file.
Basically keyfile.set(section, option, value) followed by keyfile.write(file) (where file is the conf file opened for writing), rewrites the entire conf file without comments (which erases the entire interface of course).
Is there any way to include comments in the keyfile?
Otherwise: does it mean i have to make my own config parser?
Thanks.
B. |
Technical discussions | Discussions techniques
|