title: RSA Encryption with unknown format
body: <p>What can be achieved to this encrypted format?</p>
  
  <p>My android app send encrypted messages to the c# server but server want encrypted messages actually like this unknown format<code>chinese words</code>.</p>
  
  <p>[![Unknown encrypted format ][1]][1]</p>
  
  <p>But android encrypt messages like this format (<code>on7vQhgNeVDVDu4evL0HZ5UbC2C1oZdamfU9XBLGZQZ13MLQKu2speIWNaldsfcGfPS</code>)</p>
  
  <p>I use RSA algorithm with same public/private keys in c sharp and android.
  where am i interrupted?</p>
  
  <p>Something wrong with this approach with this unknown format.</p>
  
  <p>Its seems android have problem with class of encryption I don't know what else need to use for this issue    </p>
  
  <p>Thank you for advice  </p>
  
  <p>Android code </p>
  
  <pre><code>          public class MainActivity extends Activity {
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.acti);
      try {
          generateKey();
      } catch (Exception e1) {
          e1.printStackTrace();
      }
  }
  
  public  static void generateKey() throws Exception {
  
  
  
      String modulusString = "tx94IV9NAutFU1HQjXmkLzknJ5vatOFyhD90Un3u5oiOc4e9fT1bsM0af3OqNMCTRLPuQJ2JQokY+3T0icJqHgG/aHvbmvDvRKn2QrVxAFt8EN6jp/S6+dRe1B/6eJbVRJJpeekLslqGqdQgr+5ocD+ZPjiE2iL6sGGyAYz+lOJtSr9N4ZcD4kNikI3J9kZDNO78rEqQuX7flh0RS79N63MJ9xX9fBuqHFIud3KKKbqHiASQoaU1rWqZ2VIdqfXzreZMYHpHYioVzyrbk/wdQQV2ibmJFAsa5aiKSP+g9rF4xYoPAistePDwn4O+wARGlMsu7RYVAIeUM77l+w6ugw==";
      String ExponentString = "AQAB";
      byte[] modulusBytes = Base64.decode(modulusString.getBytes("UTF-8"), Base64.DEFAULT);
      byte[] exponentBytes = Base64.decode(ExponentString.getBytes("UTF-8"),Base64.DEFAULT);
      BigInteger modulus = new BigInteger(1, modulusBytes);
      BigInteger publicExponent = new BigInteger(1, exponentBytes);
  
  
      KeyFactory fact = KeyFactory.getInstance("RSA");
      Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1PADDING");
      String INPUT = "GAVDOOL";
  
      RSAPublicKeySpec rsaPubKey = new RSAPublicKeySpec(modulus, publicExponent);
      PublicKey pubKey = fact.generatePublic(rsaPubKey);
      cipher.init(Cipher.ENCRYPT_MODE, pubKey);
  
    //  byte[] plainBytes = clearTextPassword.getBytes();
      byte[] cipherData = cipher.doFinal(INPUT.getBytes());
      String encryptedStringBase64 = Base64.encodeToString(cipherData, Base64.DEFAULT);
      System.out.println("Encrypted?????"+encryptedStringBase64);
      System.out.println(encryptedStringBase64.length());
  
            }
             }
  </code></pre>
  
  <p>Unknown encrypted format, see this at [1]: <a href="http://i.stack.imgur.com/hF84B.jpg" rel="nofollow">http://i.stack.imgur.com/hF84B.jpg</a></p>