Using security on outgoing sockets

For an outgoing connection, the Bluetooth stack will not, by default, enforce any particular Bluetooth security. If the remote device requires authentication/encryption to connect, then this will be handled by the stack transparently to the application.

How to use security on outgoing sockets

It may occasionally be necessary for the local application to insist on authenticating or encrypting the link. In this case, there are control operations (ioctls) that can be issued on a connected RSocket that will authenticate (ioctl KHCIAuthRequestIoctl) or encrypt (KHCIEncryptIoctl) the link.

Issuing Authentication Requests

The following example shows the authentication request ioctl being issued.

// Assume you have an opened L2CAP RSocket object, socket
socket.Ioctl(KHCIAuthRequestIoctl, status, NULL, KSolBtHCI);
if (status==KErrNone)
    \\ Success...

Where Next?

This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.