title: Decrypt RSA encrypted value generated from .net in Android
body: <p>I have gone through many posts here but did not find the right solution. I want to decrypt a value encrypted in c# .net from Android.</p>
  <p>I have successfully decrypted in .net platform using the following code snippet</p>
  <pre><code>public static void Main()
  {
      string _privateKey = Base64Decode(&quot;myprivatekey&quot;);
  
       var rsa = new RSACryptoServiceProvider();
         string data = &quot;198,47,144,175,154,47,194,175,242,41,212,150,220,177,198,161,236,36,197,62,18,111,21,244,232,245,90,234,195,169,141,195,139,199,111,163,26,124,246,50,102,229,73,148,18,110,170,145,112,237,23,123,226,135,158,206,71,823,9,219,56,96,140,19,180,192,80,29,63,160,43,127,204,135,155,67,46,160,225,12,85,161,107,214,104,218,6,220,252,73,252,92,152,543,214,126,245,126,129&quot;;
          var dataArray = data.Split(new char[] { ',' });
          byte[] dataByte = new byte[dataArray.Length];
          for (int i = 0; i &lt; dataArray.Length; i++)
          {
              dataByte[i] = Convert.ToByte(dataArray[i]);
          }
  
          rsa.FromXmlString(_privateKey);
          var decryptedByte = rsa.Decrypt(dataByte, false);
          Console.WriteLine(_encoder.GetString(decryptedByte));       
  }
  </code></pre>
  <p>Now I want to do the same process in Android app. Please can somebody guide me through this?
  I have tried the following code but its throwing <code>javax.crypto.IllegalBlockSizeException: input must be under 128 bytes</code> exception</p>
  <pre><code>        String modulusString = &quot;hm2oRCtP6usJKYpq7o1K20uUuL11j5xRrbV4FCQhn/JeXLT21laKK9901P69YUS3bLo64x8G1PkCfRtjbbZCIaa1Ci/BCQX8nF2kZVfrPyzcmeAkq4wsDthuZ+jPInknzUI3TQPAzdj6gim97E731i6WP0MHFqW6ODeQ6Dsp8pc=&quot;;
          String publicExponentString = &quot;AQAB&quot;;
  
          byte[] modulusBytes = Base64.decode(modulusString, DEFAULT);
          byte[] exponentBytes = Base64.decode(publicExponentString, DEFAULT);
          BigInteger modulus = new BigInteger(1, modulusBytes);
          BigInteger publicExponent = new BigInteger(1, exponentBytes);
  
          RSAPrivateKeySpec rsaPubKey = new RSAPrivateKeySpec(modulus, publicExponent);
          KeyFactory fact = KeyFactory.getInstance(&quot;RSA&quot;);
          PrivateKey pubKey = fact.generatePrivate(rsaPubKey);
          Cipher cipher = Cipher.getInstance(&quot;RSA/ECB/PKCS1PADDING&quot;);
          cipher.init(Cipher.DECRYPT_MODE, pubKey);
  
          byte[] plainBytes = result.getBytes(&quot;UTF-16LE&quot;);
          byte[] cipherData = cipher.doFinal(plainBytes);
          String encryptedStringBase64 = Base64.decode(cipherData, DEFAULT).toString();
  </code></pre>