开发者

What encryption method should I use on iOS Android Apps: AES128 or 3DES

开发者 https://www.devze.com 2023-04-08 13:15 出处:网络
I have been given the choice by a client of AES128 or 3DES encryption. I have to roll it out on both iOS and Android.

I have been given the choice by a client of AES128 or 3DES encryption.

I have to roll it out on both iOS and Android.

Which will be easier to do?

Are there libraries for both iOS and开发者_如何学Go Android?

Full or Partial answer would be great (i.e. if you only know about one platform)


Prefer AES128 over 3DES. 3DES provides an effective key size of 112 bits, while AES 128 uses 128 bits of key space.

http://en.wikipedia.org/wiki/Aes128

http://en.wikipedia.org/wiki/Triple_DES


Please read this article in its entirety, and feel free to come back to post further comments or new questions.

Cryptographic Right Answers

In particular, the very first question answered is:

Encrypting data: Use AES in CTR (Counter) mode, and append an HMAC.

AES is about as standard as you can get, and has done a good job of resisting cryptologic attacks over the past decade. Using CTR mode avoids the weakness of ECB mode, the complex (and bug-prone) process of padding and unpadding of partial blocks (or ciphertext stealing), and vastly reduces the risk of side channel attacks thanks to the fact that the data being input to AES is not sensitive. However, because CTR mode is malleable, you should always add an HMAC to confirm that the encrypted data has not been tampered with.

And the very next question answered is:

AES key length: Use 256-bit AES keys.

Theoretically speaking, 128-bit AES keys should be enough for the forseeable future; but for most applications the increased cost of using 256-bit keys instead of 128-bit keys is insignificant, and the increased key length provides a margin of security in case a side channel attack leaks some but not all of the key bits.

[EDIT 1] Also, the fact that you've applied a "public-key-encryption" tag to your question implies that your understanding of cryptography could be better. Please also read chapter 5 of Security Engineering (PDF) by Ross Anderson; it's free and very accessible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号