is there a way to specify the encrypted message length when using private and public keys? mainly I want the encrypted message to be 32 bytes? as I'm currently using RSA but that results in a length that is equal to the modulus Length.
1 Answer
Asymmetric cryptography are never space-efficient.
For example, in multivariate cryptography the public key is often the expanded matrix of coefficients of indeterminates, where as the private key are decomposed transformations allowing efficient decryption/signing. Although you can get ciphertext/signature size not too different from plaintext/hash size in multivariate schemes, the public key size is almost always huge.
The reason I bring up multivariate cryptography is 1) it's secure against quantum computers (as far as we know). 2) it's space efficient with ciphertext and plaintext as you've requested (but not with key sizes). and 3) it's a good illustrative comparison with symmetric-key cryptography.
Remember XSL attack? It fails catastrophically because accumulated rounds of AES permutations expands to high-degree multivariate expression of its inputs.
To summarize: You can specify ciphertext size with multivariate cryptography if you have the right scheme. But you loose the ability to specify public-key size there.
You can keep an eye on NIST PQC standardization, where there are some multivariate contenders. But keep in mind, that these schemes are in their earily stages of development.