3

We are creating same project in android and iphone. Now problem is that we need to send user information to aspx server using webservice in encrypted form. We both have implemented it but results are diiferent so is there a common AES encryption method which will produce same result and can be parsed at server.

Please reply as soon as possible, my work get affected because of it.

Thanks in advance

4

3 Answers 3

2

You could consider using the RNCryptor library for iOS and the JNCryptor library for Android. Both open-source libraries use the same data format and have support for password-based encryption and key-based encryption using 256-bit AES.

The data format also includes the IV and a MAC value calculated across the data, so it conforms with the best practices for data encryption.

Sign up to request clarification or add additional context in comments.

Comments

0

AES encryption/decryption will produce the same results on it it is provided the same parameters. Of particular interest are

  1. encryption key value and size
  2. mode: CBC, ECB, etc. (you should probably be using CBC)
  3. initialization vector (iv) is needed for most modes
  4. padding method: PKCS7, etc. (AES is a block cypher and needs input in a multiple of block size)

As a start chose simple test data, get that working and move into more complex situations. Ex: initially choose an iv of all 0, CBC, data of exactly one block size with no padding. When that is working start adding in more complexity.

Security is not easy, the encryption part is the easy part.

Or use SSL.

For reference and learning basically everything one needs to know is in the Handbook of Applied Cryptography it is a free (and legal) pdf download, a hardcover version can also be purchased. Pros use this book, even my wife in her work.

3 Comments

Thanks a lot for replying. But sir I am very new in this field and never done encyption before So I didnt get how to do it and from where to start. How this code will look in android and how i implement in iphone. I am just blank. Can you tell me with some example or provide some code snippet for both android and iphone.
Sir android team already used the approch in following link can there is a way to implement same in iphone or some other method which we both can follow.stackoverflow.com/questions/5277533/…
Sir any website where I can understand every thing. and how to implement, how CBC,ECB works etc.
0

I have some similar problem working with AES encryption on java and iOS, check my question and the answer, maybe it can help you, the ECB mode is only supported on iOs

Objective-c AES encryption doesn't look like java AES encryption

6 Comments

iOS (CommonCrypto) supports both CBC and ECB, CBC is the default. Do not simple go by the header (.h) files, in this case the .h file does not provide the default values.
From the Apple header file CommonCryptor.h: Initialization vector, optional. Used by block ciphers when Cipher Block Chaining (CBC) mode is enabled. If present, must be the same length as the selected algorithm's block size. If CBC mode is selected (by the absence of the kCCOptionECBMode bit in the options flags) and no IV is present, a NULL (all zeroes) IV will be used.
Sir android team already used the approch in following link can there is a way to implement same in iphone or some other method which we both can follow. stackoverflow.com/questions/5277533/… I am very new in this field and never done encyption before So I didnt get how to do it and from where to start. How this code will look in android and how i implement in iphone. I am just blank. Can you tell me with some example or provide some code snippet for both android and iphone. Thx in advance
I looked at the have code, unfortunately I do not know the java security API and could not get any real information from it. First you will need to know what the have code is doing, get the answers to the four points in my answer.
Sir any website where I can understand every thing. and how to implement, how CBC<ECB works etc.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.