3.1.4.25 R_KeyExchangePhase1 (Opnum 26)

The R_KeyExchangePhase1 method receives a pair of encrypted client keys and returns server encryption and session keys.

 HRESULT R_KeyExchangePhase1(
   [unique, in] IIS_CRYPTO_BLOB* pClientKeyExchangeKeyBlob,
   [unique, in] IIS_CRYPTO_BLOB* pClientSignatureKeyBlob,
   [out] IIS_CRYPTO_BLOB** ppServerKeyExchangeKeyBlob,
   [out] IIS_CRYPTO_BLOB** ppServerSignatureKeyBlob,
   [out] IIS_CRYPTO_BLOB** ppServerSessionKeyBlob
 );

pClientKeyExchangeKeyBlob: A pointer to an IIS_CRYPTO_BLOB structure containing the encrypted client key used to decrypt client data.

pClientSignatureKeyBlob: A pointer to an IIS_CRYPTO_BLOB structure containing the encrypted client signature key used for data verification.

ppServerKeyExchangeKeyBlob: A pointer to a set of IIS_CRYPTO_BLOB structures containing encrypted server keys used by the client to decrypt server data.

ppServerSignatureKeyBlob: A pointer to a set of IIS_CRYPTO_BLOB structures containing encrypted server signature keys used for data verification.

ppServerSessionKeyBlob: A pointer to a set of IIS_CRYPTO_BLOB structures containing encrypted server session keys.

Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it failed. If the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a Win32 error code in the lower 16 bits. Zero or positive values indicate success, with the lower 16 bits in positive nonzero values containing warnings or flags defined in the method implementation. For more information about Win32 error codes and HRESULT values, see [MS-ERREF].

Return value/code

Description

0x00000000

S_OK

The call was successful.

The opnum field value for this method is 26.

When the server receives the R_KeyExchangePhase1 method, it SHOULD check the state of the secure session. If the session was already negotiated, the server SHOULD return the E_INVALIDARG error code.

If the session was not negotiated yet, the server MUST perform the following steps:

  1. Store the client's key exchange public key that was received in the message.

  2. Store the client's signature public key that was received in the message.

  3. Generate or locate the server's key exchange private key.

  4. Generate or locate the server's signature private key.

  5. Generate the server's session key.

  6. Encrypt the server's session key using the client's key exchange public key that was just received.

  7. Calculate the signed hash of the encrypted server's session key, as described in section 3.1.4.1.4. Use the server's signature private key for signing.

  8. Build an IIS_CRYPTO_BLOB structure with the BlobSignature field set to SESSION_KEY_BLOB_SIGNATURE to store the server's encrypted session key and signed hash as calculated in the previous steps.

  9. Build an IIS_CRYPTO_BLOB structure with the BlobSignature field set to PUBLIC_KEY_BLOB_SIGNATURE to store the server's key exchange public key.

  10. Build an IIS_CRYPTO_BLOB structure with the BlobSignature field set to PUBLIC_KEY_BLOB_SIGNATURE to store the server's signature public key.

  11. Send an IIS_CRYPTO_BLOB structure that was built in the previous three steps to the client in response to the R_KeyExchangePhase1 method.