# Encrypting using openssl Triple-DES

**URL:** <https://www.ruby-forum.com/t/encrypting-using-openssl-triple-des/151359>\
**Category:** Ruby\
**Created:** [October 20, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/encrypting-using-openssl-triple-des/151359 "2008-10-20T17:57:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dani](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@dani](https://www.ruby-forum.com/u/dani)\
**Post date:** [October 20, 2008, 5:57pm UTC](https://www.ruby-forum.com/t/encrypting-using-openssl-triple-des/151359/1 "2008-10-20T17:57:43Z")

</div>

Hi, I need to encrypt some data using Triple DES in ECB mode  
(DES-EDE3-ECB), but I don’t know how to do it. If I create the cipher  
like this:

e = OpenSSL::Cipher::Cipher.new ‘DES-EDE3’

It seems (man enc) that des-ede3 is an alias for des-ede3-cbc, so  
there seems to be no way of encrypting with des-ede3-ecb?

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![dani](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@dani](https://www.ruby-forum.com/u/dani)\
**Post date:** [October 21, 2008, 10:04am UTC](https://www.ruby-forum.com/t/encrypting-using-openssl-triple-des/151359/2 "2008-10-21T10:04:18Z")

</div>

Dani P. wrote:

> Hi, I need to encrypt some data using Triple DES in ECB mode  
> (DES-EDE3-ECB), but I don’t know how to do it. If I create the cipher  
> like this:
> 
> e = OpenSSL::Cipher::Cipher.new ‘DES-EDE3’
> 
> It seems (man enc) that des-ede3 is an alias for des-ede3-cbc, so  
> there seems to be no way of encrypting with des-ede3-ecb?

‘man enc’ on my system says:

```
    des-ede3-cbc Three key triple DES EDE in CBC mode
    des-ede3 Three key triple DES EDE in ECB mode
    des3 Alias for des-ede3-cbc
    des-ede3-cfb Three key triple DES EDE CFB mode
    des-ede3-ofb Three key triple DES EDE in OFB mode

```

That is: “des-ede3” gives you ECB.

This is with:

ii libssl0.9.8 0.9.8g-4ubuntu3.3  
SSL shared libraries

So perhaps you have some old version of openssl installed - or perhaps  
you didn’t read the manpage properly.

In any case, I’d suggest that openssl-specific questions really belong  
on an openssl mailing list, since this wasn’t anything to do with the  
Ruby bindings.

---

<div class="post-metadata">

**Author:** ![dani](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/35a633/32.png) [@dani](https://www.ruby-forum.com/u/dani)\
**Post date:** [October 21, 2008, 10:51am UTC](https://www.ruby-forum.com/t/encrypting-using-openssl-triple-des/151359/3 "2008-10-21T10:51:38Z")

</div>

On Tue, Oct 21, 2008 at 10:02 AM, Brian C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:  
be no way of encrypting with des-ede3-ecb?

> This is with:
> 
> ii libssl0.9.8 0.9.8g-4ubuntu3.3  
> SSL shared libraries
> 
> So perhaps you have some old version of openssl installed - or perhaps  
> you didn’t read the manpage properly.

Indeed, on previous openssl versions, des-ede3 was an alias for  
triple des with cbc mode.  
The problem now is that ruby uses its own shared library (openssl.dll  
/openssl.so). And openssl doesn’t seem to come with any file named  
openssl.dll/.so, so I don’t know how to upgrade this now, especially  
on Windows. :?
