0

I have to encrypt a password with 3DES and send it as parameter to login service on backend.

I'm struggling searching an algorithm to achieve 3DES during last week but I can't be able to find it.

I need to crypt the password with a key and an initializer vector (aka iv).

Someone knows a free library or an algorithm appropriate?

Thanks.

Fry
  • 6,235
  • 8
  • 54
  • 93
  • No, I read the question last week and if you pay attention on the question text, you can see the user say "I have done encryption successfully". He's problem is decryption: in fact the code in the question is about decryption. My problem is encryption. – Fry Nov 16 '15 at 08:37
  • Swap `kCCDecrypt` for `kCCEncrypt`, add your init vector (which is commented out in their code), and you've got your solution. – ttarik Nov 16 '15 at 08:43
  • Also remove `kCCOptionECBMode` option. – zaph Nov 16 '15 at 20:32
  • See [this SO answer](http://stackoverflow.com/a/30167657/451475) for a 3DES solution. The other option you need to consider is padding, 3DES has a 8-byte block size. Other possibile gotchas are EDE or DED mode and a 2 or 3 byte key. Note: 3DES should not be used for new work. – zaph Nov 16 '15 at 20:40

0 Answers0