Class CheckCode
EstablishedEcies
objects share the same secret.
The check code is derived from the shared secret and is intended to be shared out-of-band between the initiator and the recipient to protect against active man-in-the-middle (MITM) attacks.
Since the initiator device can always tell whether a MITM attack is in progress after channel establishment, this code technically carries only a single bit of information, representing whether the initiator has determined that the channel is "secure" or "not secure". However, given that this will need to be interactively confirmed by the user, there is a risk that the user would confirm a dialogue without paying attention to its content. By expanding this single bit into a deterministic two-digit check code, the user is forced to pay more attention by having to enter it instead of just clicking through a dialogue.
- Author:
- François HERBRETEAU
-
Method Summary
-
Method Details
-
asBytes
public byte[] asBytes()Returns the raw bytes of the check code.- Returns:
- a 2-byte array representing the check code
-
toDigit
public int toDigit()Returns the check code as a two-digit base-10 number.The number is in the range 0–99. It should be displayed with a leading zero if the first digit is 0, e.g. using
String.format("%02d", checkCode.toDigit()).- Returns:
- the check code as a two-digit number
-
equals
-
hashCode
-
toString
-