Ho un'applicazione Windows 7, che utilizza Stollmann SDK per collegare correttamente PC con Android. Il bidirezionale scambio di Bluetooth indirizzo MAC, hash e randomizer è effettuata fuori banda tramite NFC:Bluetooth Secure Simple Pairing (SSP) tramite codice QR come canale Out of Band (OOB)
Il codice sorgente dell'applicazione di Windows, purtroppo, non può essere condivisa qui. Sul lato Android non è necessaria alcuna app e l'abbinamento semplice sicuro viene eseguito dal sistema operativo (per HandoverManager?) Una volta ricevuto un messaggio NDEF con application/vnd.bluetooth.ep.oob
.
Ora sto cercando di creare an Android app, che utilizzerebbe unidirezionale di autenticazione per eseguire OOB accoppiamento tramite codice a barre a scansione (invece di NFC).
Un codice QR personalizzato viene visualizzato sullo schermo del PC (generato da ZXing.Net) e contiene indirizzo MAC Bluetooth, hash e randomizzatore.
Tuttavia OOB legame sembra non essere ancora implementato in Android -
/**
* Read the local Out of Band Pairing Data
* <p>Requires {@link android.Manifest.permission#BLUETOOTH}
*
* @return Pair<byte[], byte[]> of Hash and Randomizer
*
* @hide
*/
public Pair<byte[], byte[]> readOutOfBandData() {
if (getState() != STATE_ON) return null;
//TODO(BT
/*
try {
byte[] hash;
byte[] randomizer;
byte[] ret = mService.readOutOfBandData();
if (ret == null || ret.length != 32) return null;
hash = Arrays.copyOfRange(ret, 0, 16);
randomizer = Arrays.copyOfRange(ret, 16, 32);
if (DBG) {
Log.d(TAG, "readOutOfBandData:" + Arrays.toString(hash) +
":" + Arrays.toString(randomizer));
}
return new Pair<byte[], byte[]>(hash, randomizer);
} catch (RemoteException e) {Log.e(TAG, "", e);}*/
return null;
}
/**
* Start the bonding (pairing) process with the remote device using the
* Out Of Band mechanism.
*
* <p>This is an asynchronous call, it will return immediately. Register
* for {@link #ACTION_BOND_STATE_CHANGED} intents to be notified when
* the bonding process completes, and its result.
*
* <p>Android system services will handle the necessary user interactions
* to confirm and complete the bonding process.
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
*
* @param hash - Simple Secure pairing hash
* @param randomizer - The random key obtained using OOB
* @return false on immediate error, true if bonding will begin
*
* @hide
*/
public boolean createBondOutOfBand(byte[] hash, byte[] randomizer) {
//TODO(BT)
/*
try {
return sService.createBondOutOfBand(this, hash, randomizer);
} catch (RemoteException e) {Log.e(TAG, "", e);}*/
return false;
}
/**
* Set the Out Of Band data for a remote device to be used later
* in the pairing mechanism. Users can obtain this data through other
* trusted channels
*
* <p>Requires {@link android.Manifest.permission#BLUETOOTH_ADMIN}.
*
* @param hash Simple Secure pairing hash
* @param randomizer The random key obtained using OOB
* @return false on error; true otherwise
*
* @hide
*/
public boolean setDeviceOutOfBandData(byte[] hash, byte[] randomizer) {
//TODO(BT)
/*
try {
return sService.setDeviceOutOfBandData(this, hash, randomizer);
} catch (RemoteException e) {Log.e(TAG, "", e);} */
return false;
}
La mia domanda:
Dal OOB Blu l'accoppiamento dei denti funziona bene su NFC su Android - pensi che ci sia un modo (hacker) di fare lo stesso tramite il codice QR?
Forse (pazza idea) alimentando HandoverManager
con un messaggio NDEF falso?
Non so se è possibile, ma amo la tua pazza idea. Ecco uno sparo al buio che non ho il tempo di testare adesso, ma l'NFC invia una trasmissione quando viene attivata? https://play.google.com/store/apps/details?id=lt.andro.broadcastlogger&hl=en –
Ciao @Alexandee Farbar. Hai avuto una risposta alla tua domanda? – ymerdrengene