SmartFTP FTP Library
Example

C++

ATL::CComPtr<sfFTPLib::IKeyManager> keyManager;
ATLENSURE_SUCCEEDED(keyManager.CoCreateInstance(__uuidof(sfFTPLib::KeyManager)))));
// Load key from file
ATL::CComPtr<sfFTPLib::IKey> key;
ATLENSURE_SUCCEEDED(keyManager->LoadFile(ATL::CComBSTR(L"Identity"), ATL::CComBSTR(L"Password"), &key));

// Save public key to file
ATLENSURE_SUCCEEDED(keyManager->SaveFile(sfFTPLib::ftpKeyFileFormatSSH, key, sfFTPLib::ftpKeyTypePublicKey, ATL::CComBSTR(L"mykey.pub"), ATL::CComBSTR(L"")));

 

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

Copyright (c) by SmartSoft Ltd. All rights reserved.