How to encrypt data using DES encryption CBC mode PKCS5P padding?

Hello,

How do I encrypt data using DES encryption CBC mode PKCS5P padding?

Thank you.

The documentation for Erlang’s :crypto module is a good place to start:

  • DES CBC is named des_cbc, when available (see below)
  • PKCS5 padding is named pkcs_padding

Beware: the algorithms available from :crypto are limited to ones provided by the OpenSSL library that Erlang is linked against. Some versions of OpenSSL have dropped support for old / deprecated ones like DES.

3 Likes

I mean for every definition of “encrypt” that has any value, nothing can use DES to encrypt anything.

ex_crypto is a nice elixir interface to the underlying erlang crypt library. You can of course use crypt directly (assuming an old system crypt(3)) for DES but do so at your own risk :slight_smile:

Got that all wrong, nevermind me.

Thank you @al2o3cr. I shall look it up now…

Is there any special way of setting the value below as an initialization vector for des_cbc?
0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF?