Redigera

Dela via


SslImportKey function

The SslImportKey function imports a key into the Secure Sockets Layer protocol (SSL) protocol provider.

Syntax

SECURITY_STATUS WINAPI SslImportKey(
  _In_  NCRYPT_PROV_HANDLE hSslProvider,
  _Out_ NCRYPT_KEY_HANDLE  *phKey,
  _In_  LPCWSTR            pszBlobType,
  _In_  PBYTE              pbKeyBlob,
  _In_  DWORD              cbKeyBlob,
  _In_  DWORD              dwFlags
);

Parameters

hSslProvider [in]

The handle to the SSL protocol provider instance.

phKey [out]

A pointer to the handle of the cryptographic key to receive the imported key.

pszBlobType [in]

A null-terminated Unicode string that contains an identifier that specifies the type of BLOB that is contained in the pbInput buffer. This can be one of the following values.

Value Meaning
BCRYPT_DH_PUBLIC_BLOB
Export a Diffie-Hellman public key. The pbOutput buffer receives a BCRYPT_DH_KEY_BLOB structure immediately followed by the key data.
BCRYPT_ECCPUBLIC_BLOB
Export an elliptic curve cryptography (ECC) public key. The pbOutput buffer receives a BCRYPT_ECCKEY_BLOB structure immediately followed by the key data.
BCRYPT_OPAQUE_KEY_BLOB
Export a symmetric key in a format that is specific to a single cryptographic service provider (CSP). Opaque BLOBs are not transferable and must be imported by using the same CSP that generated the BLOB.
BCRYPT_RSAPUBLIC_BLOB
Export an RSA public key. The pbOutput buffer receives a BCRYPT_RSAKEY_BLOB structure immediately followed by the key data.

pbKeyBlob [in]

A pointer to the buffer that contains the key BLOB.

cbKeyBlob [in]

The size, in bytes, of the pbKeyBlob buffer.

dwFlags [in]

This parameter is reserved for future use.

Return value

If the function succeeds, it returns zero.

If the function fails, it returns a nonzero error value.

Possible return codes include, but are not limited to, the following.

Return code/value Description
NTE_NO_MEMORY
0x8009000EL
Not enough memory is available to allocate necessary buffers.
NTE_INVALID_HANDLE
0x80090026L
The hSslProvider handle is not valid.
NTE_INVALID_PARAMETER
0x80090027L
The phKey parameter is NULL.

Remarks

You can use the SslImportKey function to import session keys as a part of the process of transferring session keys from one process to another.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2008 [desktop apps only]
Header
Sslprovider.h
DLL
Ncrypt.dll