[Gambas-user] What is equivalent of -nosalt in gambas gb.openssl

T Lee Davidson t.lee.davidson at gmail.com
Thu Apr 9 07:41:04 CEST 2020


On 4/8/20 1:40 PM, Tobias Boege wrote:
> BTW: I'm almost sure that at least some openssl utilities currently
> deployed use MD5 in their key derivation -- you might want to try if
> that fixes the incompatibility of your code that uses SHA-256.

Changing the key derivation function to use MD5 still did not yield the same result as I got from openssl on the command line. :-(


> Another way is to introduce an edge case for EncryptSalted. Currently
> if EncryptSalted does not receive a Salt argument, it generates one
> at random. An API to implement -nosalt that would maintain plausible
> API compatibility would require the user to pass a salt argument but
> make it Null

It sounds like that would work. Or:

Static Function EncryptNoSalt ( Plain As String, Password As String ) As String
   Dim cKeyIv as Collection = EvpBytesToKey(Password)
   Return Cipher.Method.Encrypt( Plain, cKeyIv["key"], cKeyIv["iv"]).Cipher

Did I miss anything?


-- 
Lee


More information about the User mailing list