Root > Reference > All Functions > RSAGenKey

Function RSAGenKey

Previous pageReturn to chapter overviewNext page   

Creates new RSA key.







Code (Delphi)

function RSAGenKey(

const AKeyBitSize: Cardinal = 4096

): TRSAKey;



AKeyBitSize [in, opt]

Size of new key in bits. Default is 4096. Minimum is 384. Maximum is 16384. Must be a factor of 8.


Return value

Generated RSA key.


Delete this key by using RSADestroyKey function.



This function generates a new RSA key (public/private keys pair). The returned key must be deleted by RSADestroyKey function once you have finished working with it.


Resulting key may be used for encryption using RSAEncrypt function or for digital signature using RSASign function.


Resulting key may be exported by using RSASavePublicKey and RSASavePrivateKey functions.


You may import previosly created key instead of generating new key. Use RSALoadPublicKey and/or RSALoadPrivateKey functions.


RSA is one of the first practical public-key cryptosystems and is widely used for secure data transmission. RSA is a relatively slow algorithm, and because of this it is less commonly used to directly encrypt user data. More often, RSA passes encrypted shared keys for symmetric key cryptography which in turn can perform bulk encryption-decryption operations at much higher speed.



It is currently recommended that key size be at least 2048 bits long for security reasons.


See also

Send feedback... Build date: 2022-03-28
Last edited: 2022-03-28
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.

Permanent link to this article: