This is a creation in Article, where the information may have evolved or changed.
The mobile-to-server communication requires AES 256 encryption.
The implementation code for the Androd client is:
Import Android.util.base64;import Java.io.unsupportedencodingexception;import Java.security.key;import Java.security.messagedigest;import Java.security.nosuchalgorithmexception;import Javax.crypto.Cipher;import Javax.crypto.spec.secretkeyspec;public class Aesencrypt {private static final String Key_algorithm = "AES"; private static final String Cipher_algorithm = "aes/ecb/pkcs7padding"; public static string Encrypt (string key, String data) {try {final key KeySpec = CreateKey (key); Final Cipher Cipher = cipher.getinstance (Cipher_algorithm, "BC"); Cipher.init (Cipher.encrypt_mode, KeySpec); Final byte[] encoded = cipher.dofinal (Data.getbytes ("UTF-8")); return base64.encodetostring (encoded, base64.default); } catch (Exception e) {e.printstacktrace (); } return null; } public static string decrypt (string key, String data) {try {final key keySpec = CreateKey (key); Final Cipher Cipher = cipher.getinstance (cipher_algorithm); Cipher.init (Cipher.decrypt_mode, KeySpec); Final byte[] bytes = Base64.decode (data.getbytes ("UTF-8"), Base64.default); return new String (cipher.dofinal (bytes)); } catch (Exception e) {e.printstacktrace (); } return null; } private static Key CreateKey (String Key) throws Unsupportedencodingexception, NoSuchAlgorithmException {final MessageDigest digest = messagedigest.getinstance ("SHA-256"); Final byte[] Keybyte = Digest.digest (Key.getbytes ("UTF-8")); return new Secretkeyspec (Keybyte, key_algorithm); }}
Encrypted results are converted to strings by Base64.default