Hello all,
I'm new to encryption. I'm using an OpenSSL 0.9.6 to encrypt data
using RSA. The data length is about 4 times longer against
RSA_size() of my key. To encrypt all data I split it to blocks with
length equal to key size and encrypt one by one w/o PADDING. The
last block, if its length less than key size should be encrypted
with XXX_PADDING. But, for example, PKCS1_PADDING needs to have at
least 11 bytes difference between data and key lengths. So if for
the last data block length difference less than 11 bytes, I must
split this block again to have 2 blocks with difference greater 11
to encrypt all data. Finally on the decryption step I don't know if
there are 2 or 1 PADDED blocks at the end of data. Currently I
decrypt data till the two blocks remaining. Then try decrypt block
before last with PADDING and if error occurs (possible block was
encrypted without PADDING) try to decrypt it w/o PADDING (typically
decrypts ok). The same situation with the last block.
So I have a question. Is my schema write or it is another more clear
way to use RSA cipher with OpenSSL library ?
Best regards,
Fedor Utenkov
ABG Card Technology
mailto:[EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]