> gkey = RSA.generate(384, Random.new().read) > string = str((gkey.publickey().__getstate__(),(333,444))) You are encrypting with RSA a piece of data which is way larger than the key size (48 bytes).