SmartFTP FTP Library
IKeyManager Interface

The key manager can load and save keys from and to files.

IKeyManager
IDL
interface IKeyManager : IDispatch;

C++

// Import SmartFTP FTP Library
#import "libid:7A3A786C-EB8C-43b3-BC10-8D09ACF5D195" version("1.5")

sfFTPLib::IKeyManagerPtr pManager;
if(SUCCEEDED(pManager.CreateInstance(__uuidof(sfFTPLib::KeyManager))))
{
  // Load key from file
  sfFTPLib::IKeyPtr pKey = pManager->LoadFile(_bstr_t(L"Identity"), _bstr_t(L"Password"));
  // Save public key to file
  pManager->SaveFile(sfFTPLib::ftpKeyFileFormatSSH, pKey, sfFTPLib::ftpKeyTypePublicKey, _T("mykey.pub"), _bstr_t(L""));
}

 

To generate a key see the example in the IRSAKey documentation.

IKeyManager Methods 
Description 
Loads a key from a file. 
Saves the key to a file. 
What do you think about this topic? Send feedback!
Copyright (c) by SmartSoft Ltd. All rights reserved.