{"id":463959,"date":"2020-01-07T09:36:19","date_gmt":"2020-01-07T09:36:19","guid":{"rendered":"https:\/\/www.knowband.com\/blog\/?p=463959\/"},"modified":"2022-07-18T07:16:25","modified_gmt":"2022-07-18T07:16:25","slug":"how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application","status":"publish","type":"post","link":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/","title":{"rendered":"How to setup Encryption and Decryption between Android and ASP.Net Web Application?"},"content":{"rendered":"<p style=\"text-align: justify;\">In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/Padding.jpeg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-816657 size-full\" src=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/Padding.jpeg\" alt=\"padding\" width=\"760\" height=\"380\" srcset=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/Padding.jpeg 760w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/Padding-300x150.jpeg 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">The C# code will use PKCS7 padding, as PKCS5 is not available there. In Android, it uses PKCS5 padding internally, even if we specify PKCS7 padding in the cipher transformation. So, we\u2019re also specifying the PKCS5 padding mode. When tested, they both produce the same correct results.<\/p>\n<p style=\"text-align: justify;\">In this encryption method, a single key is used for both the secret key and the salt.<\/p>\n<p style=\"text-align: justify;\"><a href=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/encryption-method.jpeg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-816655 size-full\" src=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/encryption-method.jpeg\" alt=\"encryption-method\" width=\"760\" height=\"380\" srcset=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/encryption-method.jpeg 760w, https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/encryption-method-300x150.jpeg 300w\" sizes=\"auto, (max-width: 760px) 100vw, 760px\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">When using different keys for the secret key and salt, there was some difference between the Base64 encoded versions of the salt (or Initialization Vector). The Base64 encoded versions were created by Android and C# codes, and they were different from one another.<\/p>\n<h2 style=\"text-align: justify;\">To overcome this, we\u2019ve used a single key that will serve as both the secret key and the salt.<\/h2>\n<h3 style=\"text-align: justify;\">The code for the Android part is as follows:<\/h3>\n<pre class=\"brush: actionscript3; gutter: true\">public class EncryptionUtils {\r\n\r\n   private final String characterEncoding = &quot;UTF-8&quot;;\r\n   private final String cipherTransformation = &quot;AES\/CBC\/PKCS5Padding&quot;;\r\n   private final String aesEncryptionAlgorithm = &quot;AES&quot;;\r\n\r\n   public String encrypt(String plainText, String key) throws UnsupportedEncodingException, InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException {\r\n       byte [] plainTextbytes = plainText.getBytes(characterEncoding);\r\n       byte [] keyBytes = getKeyBytes(key);\r\n\/\/        return Base64.encodeToString(encrypt(plainTextbytes,keyBytes, keyBytes), Base64.DEFAULT);\r\n       return Base64.encodeToString(encrypt(plainTextbytes,keyBytes, keyBytes), Base64.NO_WRAP);\r\n   }\r\n\r\n   public String decrypt(String encryptedText, String key) throws KeyException, GeneralSecurityException, GeneralSecurityException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException, IOException {\r\n       byte [] cipheredBytes = Base64.decode(encryptedText, Base64.DEFAULT);\r\n       byte[] keyBytes = getKeyBytes(key);\r\n       return new String (decrypt(cipheredBytes, keyBytes, keyBytes), characterEncoding);\r\n   }\r\n\r\n   public  byte [] decrypt( byte[] cipherText, byte[] key, byte [] initialVector) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException\r\n   {\r\n       Cipher cipher = Cipher.getInstance(cipherTransformation);\r\n       SecretKeySpec secretKeySpecy = new SecretKeySpec(key, aesEncryptionAlgorithm);\r\n       IvParameterSpec ivParameterSpec = new IvParameterSpec(initialVector);\r\n       cipher.init(Cipher.DECRYPT_MODE, secretKeySpecy, ivParameterSpec);\r\n       cipherText = cipher.doFinal(cipherText);\r\n       return cipherText;\r\n   }\r\n\r\n   public byte[] encrypt(byte[] plainText, byte[] key, byte [] initialVector) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException\r\n   {\r\n       Cipher cipher = Cipher.getInstance(cipherTransformation);\r\n       SecretKeySpec secretKeySpec = new SecretKeySpec(key, aesEncryptionAlgorithm);\r\n       IvParameterSpec ivParameterSpec = new IvParameterSpec(initialVector);\r\n       cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);\r\n       plainText = cipher.doFinal(plainText);\r\n       return plainText;\r\n   }\r\n\r\n   private byte[] getKeyBytes(String key) throws UnsupportedEncodingException{\r\n       byte [] keyBytes= new byte[16];\r\n       byte [] parameterKeyBytes= key.getBytes(characterEncoding);\r\n       System .arraycopy(parameterKeyBytes, 0 , keyBytes, 0, Math.min(parameterKeyBytes.length, keyBytes.length));\r\n       return keyBytes;\r\n   }\r\n}\r\n\r\n&lt;strong&gt;Recommended Read: &lt;\/strong&gt;&lt;a href=&quot;https:\/\/www.knowband.com\/blog\/tips\/copy-clipboard-javascript\/&quot;&gt;Copy to clipboard in JavaScript&lt;\/a&gt;<\/pre>\n<h3 style=\"text-align: justify;\"><strong>The code for the C# part is as follows:<\/strong><\/h3>\n<pre class=\"brush: actionscript3; gutter: true\">\/\/ Encrypts plaintext using AES 128bit key and a Chain Block Cipher and returns a base64 encoded string\r\n       public string Encrypt(String plainText, String key)\r\n       {\r\n           var plainBytes = Encoding.UTF8.GetBytes(plainText);\r\n           return Convert.ToBase64String(Encrypt(plainBytes, GetRijndaelManaged(key)));\r\n       }\r\n    \r\n       public string Decrypt(String encryptedText, String key)\r\n       {\r\n           var encryptedBytes = Convert.FromBase64String(encryptedText);\r\n           return Encoding.UTF8.GetString(Decrypt(encryptedBytes, GetRijndaelManaged(key)));\r\n       }\r\n    \r\n       public byte[] Encrypt(byte[] plainBytes, RijndaelManaged rijndaelManaged)\r\n       {\r\n           return rijndaelManaged.CreateEncryptor()\r\n               .TransformFinalBlock(plainBytes, 0, plainBytes.Length);\r\n       }\r\n    \r\n       public byte[] Decrypt(byte[] encryptedData, RijndaelManaged rijndaelManaged)\r\n       {\r\n           return rijndaelManaged.CreateDecryptor()\r\n               .TransformFinalBlock(encryptedData, 0, encryptedData.Length);\r\n       }\r\n    \r\n       public RijndaelManaged GetRijndaelManaged(String secretKey)\r\n       {\r\n           var keyBytes = new byte[16];\r\n           var secretKeyBytes = Encoding.UTF8.GetBytes(secretKey);\r\n           Array.Copy(secretKeyBytes, keyBytes, Math.Min(keyBytes.Length, secretKeyBytes.Length));\r\n           return new RijndaelManaged\r\n           {\r\n               Mode = CipherMode.CBC,\r\n               Padding = PaddingMode.PKCS7,\r\n               KeySize = 128,\r\n               BlockSize = 128,\r\n               Key = keyBytes,\r\n               IV = keyBytes\r\n           };\r\n       }<\/pre>\n<p style=\"text-align: justify;\">With the help of the above code, one can encrypt a string on one platform, and then decrypt it on the other platform, and vice-versa.<\/p>\n<p style=\"text-align: justify;\"><strong>Recommended Read:<\/strong>\u00a0<a href=\"https:\/\/www.knowband.com\/blog\/tips\/see-code-ctp-file-colorful-php-file-netbeans\/\">How to see the code of \u2018.ctp\u2019 file as colourful as the \u2018.php\u2019 file in NetBeans<\/a><\/p>\n<p><iframe loading=\"lazy\" title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/XIYd7u3h574\" width=\"660\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode. The C# code will use PKCS7 padding, as PKCS5 is not available there. In Android, it uses PKCS5 padding internally, even if we specify PKCS7 padding in the [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":816658,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kbui_enabled":"","footnotes":""},"categories":[1111],"tags":[7520,19432,19433,19435,19434,19431],"class_list":["post-463959","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","tag-android","tag-api-decryption","tag-api-encryption","tag-asp-net-web-application","tag-decryption","tag-encryption"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to setup Encryption and Decryption between Android and ASP.Net Web Application<\/title>\n<meta name=\"description\" content=\"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to setup Encryption and Decryption between Android and ASP.Net Web Application\" \/>\n<meta property=\"og:description\" content=\"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowband Blog | Ecommerce Modules\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Knowband\" \/>\n<meta property=\"article:published_time\" content=\"2020-01-07T09:36:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-18T07:16:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"760\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ajay Taneja\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:site\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay Taneja\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/\"},\"author\":{\"name\":\"Ajay Taneja\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/091fe95729cba0da363b4fd2a784a893\"},\"headline\":\"How to setup Encryption and Decryption between Android and ASP.Net Web Application?\",\"datePublished\":\"2020-01-07T09:36:19+00:00\",\"dateModified\":\"2022-07-18T07:16:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/\"},\"wordCount\":229,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg\",\"keywords\":[\"Android\",\"api decryption\",\"api encryption\",\"ASP.Net Web Application\",\"Decryption\",\"Encryption\"],\"articleSection\":[\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/\",\"name\":\"How to setup Encryption and Decryption between Android and ASP.Net Web Application\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg\",\"datePublished\":\"2020-01-07T09:36:19+00:00\",\"dateModified\":\"2022-07-18T07:16:25+00:00\",\"description\":\"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg\",\"width\":760,\"height\":300,\"caption\":\"how-to-setup-encryption-and-decryption-between-android-and-asp\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to setup Encryption and Decryption between Android and ASP.Net Web Application?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"description\":\"Magento, Prestashop, Opencart, Shopify\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"width\":153,\"height\":61,\"caption\":\"Knowband Blog | Ecommerce Modules\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Knowband\",\"https:\\\/\\\/x.com\\\/KnowbandPlugin\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/091fe95729cba0da363b4fd2a784a893\",\"name\":\"Ajay Taneja\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/plugins\\\/wp-user-avatar\\\/deprecated\\\/wp-user-avatar\\\/images\\\/wpua-96x96.png\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/plugins\\\/wp-user-avatar\\\/deprecated\\\/wp-user-avatar\\\/images\\\/wpua-96x96.png\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/plugins\\\/wp-user-avatar\\\/deprecated\\\/wp-user-avatar\\\/images\\\/wpua-96x96.png\",\"caption\":\"Ajay Taneja\"},\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/author\\\/ataneja\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to setup Encryption and Decryption between Android and ASP.Net Web Application","description":"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/","og_locale":"en_US","og_type":"article","og_title":"How to setup Encryption and Decryption between Android and ASP.Net Web Application","og_description":"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.","og_url":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/","og_site_name":"Knowband Blog | Ecommerce Modules","article_publisher":"https:\/\/www.facebook.com\/Knowband","article_published_time":"2020-01-07T09:36:19+00:00","article_modified_time":"2022-07-18T07:16:25+00:00","og_image":[{"width":760,"height":300,"url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg","type":"image\/jpeg"}],"author":"Ajay Taneja","twitter_card":"summary_large_image","twitter_creator":"@KnowbandPlugin","twitter_site":"@KnowbandPlugin","twitter_misc":{"Written by":"Ajay Taneja","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#article","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/"},"author":{"name":"Ajay Taneja","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/091fe95729cba0da363b4fd2a784a893"},"headline":"How to setup Encryption and Decryption between Android and ASP.Net Web Application?","datePublished":"2020-01-07T09:36:19+00:00","dateModified":"2022-07-18T07:16:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/"},"wordCount":229,"commentCount":0,"publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg","keywords":["Android","api decryption","api encryption","ASP.Net Web Application","Decryption","Encryption"],"articleSection":["Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/","url":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/","name":"How to setup Encryption and Decryption between Android and ASP.Net Web Application","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#primaryimage"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg","datePublished":"2020-01-07T09:36:19+00:00","dateModified":"2022-07-18T07:16:25+00:00","description":"In this encryption, we are going to use a secret key for encrypting the string. The algorithm used will be AES with CBC (Cipher Block Chaining) mode.","breadcrumb":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#primaryimage","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2020\/01\/How-to-setup-Encryption-and-Decryption-between-Android-and-ASP.jpeg","width":760,"height":300,"caption":"how-to-setup-encryption-and-decryption-between-android-and-asp"},{"@type":"BreadcrumbList","@id":"https:\/\/www.knowband.com\/blog\/tips\/how-to-setup-encryption-and-decryption-between-android-and-asp-net-web-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knowband.com\/blog\/fr\/"},{"@type":"ListItem","position":2,"name":"How to setup Encryption and Decryption between Android and ASP.Net Web Application?"}]},{"@type":"WebSite","@id":"https:\/\/www.knowband.com\/blog\/fr\/#website","url":"https:\/\/www.knowband.com\/blog\/fr\/","name":"Knowband Blog | Ecommerce Modules","description":"Magento, Prestashop, Opencart, Shopify","publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knowband.com\/blog\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization","name":"Knowband Blog | Ecommerce Modules","url":"https:\/\/www.knowband.com\/blog\/fr\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","width":153,"height":61,"caption":"Knowband Blog | Ecommerce Modules"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Knowband","https:\/\/x.com\/KnowbandPlugin"]},{"@type":"Person","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/091fe95729cba0da363b4fd2a784a893","name":"Ajay Taneja","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/wp-content\/plugins\/wp-user-avatar\/deprecated\/wp-user-avatar\/images\/wpua-96x96.png","url":"https:\/\/www.knowband.com\/blog\/wp-content\/plugins\/wp-user-avatar\/deprecated\/wp-user-avatar\/images\/wpua-96x96.png","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/plugins\/wp-user-avatar\/deprecated\/wp-user-avatar\/images\/wpua-96x96.png","caption":"Ajay Taneja"},"url":"https:\/\/www.knowband.com\/blog\/author\/ataneja\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/463959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/comments?post=463959"}],"version-history":[{"count":8,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/463959\/revisions"}],"predecessor-version":[{"id":816907,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/463959\/revisions\/816907"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/media\/816658"}],"wp:attachment":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/media?parent=463959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/categories?post=463959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/tags?post=463959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}