Q: Cross Platform Asymmetric Encryption and Decryption I have created a self-signed certificate in c#, with a private key created with a RSACryptoServiceProvider, 1024 bytes.
I have encrypted a byte array with the public key.
I have then imported the certificate in an Android device.
I try to decrypt my byte array in Android using my certificate private key. My code in Android:
{
    Cipher cipher = Cipher.getInstance("RSA");
    cipher.init(Cipher.DECRYPT_MODE, privateKey);
    byte[] decryptedBytes = cipher.doFinal(encryptedByte);
}

On the last line I get this error: "java.lang.IllegalStateException".
Here are the exception details:
Java.lang.NullPointerException java.math.BigInteger.remainder(BigInteger.java:919) com.android.org.bouncycastle.crypto.engines.RSACoreEngine.processBlock(RSACoreEn‌​gine.java:181)
com.android.org.bouncycastle.crypto.engines.RSABlindedEngine.processBlock(RSABli‌​ndedEngine.java:109)
com.android.org.bouncycastle.jcajce.provider.asymmetric.rsa.CipherSpi.engineDoFi‌​nal(CipherSpi.java:472)
javax.crypto.Cipher.doFinal(Cipher.java:1111)
all4r.and.dc.Document.decrypt(Document.java:65)
all4r.and.dc.Decrypt$3$1.onSelection(Decrypt.java:101)
all4r.and.utils.Certificate$1.alias(Certificate.java:42)
android.security.KeyChain$AliasResponse.alias(KeyChain.java:284)
android.security.IKeyChainAliasCallback$Stub.onTransact(IKeyChainAliasCallback.j‌​ava:55)
android.os.Binder.execTransact(Binder.java:351)
dalvik.system.NativeStart.run(Native Method)

Any idea on what the cause of the error is? I've been searching for hours, but haven't found the problem yet.
