This method generates a new RSA private/public key pair and returns the data as a pair of bytes objects. By default, this method will generate a 2048 bit key.
The modulus size can be explicitly provided, as can the public exponent. The default values are 2048 and 65537.
cipher_generate_key
cipher_generate_key(4096)
cipher_generate_key(4096, 17)
This example creates a new private/public key pair.
Code
local(privKeyBytes, pubKeyBytes) = cipher_generate_key // default 2048 bits
#privKeyBytes
'\n'
#pubKeyBytes
Result
-----BEGIN RSA PRIVATE KEY----- MIIEowIBAAKCAQEAyiroJj3Flhdt0s+Qi7lPAjEsG61Usg8zVtjOP5gd4praUGQc dWRc1N75DxuBhvgel3pHgrWs6GEcWaH/XU/jYIxFwrHcUnyA7Rg88Ybc921HaYsx 4oIF+k9h3od1P/1ENyrPPTUkehbvLLtlIuba3ncSv2zL2BTTmyi8XD7O+UHLgKC0 du2Jr+NhcEcj2xyRlModw+H1o+8+k+6amra7p1/+tSl5knvzWwFC4gGbhDJLImgT 4y7m0hKc318w9xuVqPxfKfnNzUWZIw2WTeGvMF6qAEecE22QOPfq2I6ggoI6J/gM sTIynn1DVKV7H0Qzn4OYdH3SI/Uy1HwF3tfsZwIDAQABAoIBAEPqJhKyra2+MSag k+5cUi5qVmb10339nUGPk7nJYEC/xJc9ClJlZMoeHYz1sI2mzKAWc+91GKD3/o4d 3at7KudEOCsvlNQg/y6m9dItfA2iqFrMZ/WvuFJeWIJo/vqAGmpt9zCYqahaC/76 9P7EjsItPh8QbWoplOyKwrw6XU1eMzpQ1umfQb+W69Ro0D2+XRyLAiK6WzoCEn5S ls0ORrxxQNG4MxF09EEVA8e8TfUdJf15AgT0A075SYIGA44L1g4qC8V0KLmNC9aI FElPswDEo6NtcnlunjlZdOIcyjfntjxBi+DjiaRANgSuwzgXAV7HpSV/bcxLx2D8 +sjAkAECgYEA/dh5ZK98rpQ3E/Vij4mqIFNWhyegvxtI+wY6wpvZ6Z0NmypxHVoB zV2c/CohRHQTsYYh0OcEO6tKcOYGrUYRS79ExTlxrm5ISAS2oaFxo3LbYmjZk1EM da4D32h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gT4y7m0hKc318w9xuVqPxfKfnNzUWZIw2WTeGv MF6qAEecE22QOPfq2I6ggoI6J/gMsTIynn1DVKV7H0Qzn4OYdH3SI/Uy1HwF3tfs ZwIDAQAB -----END PUBLIC KEY-----
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments