3.2.4.25 Application Requests the Session Key for an Authenticated Context

The application provides a handle to an Open established on the session of interest. If the handle is invalid or if no Open referenced by the handle is found, the client MUST return an implementation-specific error code locally to the calling application. If the handle is valid and an Open is found and the Open.TreeConnect is NULL, the client MUST return an implementation-specific error code locally to the calling application. If the handle is valid and an Open is found and the Open.TreeConnect is not NULL, the client MUST do the following:

If Connection.Dialect belongs to the SMB 3.x dialect family, the client MUST return Open.TreeConnect.Session.ApplicationKey. Otherwise, the client MUST return Open.TreeConnect.Session.SessionKey.