Open chandaniBhalala opened 4 years ago
RSA can only encrypt payloads smaller than the key size, so the usual way to use that is:
Given a payload P
and a public key PK
:
K
P
with symmetric encryption (ie AES) using the generated key: EP = AESEncrypt( P, K )
K
with RSA and public key PK
: EK = RSAEncrypt( K, PK )
PKG
with encrypted key, encrypted payload and size: PKG = { EK, EP, size_of(P) }
Then to decrypt do the opposite:
Given a package PKG
and a private key PRIVK
:
{ EK, EP, SIZE } = PKG
K
from EK
with RSA and private key: K = RSADecrypt( EK, PRIVK )
P
using the key K
and symmetric encryption: P = AESDecrypt( EP, K )
P = Trim_To( P, SIZE )
Getting this exception "Input too large for RSA cipher" when encrypting string with more than 64 characters. Is there any limit of number of characters for encryption?
flutter doctor output Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G2021, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 11.7) [✓] Android Studio (version 4.0) [✓] VS Code (version 1.49.2) [✓] Connected device (3 available)