I have seen many examples of how to use AES through OpenSSL with symmetric encryption. But I am using asymmetric encryption. My webapp is storing some sensitive data encrypted with a public key, which is later only decrypted with the private key if the admin can provide the private key passphrase.
My implementation is working well, however, I am noticing very small inputs produce rather large encrypted results. For example, a 16 character input becomes 288 bytes encrypted (it decrypts to the original 16 characters). Since these encrypted results are stored in a database table, I would like to achieve encrypted values that are much closer to the input size. Predictable storage lengths is desired, too.
I am using RSA public/private keys, but what cipher does PHP's OpenSSL implementation use by default? I haven't found a single example of how to specify a cipher when using public/private keys, and the openssl_public_encrypt function doesn't allow one of the cipher constants to be specified. Am I supposed to be specifying the cipher somehow when the pub/pri keys are generated (using openssl_pkey_new)?