Peter, Thanks for the feedback. I have gotten to the bottom of the problem using BC only. I can successfully encrypt with PKCS1 padded (not encoded as PKCS1) using the private key and can decrypt it using BC using the private key.
Where I have run into issues is encrypting using Microsoft (using private key) and decrypting using BC (using public key). There seems to be an issue with the version of PKCS padding? -----Original Message----- From: Peter Dettman <peter.dett...@bouncycastle.org> Sent: Wednesday, September 9, 2020 10:00 AM To: dev-crypto-csharp@bouncycastle.org Subject: Re: [dev-crypto-csharp] Problems with the RSA decrypt: input data too large Hi Herbert, The second call to ProcessBlock is using 'cipher' when presumably 'cipher1' is intended. Also you are using 'blockLength' for the length in that call, when it should just be 'encrypted.length'. Also, what are you trying to do with the data here, encrypt/decrypt it or sign/verify it? Please check that you don't have the public and private keys mixed up in the Init calls. Regards, Pete Dettman On 6/9/20 2:29 am, Herbert Falk wrote: > IAsymmetricBlockCipher cipher1 = new Pkcs1Encoding(new > RsaEngine()); > cipher1.Init(false, rsaPublic); > try > { > int blockLength = cipher1.GetInputBlockSize(); > retValue = cipher.ProcessBlock(encrypted, 0, > blockLength); > } > catch(Exception ex) > { > string emsg = ex.ToString(); > } > > The encryption works, however the decrypt throws the exception {"input > data too large (Parameter 'inLen')"}. The blocksize is: 0x00000100 > And the size of encrypted is: {byte[0x00000100]} > > Any ideas about why the exception is being thrown