6

What is the best practice to encode the string with encryption key(like password) in device

side(android and ios).And to decode that encoded string in server side with the encryption

key used in the device side.

  • You might encrypt by RC4 -> string to hex and decrypt by hex to string -> rc4 – Horst Jul 22 '13 at 09:47
  • This link should help: http://stackoverflow.com/questions/10072124/iphone-how-to-encrypt-nsdata-with-public-key-and-decrypt-with-private-key – metsburg Jul 22 '13 at 10:04
  • 1
    That depends on what kind of encryption you need. Do you need to use the same key for encryption and description (symmetric encryption) or not (so-called public-key or asymmetric encryption). – Jeepston Jul 22 '13 at 12:13

2 Answers2

2

You could try one of the following

  • RSA Encryption:

    Encrypt using public key in iOs Device and decrypt it using private key in web service

  • Host the web service with SSL certificates

  • Set up a Secured VPN and access the service through the VPN.

Since you mentioned about encrypting passwords.salting and hashing the password is most preferred.

Durai Amuthan.H
  • 31,670
  • 10
  • 160
  • 241
0

Wouldn't it better to use a SSL/TLS related protocol (e.g. ssh, https, etc.)? Those protocols implement negociation mechanism to choose the encryption algorithm for the data transfert.

You might want to read (android) http://developer.android.com/training/articles/security-ssl.html and (iOS) https://developer.apple.com/library/mac/#documentation/security/conceptual/cryptoservices/SecureNetworkCommunicationAPIs/SecureNetworkCommunicationAPIs.html

Vincent Pazeller
  • 1,448
  • 18
  • 28