Is it true for Java that the transformation mode and padding is ignored when using RSA? Consider GregS's comment to this question (more specific to bouncycastle's provider implementation):

https://stackoverflow.com/questions/11717646/bouncycastle-rsa-key-size-and-padding


  The mode, ECB in this case, is ignored for RSA.Use PKCSPadding. The
  max amount of data you can encrypt is the size of the modulus in bytes
  minus 11.


I've read several articles that seem to state similar views, including this one:

http://armoredbarista.blogspot.com/2012/09/rsaecb-how-block-operation-modes-and.html

Although that article appears to make the case that it is only ignored when the data exceeds the size of the moduli.

Basically I have a small amount of data to encrypt (a username and password), a private key with a 2048 bit key length, and I'm using the RSA/ECB/PKCS1Padding cipher transformation for encryption. Is this considered "textbook" or "plain" RSA in Java?

I believe I am using a secure approach for our needs, but I need to be sure.
ECB, CBC and such cipher modes are something that relate to symmetric cryptography.
In context of RSA, it is important to study from documentation of the product what they mean as they do not ordinarily apply.

Based on the articles you provide, this statement is correct:


  The mode, ECB in this case, is ignored for RSA.Use PKCSPadding. The max amount of data you can encrypt is the size of the modulus in bytes minus 11.


PKCS#1 standard defines many padding schemes. The more elaborate and less ambiguous name for this scheme and padding is RSAES-PKCS1-v1_5. You just need to ensure that the data you intent to encrypt is at most 245 bytes.



It is common to warn against using textbook RSA. This warning practically means "do not use RSA without using a padding scheme". Thus, RSA with any padding from PKCS#1 is not textbook RSA.

Secure?

In most protocols, what is encrypted with RSA with PKCS#1 padding is a secret key.    Encrypting username and password is significantly less common occurrence. Using RSAES-PKCS1-v1_5 securely needs some care in the application. Long story short, it is possible that this padding scheme would not meet the needs of this use. However, as I don't know the context and other algorithms applied, I cannot know if this is secure or not in this context.

The intent of RSA encryption is to ensure that decryption is only performed by party that has access to the private key. RSA encryption does not authenticate the sender, anybody may send a message which appears correct as far as RSA and the padding scheme is concerned. 

If sender authentication is needed (quite common), it is necessary to use a digital signature scheme, such as RSASSA-PKCS1-v1_5 in conjuction with the encryption algorithm.

There is a newer padding scheme (Optimal Asymmetric Encryption Padding), which addresses some of the outcomings of RSAES-PKCS1-v1_5. However, as a general advice, I would recommend trying to find a security protocol, which'll implement the entire security use case you have. Implementing any practical security protocol from small blocks like this RSA/ECB/PKCS1Padding is tedious and unfortunately error prone.