Is RSA a stream cipher or a block cipher?
It is neither a stream cipher nor a block cipher. Both of these use the same key to encrypt and decrypt (symmetric encryption).
RSA is asymmetric meaning you encrypt with a different key than you decrypt with. The advantage is that the encryption key can be made public, since people can only use it to encrypt and no one can decrypt if you keep the decryption key to yourself.
Unlike (generalization) block and stream ciphers, RSA is based directly on mathematics.
RSA is a block cipher and can use variable-length block sizes. Simply because it is not symmetric does not mean it can not be a block or stream cipher. Further, while it is not intended to be used as a block cipher, it is nonetheless a block cipher. Confused yet? :)
RSA is typically meant to only encrypt very small pieces of data, typically hashes and symmetric key that are then used to encrypt the majority of the data. However, RSA encryption/decryption works on blocks of data, usually 64 or 128 bits at a time. The size of the blocks is determined at run time. Since the requisite data can often be en(de)crypted in a single use, it is often mistakenly assumed that it is not a block cipher because the data is a single block, rather than several. This does not change the fact that it does indeed work in a block cipher manner.
RSA is the acronym/initialism of three cryptographers Ron Rivest, Adi Shamir, and Len Adleman who founded a security company of the same name.
This is important because "RSA" can refer to a wide range of cryptographic products and patents:
- RSA public-key cryptography: An asymmetric algorithm published in 1977 that uses the difficulty of factoring large integers into primes to protect sharing of secrets over a public network.
- RC4 stream cipher: A symmetric cipher that converts a short shared secret into a pseudorandom number generator (keystream) to encrypt data. Invented as a RSA trade-secret in 1987 and leaked in 1994.
- RC2, RC5 and RC6 block ciphers: Block ciphers encrypt a single small block according to the shared secret - the core design trick being on how the shared secret is securely propagated across blocks. Some of these ciphers were trade-secrets, some were published openly (when obliged to).
- RSA SecuriID One-Time-Passwords: A hardware or software pseudorandom password number generator derived off a shared 128-bit secret known by both the server and the client. Like most RSA products, this one-time-password algorithm is a trade-secret - but a reversed engineered one.