|
26 | 26 | /**
|
27 | 27 | * Overview
|
28 | 28 | *
|
29 |
| - * Security Manager is used to provide link security through encryption, signing, and authentication |
| 29 | + * Security Manager is used to provide link security through encryption, signing and authentication |
30 | 30 | * which are made possible by pairing and optionally bonding. Pairing is the process of establishing
|
31 | 31 | * and/or exchanging keys used for the current connection. Bonding means saving this information so that
|
32 | 32 | * it can later be used after reconnecting without having to pair again. This saves time and power.
|
|
37 | 37 | *
|
38 | 38 | * The important settings in the init() function are the MITM requirement and IO capabilities. Man in the
|
39 | 39 | * Middle (MITM) protection prevents an attack where one device can impersonate another device by
|
40 |
| - * pairing with both devices at the same time. This protection is achieved sharing some information |
| 40 | + * pairing with both devices at the same time. This protection is achieved by sharing some information |
41 | 41 | * between the devices through some independent channel. The IO capabilities of both devices dictate
|
42 | 42 | * what algorithm is used. For details @see BLUETOOTH SPECIFICATION Version 5.0 | Vol 3, Part H - 2.3.5.1.
|
43 | 43 | * You can change the IO capabilities after initialisation with setIoCapability(). This will take effect
|
|
50 | 50 | * and provided to the Security Manager. Use setOOBDataUsage() to indicate you want to use it. The same call also
|
51 | 51 | * allows you to set whether or not the communication channel you are using to transmit the OOB data is
|
52 | 52 | * itself secure against MITM protection - this will set the level of the link security achieved using pairing
|
53 |
| - * using this data. |
| 53 | + * that uses this data. |
54 | 54 | *
|
55 |
| - * The most secure pairing is provided by Secure Connections which relies on public key cryptography. |
| 55 | + * The most secure pairing is provided by Secure Connections which relies on Elliptical Curve Cryptography. |
56 | 56 | * Support for Secure Connections is dependent on both the stack and controller on both sides supporting
|
57 | 57 | * it. If either side doesn't support it Legacy Pairing will be used. This is an older standard of pairing.
|
58 | 58 | * If higher security is required legacy pairing can be disabled by calling allowLegacyPairing(false);
|
|
62 | 62 | * First thing you need to do is to initialise the manager by calling init() with your chosen settings.
|
63 | 63 | *
|
64 | 64 | * The SecurityManager communicates with your application through events. These will trigger calls in
|
65 |
| - * the EventHandler you must provide by calling the setSecurityManagerEventHandler() function. |
| 65 | + * the EventHandler which you must provide by calling the setSecurityManagerEventHandler() function. |
66 | 66 | *
|
67 | 67 | * The most important process is pairing. This may be triggered manually by calling requestPairing() or
|
68 |
| - * may be called as a result of the application requiring encryption or encryption through |
69 |
| - * requestAuthentication() or setLinkEncryption(). |
| 68 | + * may be called as a result of the application requiring encryption by calling setLinkEncryption() or |
| 69 | + * as a result of the application requiring MITM protection through requestAuthentication(). |
70 | 70 | *
|
71 | 71 | * All these can be implicitly called by using setLinkSecurity() to conveniently set the required
|
72 | 72 | * security for the link. The SecurityManager will trigger all the process required to achieve the set
|
73 |
| - * security level. |
| 73 | + * security level. Security level can only be escalated. Asking the Security Manager for a lower |
| 74 | + * security level than the existing one will not fail but will result in a event informing the |
| 75 | + * application through linkEncryptionResult() of the current level (which remains unchanged). |
74 | 76 | *
|
75 | 77 | * Depending on the IO capabilities and OOB usage settings different pairing algorithms will be chosen.
|
76 |
| - * They will produce appropriate events which must be handled by your EventHandler. |
| 78 | + * They will produce appropriate events which must be handled by your EventHandler. If your event handler |
| 79 | + * doesn't support all the calls you must not set IO capabilities or set OOB usage in such a way that would |
| 80 | + * trigger them or else the pairing will fail (usually by timing out). |
77 | 81 | *
|
78 |
| - * The simplest example would be a pairing of a device with no IO capabilities and no OOB data available. |
| 82 | + * The simplest example is a pairing of a device with no IO capabilities and no OOB data available. |
79 | 83 | * With such limited pairing capabilities the "just works" method will be employed. This does not provide
|
80 | 84 | * any MITM protection. The pairing (triggered implicitly or called explicitly) will result in an event
|
81 | 85 | * being generated on the peer calling pairingRequest(). The event handler must make a decision (either in
|
|
132 | 136 | * |<- passkeyRequest() <--------------| |----------------> passkeyDisplay() ->|
|
133 | 137 | * | | | | | |
|
134 | 138 | *
|
135 |
| - * user reads the passkey on Device 2 and inputs it in Device 1 |
| 139 | + * user reads the passkey on Device 2 and inputs it on Device 1 |
136 | 140 | *
|
137 | 141 | * | | | | | |
|
138 | 142 | * |-------------------------->passkeyEntered() | | |
|
|
0 commit comments