|
SmartFTP FTP Library
|
Encapsulates a cryptographic key pair, public key, or certificate. More...
import "sfFTPLib.idl";
Public Member Functions | |
| HRESULT | ImportBlob ([in] LPCWSTR pszBlobType, [in, size_is(cbInput)] byte *pbInput, [in] ULONG cbInput) |
| Loads a key or certificate from a memory buffer. | |
| HRESULT | Verify ([in] HashAlgo hashAlgo, [in, size_is(cbSignature)] byte *pbSignature, [in] ULONG cbSignature, [in, size_is(cbInput)] byte *pbInput, [in] ULONG cbInput, [in] ULONG flags) |
| Verifies a digital signature against a data blob. | |
| HRESULT | ExportKey ([in] LPCWSTR pszBlobType, [out, size_is(*pcbData)] byte *pbData, [in, out] ULONG *pcbData) |
| Serializes the key to a memory buffer. | |
| HRESULT | Sign ([in] HashAlgo hashAlgo, [in, size_is(cbInput)] byte *pbInput, [in] ULONG cbInput, [out, size_is(*pcbSignature)] byte *pbSignature, [in, out] ULONG *pcbSignature, [in] ULONG flags) |
| Generates a digital signature for a data blob. | |
| HRESULT | SetProperty ([in] LPCWSTR pszProperty, [in, size_is(cbInput)] byte *pbInput, [in] ULONG cbInput, [in] ULONG dwFlags) |
| Sets advanced or algorithm-specific properties. | |
Properties | |
| KeyType | Type [get] |
| Retrieves the classification of the key (e.g., Private, Public, or None). | |
| long | Bits [get] |
| Retrieves the strength of the key in bits. | |
| KeyAlgo | Algo [get] |
| Identifies the cryptographic algorithm used by this key. | |
| VARIANT | Certificate [get] |
| Retrieves the raw certificate data associated with this key, if any. | |
| CertificateType | CertificateType [get] |
| Indicates the format of the attached certificate. | |
Encapsulates a cryptographic key pair, public key, or certificate.
This interface represents a cryptographic entity used for authentication and data integrity. It abstracts over various algorithms (RSA, DSA, ECDSA, Ed25519) and formats, providing a unified way to perform operations like Signing and Verification.
Usage Scenarios:
| HRESULT IKey::ExportKey | ( | [in] LPCWSTR | pszBlobType, |
| [out, size_is(*pcbData)] byte * | pbData, | ||
| [in, out] ULONG * | pcbData ) |
Serializes the key to a memory buffer.
Memory Handling: Standard COM buffer pattern:
| [in] | pszBlobType | Target format |
| [out] | pbData | Buffer to receive the key data. |
| [in,out] | pcbData | Input: Size of buffer. Output: Actual bytes written. |
| HRESULT IKey::ImportBlob | ( | [in] LPCWSTR | pszBlobType, |
| [in, size_is(cbInput)] byte * | pbInput, | ||
| [in] ULONG | cbInput ) |
Loads a key or certificate from a memory buffer.
| [in] | pszBlobType | String constant identifying the input format. |
| [in] | pbInput | Pointer to the byte array containing the key data. |
| [in] | cbInput | Size of the input buffer in bytes. |
| HRESULT IKey::SetProperty | ( | [in] LPCWSTR | pszProperty, |
| [in, size_is(cbInput)] byte * | pbInput, | ||
| [in] ULONG | cbInput, | ||
| [in] ULONG | dwFlags ) |
Sets advanced or algorithm-specific properties.
Purpose: Allows configuration of properties that do not fit into the standard getters.
| [in] | pszProperty | Name of the property to set. |
| [in] | pbInput | Value of the property (binary or string data). |
| [in] | cbInput | Size of the input data. |
| [in] | dwFlags | Flags modifying the set operation. |
| HRESULT IKey::Sign | ( | [in] HashAlgo | hashAlgo, |
| [in, size_is(cbInput)] byte * | pbInput, | ||
| [in] ULONG | cbInput, | ||
| [out, size_is(*pcbSignature)] byte * | pbSignature, | ||
| [in, out] ULONG * | pcbSignature, | ||
| [in] ULONG | flags ) |
Generates a digital signature for a data blob.
Requirement: The IKey object must contain a Private Key. If it only contains a Public Key, this method will return an error.
Mechanism: Hashes the input data using hashAlgo and encrypts the hash with the private key components.
| [in] | hashAlgo | The hashing algorithm to use (e.g., SHA-256, SHA-512). |
| [in] | pbInput | The data to be signed. |
| [in] | cbInput | Size of the data to be signed. |
| [out] | pbSignature | Buffer to receive the signature. |
| [in,out] | pcbSignature | Input: Buffer size. Output: Bytes written. |
| [in] | flags | Options for signing (e.g., probabilistic signatures). |
| HRESULT IKey::Verify | ( | [in] HashAlgo | hashAlgo, |
| [in, size_is(cbSignature)] byte * | pbSignature, | ||
| [in] ULONG | cbSignature, | ||
| [in, size_is(cbInput)] byte * | pbInput, | ||
| [in] ULONG | cbInput, | ||
| [in] ULONG | flags ) |
Verifies a digital signature against a data blob.
Uses the Public Key component to ensure that pbSignature was generated by the holder of the corresponding Private Key and that pbInput has not been tampered with.
| [in] | hashAlgo | The hashing algorithm used (e.g., SHA-256). |
| [in] | pbSignature | The signature bytes to verify. |
| [in] | cbSignature | Size of the signature buffer. |
| [in] | pbInput | The original data that was signed. |
| [in] | cbInput | Size of the original data. |
| [in] | flags | Bitmask for verification options (usually 0). |
|
getproperty |
Identifies the cryptographic algorithm used by this key.
This property returns the precise algorithm identifier (e.g., ftpKeyAlgoEd25519, ftpKeyAlgoMlDsa65) rather than just a generic family.
| [out] | retval | Receives the KeyAlgo enumeration value. |
|
getproperty |
Retrieves the strength of the key in bits.
Common Values:
|
getproperty |
Retrieves the raw certificate data associated with this key, if any.
Content: If the key was loaded from a certificate (or has a certificate attached), this variant contains the raw binary blob (array of bytes). If no certificate is present, this is empty.
|
getproperty |
Indicates the format of the attached certificate.
Helps determine how to parse the data returned by the Certificate property.
|
getproperty |