|
SmartFTP FTP Library
|
import "sfFTPLib.idl";
Public Member Functions | |
| HRESULT | LoadFile ([in] BSTR file, [in] BSTR password, [out, retval] IKey **retval) |
| Loads a cryptographic key from a local file. | |
| HRESULT | SaveFile ([in] KeyFileFormat fileFormat, [in] IKey *key, [in] KeyType keyType, [in] BSTR file, [in] BSTR password) |
| Saves a key object to a file in a specified format. | |
| HRESULT | LoadFromCertificateStore ([in] BSTR thumbprint, [out, retval] IKey **retval) |
| Loads a cryptographic key from the Windows "Personal" (My) Certificate Store. | |
| HRESULT IKeyManager::LoadFile | ( | [in] BSTR | file, |
| [in] BSTR | password, | ||
| [out, retval] IKey ** | retval ) |
Loads a cryptographic key from a local file.
This method automatically detects the format of the provided file. It supports common formats such as OpenSSH, PuTTY (.ppk), and PKCS#12 (.p12/.pfx).
| [in] | file | The full path to the key file on the local file system. |
| [in] | password | The passphrase used to decrypt the private key. If the key is not password protected, this should be an empty string. |
| [out] | retval | Returns an IKey interface representing the loaded key. |
| HRESULT IKeyManager::LoadFromCertificateStore | ( | [in] BSTR | thumbprint, |
| [out, retval] IKey ** | retval ) |
Loads a cryptographic key from the Windows "Personal" (My) Certificate Store.
This method allows the library to leverage the Windows Certificate Management infrastructure. It is particularly useful for enterprise environments where keys are managed centrally or stored on hardware devices.
Security Advantages:
How to obtain the Thumbprint:
| [in] | thumbprint | The SHA-1 hash of the certificate. This acts as a unique ID to locate the key pair. |
| [out] | retval | Returns an IKey interface linked to the store entry. |
| HRESULT IKeyManager::SaveFile | ( | [in] KeyFileFormat | fileFormat, |
| [in] IKey * | key, | ||
| [in] KeyType | keyType, | ||
| [in] BSTR | file, | ||
| [in] BSTR | password ) |
Saves a key object to a file in a specified format.
This method exports an IKey object to the local file system.
| [in] | fileFormat | The destination container format (e.g., OpenSSH, PuTTY, or PKCS#12). See KeyFileFormat. |
| [in] | key | The IKey interface instance to be exported. |
| [in] | keyType | Specifies which component of the key to save: the Public part, the Private part, or both. See KeyType. |
| [in] | file | The full destination path including the filename and extension. |
| [in] | password | The passphrase used to encrypt the resulting file. Pass an empty string for no encryption (only recommended for public keys). |