[Gambas-user] need some helping hand for crypting

Jean-Yves F. Barbier 12ukwn at ...626...
Mon Jul 20 00:00:58 CEST 2009


Charlie Reinl a écrit :
.......
> no what I need is for gambas2, I have to store Passwords in an XML-file,
> what means plain-text readable.
> So I need a crypting/uncrypting logic . 
> I put my PW "TOPSECRET" to store 
> 	Print crypting("TOPSECRET")
> 	>2sgbtf&&
> and get it back by 
> 	Print uncrypting("2sgbtf&&")
> 	>TOPSECRET
> The uncrypted password is used for a database login.
> 
> or in other words
> 	store pw in plain text encrypted, and
> 	restore encrypted pw to plain text. 

This one's not easy: most of possibilities involve a file or a password or
both :(

May be you could try using 'ssss', it splits a msg (128 chars max) into some
encoded strings (ascii) and is able to recover the msg from a certain amount of
those strings.

The only PB you'll encounter is I don't think there's an "expect" in Gambas,
so you'll have to wait 1 sec and feed it char/char, CR inclued.

encrypt:
========
$ ssss-split -t2 -n4    <=mean you output 4 strings, but only need 2 of'em
WARNING: couldn't get memory lock (ENOMEM, try to adjust RLIMIT_MEMLOCK!).
Generating shares using a (2,4) scheme with dynamic security level.
Enter the secret, at most 128 ASCII characters: Using a 144 bit security level.
<here is the input problem (manual)>
1-3b8c7024bab739bcfeb81a1ff96b0d8ddb43
2-18577a4a8ec859e6b717aaf392717de96b8a
3-06e183909d1d79d08f8d3aa84b78adcafbcf
4-5fe16e96e63699522448cb2b44459d200a06

and decrypt:
============
$ ssss-combine -t2
WARNING: couldn't get memory lock (ENOMEM, try to adjust RLIMIT_MEMLOCK!).
Enter 2 shares separated by newlines:
<here is the input problem (manual)>
Share [1/2]: 1-3b8c7024bab739bcfeb81a1ff96b0d8ddb43
Share [2/2]: 4-5fe16e96e63699522448cb2b44459d200a06
Resulting secret: my loving password

Of course, you can use the same trigger (-t) as the number of strings (-n),
but in this example, you can afford to loose 2 strings out 4.

JY
-- 
Be frank and explicit with your lawyer ... it is his business to confuse
the issue afterwards.




More information about the User mailing list