System.Tether.Manager.TTetheringAdapter.CheckPassword
Delphi
function CheckPassword(const APassword, Seed: string): Boolean;
C++
bool __fastcall CheckPassword(const System::UnicodeString APassword, const System::UnicodeString Seed);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | protected | System.Tether.Manager.pas System.Tether.Manager.hpp |
System.Tether.Manager | TTetheringAdapter |
Description
Returns True
if the specified hash matches a hash of the concatenation of the password of the adapter manager and the specified seed. It returns False
otherwise.
TTetheringNetworkAdapterCommon and TTetheringBluetoothAdapter use CheckPassword for password validation. After a remote adapter requests to pair its manager with the manager of your adapter:
- If the manager of your adapter is password-protected (TTetheringManager.Password is not an empty string), your adapter generates a random seed for connections with the remote adapter. Your adapter then sends this seed to the remote adapter.
- The remote adapter generates a hash of the concatenation of the password of its manager and the seed that your manager previously sends. Then the network adapter sends this hash to your adapter.
- Your adapter generates a hash of the concatenation of the password of its manager and the seed that your adapter previously generated for connections with the remote adapter. Then your adapter checks whether or not this hash matches the hash that the remote adapter sends.
CheckPassword is responsible for the last step of the process. CheckPassword generates a hash of the concatenation of TTetheringAdapter.Manager.Password and Seed
, and it returns True
if this hash matches APassword
. It returns False
if hashes do not match.
Subclasses of TTetheringAdapter must implement their own system for generating and managing seeds, and use CheckPassword to validate hashes from remote adapters against a seed and the password of the manager of your adapter.