Second, the BCC may not allow
encryption to be turned off. This may be a system-wide policy, or
another application may be running on the device that requires the
link to be encrypted. For all of these reasons, a call to encrypt() should
be considered a request and its return value checked.
The ?¬?nal method in the RemoteDevice class that allows a change
in the security of a connection is the authorize() method. Recall that
authorization is done on a connection basis as opposed to a link basis.
The authorize() method takes the Connection object to authorize.
Because authorization requires a link to be authenticated, a call to
authorize() can cause authentication and pairing if these events
have not occurred on the link. After it has been veri?¬?ed that the link
has been authenticated, the authorize() method requests the BCC to
authorize the connection. The authorize() method returns true if
the connection is authorized and false if the connection is not
authorized.
The RemoteDevice class has three methods that allow an
application to determine the security level on a connection. The
isAuthenticated() and isEncrypted() methods return true if
the link to the remote device has been authenticated or encrypted,
respectively. Both methods return false if the requested security is
not enabled or if there is no link between the two devices.
Pages:
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193