procedure ExportTo(const FileName: string; const PublicKeyOnly: Boolean; const Password: string; const Cipher: TScSymmetricAlgorithm = saTripleDES; const KeyFormat: TScKeyFormat = kfDefault; const Comment: string = ''); overload;

procedure ExportTo(Stream: TStream; const PublicKeyOnly: Boolean; const Password: string; const Cipher: TScSymmetricAlgorithm = saTripleDES; const KeyFormat: TScKeyFormat = kfDefault; const Comment: string = ''); overload;

 

Description

Use this method to export the key to file or to stream.

The key can be exported in different formats. Some formats let store only private keys, other - both private and public. It is possible to store the key in encrypted form to protect it from illegal access. In this case you should specify encryption algorithm and password.

Some formats also let you store additional information about the key except key data.

 

Parameters:

FileName - specifies file name in which the key will be exported. If the file with specified name does not exist, in will be created. The existent file will be overwritten.
Stream - pointer to the stream in which the key will be exported. Data will be appended to the stream.
PublicKeyOnly - determines, whether only the public key or both public and private keys will be exported. If the current key contains only public constituent, an attempt to save the private key will lead to raising the exception.
Password - determines password that is used by encryption algorithm for storing the key in encrypted form. If the Password is not specified, the key will be stored in open form.
Cipher - encryption algorithm name that is used for storing the key in encrypted form.
KeyFormat - the data format which will be used for storing the key.
Comment - an additional information defined by user.

 

Note: You can only store the public keys in open form. Therefore, when you try to save a public key with the Password parameter assigned, an exception will be raised.

 

See also

TScKeyFormat

ImportFrom

Generate

 

SecureBridge Components, Copyright © 2007-2021 Devart. All Rights Reserved. Provide Feedback Visit Forum Request Support