Initializing help system before first use

# RSAsavekey

Purpose
Save an RSA key to a file.
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
RSAloadkey, RSAgenkey
Module
mmssl
Parent Topic Procedures and functions

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.