# Why can't Encrypt handle messages bigger than very small?

This

keys = GenerateAsymmetricKeyPair[];
message = Rasterize[Graphics[Disk[]], RasterSize -> 10];
Encrypt[keys["PrivateKey"], message]


generates the error

Encrypt::len: Input too long for this encryption method.


despite the message having a ByteCount of only 4144. Is this some kind of error, or is there a reason why non-tiny messages are infeasible? (11.1.0, OS X)

• You could try other short messages, to see if the problem is really the length or actually some other feature of what you are trying to encrypt – mikado Jun 18 '17 at 16:34

When using GenerateAsymmetricKeyPair the key size must be longer than the message. So the following works.
keys = GenerateAsymmetricKeyPair[Method -> <|"KeySize" -> 5000|>];

The default for "KeySize" is 4096 which is a bit too small for your raster of 4144 bytes.