RSAsavekey
RSAsavekey |
Purpose
Synopsis
function RSAsavekey(key:array(range) of integer, kfile:string, ispriv:boolean):integer
function RSAsavekey(key:array(range) of integer, kfile:string):integer
Arguments
key
|
RSA key in the form of an array of integer
|
kfile
|
Destination file
|
ispriv
|
Save the private key if
true, only the public key otherwise
|
Return value
A positive value on success or
-1 in case of error.
Example
In the code below a new 2048 bits key is generated and both, private and public parts are saved into different files:
if RSAgenkey(2048,k)<=0 then writeln("Failed to create RSA key") elif RSAsavekey(k,"perso.key",true)<1 or RSAsavekey(k,"perso",false)<1 then writeln("Failed to save key file") end-if
Further information
1. This function saves the RSA key that is provided as an array of string into a file in a textual representation. The
ispriv parameter can be used to select which part of the key to export.
2. If the
ispriv parameter is not provided, the function will produce a private key file if the key is private and a public key file otherwise.
Related topics
Module