### RSA Public/Private Key Encryption

Posted:

**Wed Apr 25, 2012 3:39 pm**The only documentation I can find on this, is in the 4.6 Release Notes, which I've quoted below,

in it's entirety. Anyone know of any additional documentation, lessons or examples on this?

The part that confuses me most is where it says the maximum encryptable messages size is 53 bytes.

That's not very long. It might be long enough for a digital certificate, but not for a real message.

in it's entirety. Anyone know of any additional documentation, lessons or examples on this?

The part that confuses me most is where it says the maximum encryptable messages size is 53 bytes.

That's not very long. It might be long enough for a digital certificate, but not for a real message.

Note: RSA Public/Private Encryption algorithm defined.Public key encryption support (4.6)

The encrypt and decrypt commands now support RSA public key encryption. The new forms

supporting this are:

encrypt message using rsa with ( public | private ) key key [ and passphrase passphrase ]

decrypt message using rsa with ( public | private ) key key [ and passphrase passphrase ]

Here key should be in PEM format, optionally protected by passphrase.

The maximum length of a message that can be encrypted using RSA is the size of the key in bytes –

11. So, for a 512-bit key pair, the maximum encryptable message size is 53 bytes.

Generating key pairs

Public-private key pairs can be generated using the OpenSSL suite of command-line tools.

For example:

openssl genrsa -out private_key.pem 512

openssl rsa -pubout -in private_key.pem -out public_key.pem

Will generate a key pair of size 512-bits, placing the private key in private_key.pem and the public

key in public_key.pem.

For more information on these utilities see

http://www.openssl.org/docs/apps/rsa.html and

http://www.openssl.org/docs/apps/genrsa.html.