[openssl-users] I need help to implement triple des algorithm with openssl
matt at openssl.org
Fri Jun 15 13:53:07 UTC 2018
On 15/06/18 14:34, Fernando A wrote:
> Hi all,
> I am not an expert with openssl and I need replace a component in c#
> that run algorithm Triple DES.
> I tried in the command line something like this
> "openssl enc -des-ede3 -k 1234567890123456ABCDEFGH -in test.txt -out
> but the result that I obtain is diferent of result launched by the c#
> Of course the passphrase is the same, and always file test.enc contain a
> that start with "Salted__..." indifferent of the contain of file test.txt.
> some idea?
> thanks in advance!
Is your c# component using a passphrase or a key? If a passphrase, how
does it generate the key from that passphrase?
By default the OpenSSL enc command uses its own key derivation function
(KDF) to generate a key from a passphrase. That KDF uses a random salt
value which it prepends to the beginning of the file. If the KDF in C#
is different (which it almost certainly is), and it doesn't use the same
file format as OpenSSL uses (which it almost certainly doesn't) then
you're going to get different results.
You can alternatively pass a key rather than a passphrase to the OpenSSL
It seems odd that you are using the command line to replace a c#
component, rather than using the OpenSSL APIs.
More information about the openssl-users