Showing posts with label Device Security. Show all posts
Showing posts with label Device Security. Show all posts

Tuesday, June 19, 2012

Troubleshooting Android’s ‘adb devices’?


I’ve been playing around a bit with Android development lately, and — for the second time — spent a while trying to work out whyadb deviceswasn’t showing me anything:
$ adb devices
List of devices attached

$
Thanks, adb. I’m pretty sure I’ve got a Dream plugged in there, you know. I did get it working in the end, so I thought I’d write up some of the troubleshooting steps so that I’ll have something to refer to the next time I run into this problem.
First off, it’s worth mentioned that if you’re on Windows, you apparently need to install some USB drivers first (and it appears that the 32-bit and 64-bit versions aren’t compatible, so you need to pick the right version too). I’m not using Windows, though, so I don’t know a whole lot about this step.
However, life’s not all rosy on Linux: the adbcommand scans /dev/bus/usb/ rather than /proc/bus/usb/ (as provided by usbdevfs) or /sys/bus/usb/ (ditto, sysfs). This is absolutely the right thing to do (lsusb works the same way), but it means that there’s another step (udev) between the device detection and being able to use the device.
Evidently some of the default udev rules (possibly only on some distributions; in particular, on Ubuntu) create device nodes that aren’t world-readable, meaning that the device node is created, but adb can’t read it. The easiest way to tell whether you’re having this problem is to kill the adb daemon and restart it as root:
$ adb kill-server
$ sudo adb start-server
* daemon not running. starting it now *
* daemon started successfully *
$ adb devices
(The adb daemon appears in ps as  “adb fork-server server”, by the way.) I’ve also seen suggestions that you should be able to runsudo adb devices to start the server as root, but when I tried that I ended up with a daemon running as myself again.
If this is your problem, the fix is mentioned on the setup page.I mentioned previously: you create a file called something like/etc/udev/rules.d/51-android.rules that contains rules telling udev to make the device node world-writable when a matching device is found.
The example rule provided in the Developer Guide matches any HTC devices, which might be a bit wide-ranging: you could presumably restrict the match to just the device’s id. (The HTC Dream and Magic share the same device id, 0bb4:0c02, or, strangely,0bb4:0c01when booting into HBOOT/fastboot mode.)
Finally, there’s one very important thing that I’d completely forgotten about: if the devices appears in lsusb output but adb devices still shows nothing,check that the phone is set up to allow debugging via USB(Settings⇒Applications⇒Development⇒USB debugging). If this is off, you’ll see nothing… and that was the step I’d forgotten about.
Things went much better after that: I think I might have had to restart the phone once when it was being insistent that there wasn’t a USB connection, but other than that, it’s all happy:
$ adb devices
List of devices attached
HT851N003417  device

$
One more thing: while looking around, I found  an issue reported against the Android project that states that adb is broken against Linux kernel versions 2.6.27 and later, with identical symptoms. I’m currently using 2.6.24, so I can’t test it, but it’s worth being aware of.

Wednesday, February 8, 2012

Difference between AES and RSA Encryption?

AES is a symmetric cryptographic algorithm, while RSA is an asymmetric (or public key) cryptographic algorithm. Encryption and decryption is done with a single key in AES, while you use separate keys (public and private keys) in RSA. The strength of a 128-bit AES key is roughly equivalent to 2600-bits RSA key

AES uses 10, 12, or 14 rounds. The key size that can be 128,192 or 256 bits depends on the number of rounds. AES uses several rounds in which each round is made of several stages.To provide security AES uses types of transformation. Substitution permutation, mixing and key adding each round of AES except 
the last uses the four transformations.
RSA is a commonly adopted public key cryptography algorithm.The first, and still most commonly used asymmetric algorithm RSA is named for the three mathematicians who developed it, Rivest, Shamir, and Adleman. RSA today is used in hundreds of software products and can be used for key exchange, digital 
signatures, or encryption of small blocks of data. RSA uses a variable size encryption block and a variable size key. The keypair is derived from a very large number, n, that is the product of two prime numbers chosen according to special rules. Since it was introduced in 1977, RSA has been widely used for establishing secure communication channels and for authentication the identity of service provider over insecure communication medium. In the authentication scheme, the server implements public key authentication with client by signing a unique message from the client with its private key, thus creating what is called a digital signature. The signature is then returned to the client, which verifies it using the server’s known public key.Encryption algorithms consume a significant amount of computing resources such as CPU time, memory, and battery power.