Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Supporting ECB mode for AES Encryption #46

Open
indiandragon opened this issue Sep 6, 2016 · 2 comments
Open

Supporting ECB mode for AES Encryption #46

indiandragon opened this issue Sep 6, 2016 · 2 comments

Comments

@indiandragon
Copy link

Hi @hohl ,

I know CBC mode for AES encryption is much secure than ECB mode, but as the server I'm connecting to has ECB mode of encryption/decryption I'm forced to use the same on the iOS client. Can you give me some pointers on implementing ECB mode in the MIHCrypto ?

@hohl
Copy link
Owner

hohl commented Sep 6, 2016

Hey, @indiandragon

It shouldn't be too hard to extend MIHAESKey to support ECB. Right now it is hardcoded to use the CBC chiper in lines 126 to 136 and lines 176 to 184. You could try to replace this hardcoded lines by adding for ex. a chiper property to the MIHAESKey class and then add a switch construct in those lines.

The EVP_aes_256_cbc() function used in the above linked lines constructs the chiper (256 bit CBC chiper for AES) which is then used in the lines below for the encryption process. There must be some similar chiper function for ECB too in the OpenSSL documentation.

@indiandragon
Copy link
Author

Hey @hohl , thanks for the information. I'll update when I implement the same.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants