View Single Post
  #1 (permalink)  
Old 12-26-2010, 01:15 PM
BooDaddy's Avatar
BooDaddy
Linux Administrator
Offline
Location: gigahype.net
 
Join Date: Sep 2007
Posts: 1,078
Reputation: 840
BooDaddy knows their stuffBooDaddy knows their stuffBooDaddy knows their stuffBooDaddy knows their stuffBooDaddy knows their stuffBooDaddy knows their stuffBooDaddy knows their stuff
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.


Please note, that the method below is no longer needed with the new recoveries.


This thread was started during the "grey period" when Sprint re-arranged the partitions in December of 2010. Shortly after, folks were flashing their 4G WiMax partitions with new radios and damaging their RSA keys. Clockwork and Amon_RA recoveries were not capturing the WiMax paritions on backup at that time. I created the thread to help people save their keys before they flashed any 4G radios. The good news is that the method below is no longer needed since both recoveries (Clockwork and Amon_RA) both will now do a complete dump of the 4G WiMax partitions including the keys and everything necessary to restore 4G in case of emergencies. I am now suggesting that you use either Clockwork or Amon_RA recoveries to backup your entire device before flashing anything. I will keep the info below for educational purposes

------------------------------------------------------------------------


In my endeavor to get rooted on my newly aquired Evo, I learned the RSA keys can easily be jacked up by flashing the wrong stuff to your phone. So, before I went flashing, and rooting away, I wanted a good way to backup the RSA keys on my phone. There are numerous threads out there about where the keys are located, and why some software jacks them up, but this is a good way to get a dump of the keys for safe keeping.

If anyone has any suggestions, feel free to PM me or reply below and I will update the thread as needed!

I am going to assume you are coming from a stock un-rooted phone. This should also work with any other Rom out there as well.

If you have already rooted your phone, you can still grab your RSA keys. See the instructions at the bottom if you have already rooted.

Prerequisites:
You will need to install the USB drivers for the phone. You can find several threads on the forum about getting the proper drivers for the phone. The way I did it was install HTC Sync from this site: HTC Mobile Phone Support - HTC EVO
This will install two sets of programs, one will be your driver package, and the other is the actual HTC Sync program. You can go into add/remove programs and remove the HTC Sync program, but leave the HTC Device drivers.

You will also need a copy of adb in order to open a shell to the phone. This runs on your Windows machine, and connects to the phone via USB and lets you send commands to the phones shell. You can find adb all over the forums, but I have included a copy here:
http://gigahype.net/files/adb_shell.zip
Download that and extract it somewhere on your system. Something like C:\adb_shell will be fine. For simplicity, we will use this location in this tutorial.

Now, lets get started:
1. First, enable USB debugging by going to Settings > Applications > Development > and checking USB Debugging.

2. Grab and install z4root onto your Evo from this thread:
[APP] z4root - xda-developers

Once you have z4root installed, run it, and choose Temporary root. This will take a few seconds to complete so be patient. It will come to a screen that says temp root was a success.

3. Connect your phone using the USB cable. Make sure you select USB Charging mode on the screen.

4. Open a command prompt window from your PC and navigate to where you extracted adb_shell.zip to. In this example, we have extracted it to c:\adb_shell

5. type the following into the command line:
Code:
adb shell
su
Once you type the su command, your phone will prompt asking you to click to allow superuser. Go ahead and click Allow superuser. This will allow the adb shell to get temporary root access.

6. Once you click Allow superuser, your adb shell (in your command window) should now be at a root command line prompt. You can tell if you are at a root command line by the # symbol being displayed. If you see a $ or something other than # then you are not at a root command prompt. GO back and try again

7. If you do indeed have a # then proceed by running the following command. Please type it exactly as you see it. If you are familiar with Linux command strings, this will look familiar.

Code:
busybox sed -n '/BEGIN CERTIFICATE/,$p' /dev/mtd/mtd0 > /sdcard/rsa_OEM.key
8. Your done!
This will dump the RSA keys to a file on your SD Card named rsa_OEM.key
Mine was about 4575 KB in size, but the size could vary.
You can disconnect the phone now. Go ahead and switch the phone's USB connection over to "Disk Drive" and then browse to your SD Card and verify that the file rsa_OEM.key is indeed on the card. It would be a good idea to copy the keys from your SD Card to your PC or somewhere safe. SD cards can and do fail, so get those keys somewhere protected. I keep all of my important stuff on my DropBox account. PM me and I will send you a referal for DropBox

If You have already rooted your phone the process is much easier:

1. Connect your phone using the USB cable. Make sure you select USB Charging mode on the screen.

2. Open a command prompt window from your PC and navigate to where you extracted adb_shell.zip to. In this example, we have extracted it to c:\adb_shell

3. type the following into the command line:
Code:
adb shell
That will immediately drop you to a root command on your phone. You will see the # indicating you are at a root command prompt.

4. Proceed with the sed command below:
Code:
sed -n '/BEGIN CERTIFICATE/,$p' /dev/mtd/mtd0 > /sdcard/rsa_OEM.key
NOW PAY ATTENTION. Once the command completes succesfully, you will not get any reports of it completing. It will simply drop back to the # prompt.
If you get an error that states something similar to "sed command not found" then you do not have busybox running on your phone. That's ok, its not the end of the world. Keep reading, were going to modify the command a little.

Run this command only if you received an error stating "sed command not found" or something similar:
Code:
busybox sed -n '/BEGIN CERTIFICATE/,$p' /dev/mtd/mtd0 > /sdcard/rsa_OEM.key
5. Your done!
This will dump the RSA keys to a file on your SD Card named rsa_OEM.key
Mine was about 4575 KB in size, but the size could vary.
You can disconnect the phone now. Go ahead and switch the phone's USB connection over to "Disk Drive" and then browse to your SD Card and verify that the file rsa_OEM.key is indeed on the card.



CONGRATS! You have just grabbed a backup of your RSA keys! Put these in a safe place Copy them to your PC, Amazon S3, Dropbox, Google storage, or even a floppy disk (just kidding on the floppy). Just make sure you copy the keys OFF your sdcard and put them somewhere safe. SD cards can and do fail, so get those keys somewhere protected. I keep all of my important stuff on my DropBox account. PM me and I will send you a referal for DropBox

Again, if anyone has any suggestions, please feel free to let me know! Hope this helps!
__________________

Yup, Thats the actual speeds I get from my 1U production server
If my posts have been helpful in any way, please click the "Thanks" button --------------------------------> ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓

Last edited by BooDaddy; 01-12-2011 at 11:30 AM.
Reply With Quote
This post has been thanked 10 times.