Redigera

Dela via


SslEncryptPacket function

The SslEncryptPacket function encrypts a single Secure Sockets Layer protocol (SSL) packet.

Syntax

SECURITY_STATUS WINAPI SslEncryptPacket(
  _In_    NCRYPT_PROV_HANDLE hSslProvider,
  _Inout_ NCRYPT_KEY_HANDLE  hKey,
  _In_    PBYTE              *pbInput,
  _In_    DWORD              cbInput,
  _Out_   PBYTE              pbOutput,
  _In_    DWORD              cbOutput,
  _Out_   DWORD              *pcbResult,
  _In_    ULONGLONG          SequenceNumber,
  _In_    DWORD              dwContentType,
  _In_    DWORD              dwFlags
);

Parameters

hSslProvider [in]

The handle of the SSL protocol provider instance.

hKey [in, out]

The handle to the key that is used to encrypt the packet.

pbInput [in]

A pointer to the buffer that contains the packet to be encrypted.

cbInput [in]

The length, in bytes, of the pbInput buffer.

pbOutput [out]

A pointer to a buffer to receive the encrypted packet.

cbOutput [in]

The length, bytes, of the pbOutput buffer.

pcbResult [out]

The number of bytes written to the pbOutput buffer.

SequenceNumber [in]

The sequence number that corresponds to this packet.

dwContentType [in]

The content type that corresponds to this packet, which specifies the higher level protocol used to process the enclosed packet.

Value Meaning
CT_CHANGE_CIPHER_SPEC
20
Indicates a change in the ciphering strategy.
CT_ALERT
21
Indicates that the enclosed packet contains an alert.
CT_HANDSHAKE
22
Indicates that the enclosed packet is part of the handshake protocol.
CT_APPLICATIONDATA
23
Indicates that the packet contains application data.

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_INVALID_HANDLE
0x80090026L
One of the provided handles is not valid.

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