These formulas will help you estimate the size of encrypted/decrypted data :
PTS : Plain text size (in bytes)
CTS : Cipher text size (in bytes)
IVS : Initialization vector size (in bytes)
KPS : Key Pair size (in bits). The one passed to SetRandomKeyPair.
Twofish/Rijndael
—————-
Free blocks : CTS = PTS + PADDING -> CTS = PTS + 16 – ( PTS MOD 16 )
Chained blocks : CTS = PTS + IVS + PADDING -> CTS = PTS + 16 + 16 – ( PTS MOD 16 )
RSA-OAEP
——–
The following formula should work in all cases except if PTS = 0
MaxPTSBlock = CEILING( KPS / 8 ) – 43, where 43 is the OAEP hash size + padding.
CTS : CEILING( PTS / MaxPTSBlock ) * CEILING( KPS / 8 ) + FLOOR( PTS / MaxPTSBlock )
Imported from legacy forums. Posted by Xceed admin (had 1787 views)