Ios,android,jave background AES Encryption and decryption

Source: Internet
Author: User

AES256 related code on iOS and Android:

Http://www.tuicool.com/articles/RVFbmmU

You can download the relevant code inside.

The problem we are experiencing is:

Moving the Android code to the Java background appears to be unencrypted.

Have encountered the following 2 questions

1. No cipher getinstance support for aes/cbc/pkcs7padding

Solution: http://www.codeweblog.com/java-%E4%BD%BF%E7%94%A8aes-cbc-pkcs7padding-%E5%8A%A0%E8%A7%A3%E5%AF%86%E5%AD% 97%e7%ac%a6%e4%b8%b2/

2. AES256 cannot be encrypted (perhaps a Java environment issue)

Solution: Change AES256 to AES128

Related code:

iOS code: (I've re-optimized the relevant iOS code on GitHub)

Https://github.com/xzjxylophone/RXCategory

In the nsstring+rxutility:

-(nsstring *) Rx_transform_aes128encryptwithkey: (nsstring *) key;

-(nsstring *) Rx_transform_aes128decryptwithkey: (nsstring *) key;

Java code: (for Android and Java background)

In the Ase.java, put the following

Private final int key_length = n;

The 256 change to 128, so that Ios,android and the Java background are consistent.

The difference between AES128 and AES256

http://blog.csdn.net/newizan/article/details/45461347

That's almost it. 128 is enough.

Ios,android,jave background AES Encryption and decryption

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.