PPCGeeks

PPCGeeks (http://forum.ppcgeeks.com/index.php)
-   HTC Evo 4G (http://forum.ppcgeeks.com/forumdisplay.php?f=181)
-   -   Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms. (http://forum.ppcgeeks.com/showthread.php?t=138847)

BooDaddy 12-26-2010 01:15 PM

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! :D
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!

lkillen 12-26-2010 02:07 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Thanks and that was well written. Just one more note is to copy the keys to your PC.

BooDaddy 12-26-2010 02:10 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Thanks! I updated the last paragraph with suggestions on copying the file somewhere safe.

leerage 12-26-2010 07:11 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Thanks! I've been wanting to do this. Did this on my rooted Evo and worked perfect. My RSA key was 4575 KB in size as well.

Sit Bits 12-26-2010 07:43 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Worked just like it said. Thanks

JimSmith94 12-26-2010 10:35 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
It's not working for me. I installed Z4root and got temporary root. However I can't get su on my PC:

Code:

C:\android-sdk-windows\tools>adb shell
adb server is out of date.  killing...
* daemon started successfully *
$ su
su
su: permission denied
$

"su" worked when I was rooted on 3.30 but I unrooted to install 3.70, so I'm thinking that is the reason I can't get it.

Can someone tell me what I'm doing (or did) wrong?

Edit: I noticed that I'm still showing S-OFF, even though I did the OTA update to 3.70. I'm guessing that is the problem, but I don't know how to fix it. Is there a way to fix that without doing a complete ROM install again?

cevaes 12-28-2010 01:48 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I lost my RSA keys and tried EVERYTHING and nothing worked, so i unrooted my evo and took my phone to sprint and played dumb, it worked they gave me a NEW evo saying that my 4g antenna was broken =)), so i have my new evo and already rooted it again this time i made a copy of my RSA keys now my question is if some how i loose my keys again how do i restore them? they are in a .key format not sure how to restore them. ALSO if i ever break my 4g again will this fix it?

THX in advance

carlitos 12-28-2010 01:48 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
stupid question sorry but. what is this for? how can we used, where to use it or when to use it?

adrian2pm 12-28-2010 02:27 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
yea what is this for? i just got my phone and rooted couple days ago..

leerage 12-28-2010 10:05 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
This makes a copy of your unique 4G RSA Key. Without it, you wouldn't be able to access 4G. If you have HBOOT 2.02/2.10, I hope you used:

[ROOT][GUIDE] HBoot 2.02/2.10 SOFF - The Savior Edition - Upd. 12.26.10 - xda-developers

As methods like Unrevoked aren't coded for the other partitions (that contain your 4G RSA key) and will ruin 4G permanently for you on that Evo.

BooDaddy 12-28-2010 10:08 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
leerage,
The guide you posted from XDA is the same guide I used to root my Evo after I saved my RSA keys. Its a very good rooting guide, and I highly recommend it!

leerage 12-28-2010 10:27 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by BooDaddy (Post 2025382)
leerage,
The guide you posted from XDA is the same guide I used to root my Evo after I saved my RSA keys. Its a very good rooting guide, and I highly recommend it!

Definitely. The guide is pretty straight forward. When I got my Evo back in early December, there wasn't the method of backing up the RSA key (at least in the guide). Everything went smooth though and I got my Evo rooted. Just now backed up my RSA key and all is good.

Jim8181 12-28-2010 10:48 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by leerage (Post 2025381)
This makes a copy of your unique 4G RSA Key. Without it, you wouldn't be able to access 4G. If you have HBOOT 2.02/2.10, I hope you used:

[ROOT][GUIDE] HBoot 2.02/2.10 SOFF - The Savior Edition - Upd. 12.26.10 - xda-developers

As methods like Unrevoked aren't coded for the other partitions (that contain your 4G RSA key) and will ruin 4G permanently for you on that Evo.

Do you suggest making this copy before I do this?:
[ROOT][GUIDE] HBoot 2.02/2.10 SOFF - The Savior Edition - Upd. 12.26.10 - xda-developers

leerage 12-28-2010 11:15 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by Jim8181 (Post 2025407)

That tutorial has the instructions on how to copy the RSA key before rooting/NAND unlock. I would go ahead and do it when you start the process of rooting your phone. When I rooted mine, that wasn't in the tutorial... but I didn't have any issues.

carlitos 12-28-2010 09:34 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by leerage (Post 2025381)
This makes a copy of your unique 4G RSA Key. Without it, you wouldn't be able to access 4G. If you have HBOOT 2.02/2.10, I hope you used:

[ROOT][GUIDE] HBoot 2.02/2.10 SOFF - The Savior Edition - Upd. 12.26.10 - xda-developers

As methods like Unrevoked aren't coded for the other partitions (that contain your 4G RSA key) and will ruin 4G permanently for you on that Evo.

ok it back up your rsa key. but for what? why do u need. in what case are you gonna need it. do u have to restore it back someday ??? idk some explanation please if im not asking too much..

Fam Money 12-28-2010 09:56 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Thanks OP. Now I guess the next logical question is how do we restore the keys from the backup?

leerage 12-28-2010 10:13 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by carlitos (Post 2025770)
ok it back up your rsa key. but for what? why do u need. in what case are you gonna need it. do u have to restore it back someday ??? idk some explanation please if im not asking too much..

It is a unique key to your phone. I'm not sure how you would come about it that you would need to restore it... but who knows. Maybe some freak accident flashing or updating a radio and it wiped out the 4G RSA key... you would be without 4G. It is easy to run the commands so why not do it?

It is pretty simple:

Evo + RSA Key = 4G

Evo w/ no RSA Key = No 4G

ctbenko 12-31-2010 02:41 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Im having issues and am in need of major help, neither command works for me on my rooted Evo. i have titanium backup which installed busybox for me.

However i get both sed not found and busybox not found when i try the commands in adb or from a terminal app.

Any help would be great bc i need to have my 4g rsa keys backed up. Thanks

rcubed3r 12-31-2010 10:15 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
This would only work with me when I removed the space between 'rsa' and 'OEM.key'

Thank you!
Ron

TheBundo 01-02-2011 06:03 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
The rooted way worked great for me. Fast and easy, saved to PC and Dropbox

leerage 01-02-2011 08:02 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I was viewing the root tutorial over at XDA and came across this:

Quote:

This will back up your rsa keys and is not required. If you DONT want to do this then you can Proceed to Step 7. Otherwise if your still at the # type the following to back up your keys.

Run this command first

cat /dev/mtd/mtd0 > /sdcard/wimax.img

This saves it in a file that can actually be restored. This next step is another type of backup just for good measure

busybox sed -n '/BEGIN CERTIFICATE/,$p' /dev/mtd/mtd0 > /sdcard/rsa_OEM.key
So looks like you need to run:

cat /dev/mtd/mtd0 > /sdcard/wimax.img

In order to save it in a format that can be restored. I just did this and it worked great. The .img came out to be like 12MB in size.

kevmo1965 01-04-2011 07:28 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I have my key backed up. How do you check out the key to see if its damaged? Plus, how do you restore the key?
My 4G has never worked, but I was able to backup the key and my MAC address is fine.

kevmo1965 01-06-2011 02:52 AM

Wirelessly posted (Mozilla/5.0 (Linux; U; Android 2.2; en-us; Sprint APA9292KT Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1)

Nothing, really!!!

510jungleboy 01-07-2011 12:26 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I can't seem to even get started on the first step getting the path to the location of the adb_shell. I am rooted too.

OMJ 01-09-2011 07:00 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
good thread BooDaddy, I suggest everyone backup your keys.....stickied!

iknowsquat 01-09-2011 08:35 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
So in the interest of simplification--running a wimax backup in the latest CWM or amon RA will accomplish this, right?
I'm a big fan of learning and doing things manually but adb scares off a lot of people and sometimes simple is good too.

jayhuffdaddy 01-09-2011 09:26 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I downloaded everything that was listed and this does not work for me

iknowsquat 01-09-2011 10:01 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by jayhuffdaddy (Post 2033322)
I downloaded everything that was listed and this does not work for me

What recovery are you on?
If on amons latest do a selective backup of wimax only.
I believe the latest Clockwork can back up your wimax as well just not sure on the specifics since I dont use it.
I am 99.9% sure that when doing this backup your RSA keys will be included in the wimax.img. I'll let you know if I find out otherwise.

jayhuffdaddy 01-09-2011 10:25 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
I'm on Amon but don't see an option for just backing up the wimax.

iknowsquat 01-09-2011 10:35 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by jayhuffdaddy (Post 2033378)
I'm on Amon but don't see an option for just backing up the wimax.

OK, WHICH amon :)
On 2.2.1 when you select backup the last step will bring up a list of options:
boot
system
cache
wimax
etc....

Just select wimax.

btw your RSA keys ARE in the wimax.img created with amon (and I assume CWM)

In amonRA's thread he lists the same manual restore method as listed here by using adb with the wimax.img on the root of the SD card.
Again, not challenging the OP but just thought a lot of users would find the wimax backup in recovery a simpler option.

jayhuffdaddy 01-09-2011 10:40 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
That would be why. In recovery it shows build 2.1.1. Can you point me to the latest?

Edit: Think I found it within rom manager

iknowsquat 01-09-2011 10:44 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by jayhuffdaddy (Post 2033390)
That would be why. In recovery it shows build 2.1.1. Can you point me to the latest?

Edit: Think I found it within rom manager

Maybe not amon's OP still says that 2.2.1 isnt available via ROM Manager but maybe he hasnt updated?
Just in case
[Recovery] [07-Jan-2011] RA-supersonic-v2.2.1 - xda-developers

jayhuffdaddy 01-09-2011 10:47 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Flashed the newest amon and showing up now. thanks man.

iknowsquat 01-09-2011 11:24 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by jayhuffdaddy (Post 2033398)
Flashed the newest amon and showing up now. thanks man.

ANYtime Bro.

Just got confirmation on the wimax restore.
If you use amon (and assume CWM) to create the wimax.img then in the event you lose your RSA keys you can restore it just like any other ROM restore via the restore function in recovery.
Still always good to know the manual techniques just in case.

OMJ 01-10-2011 01:07 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
thx for the info IKS....since both amon ra & clockwork now backup wimax & wimax.img contains the keys, I'm gonna unsticky....

lkillen 01-11-2011 07:20 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by OMJ (Post 2033716)
thx for the info IKS....since both amon ra & clockwork now backup wimax & wimax.img contains the keys, I'm gonna unsticky....

Has anyone verfied Kouche's work? I.e. restored the keys and validated that they worked.

Karl 01-11-2011 08:23 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
so there still no way just restore the key
cuz restoring the wimax.img restores radios as well

BooDaddy 01-12-2011 11:24 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Quote:

Originally Posted by iknowsquat (Post 2033383)
OK, WHICH amon :)
On 2.2.1 when you select backup the last step will bring up a list of options:
boot
system
cache
wimax
etc....

Just select wimax.

btw your RSA keys ARE in the wimax.img created with amon (and I assume CWM)

In amonRA's thread he lists the same manual restore method as listed here by using adb with the wimax.img on the root of the SD card.
Again, not challenging the OP but just thought a lot of users would find the wimax backup in recovery a simpler option.


Completely understand iknowsquat. When I originally wrote the post, there wasnt any recoveries backing up the keys at all, so I wanted to put something out there just in case.

There are ways to restore the keys if you used my method, but I am not 100% it should be mentioned. Likewise, I am not sure even mentioning using recovery to restore WiMax keys is "legal". The reason being is that it is essence exactly like cloning an ESN. It would be really simple to clone someones WiMax info to a "bad" phone and just use the thing as a wifi hotspot for 4G or what have you. If you are familiar with Linux command line, you can figure out how to write the keys back to your phone. There are several methods, but they usually involve using mtd-utils, cat, sed, and even dd.

But, for now, I am going to modify my original thread to point people to start using the new recoveries as this will be the simplest method going forward. If you have used my method, and need to restore your keys, you can use the new clockwork or Amon_ra recoveries in conjunction with the key dump you made. Again, I won't go into details because I dont want to possibly violate any forum rules about device cloning, but it can be done if you learn the following: cat, sed, dd, and mtd-utils. If you have a linux machine, just use the man pages on each of these commands and you can figure it out easily ;)

tokuzumi 01-17-2011 05:09 PM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
Reading the Wimax Alpha thread on XDA by Shinzul, he states to be using Amon RA 1.8, or later, which I'm currently using Amon RA 1.8. When I do nandroids, I have a Wimax file created. Is everything I need in that file, or are the Wimax keys only backed up on the newer version of Amon Ra (2.X and greater)?

hathetran 08-01-2011 04:26 AM

Re: Good way to backup WiMax RSA keys. Works before Rooting, and on stock OEM Roms.
 
sorry to bump an old thread..but I'm having trouble with the command prompt. Right now the file is in the C:\Users\HT but when I try the promp C:\Users\HT>adb shell nothing happens..am i entering the prompt wrong? thank you

or is there a better way to backup wimax keys?


All times are GMT -4. The time now is 02:02 AM.

Powered by vBulletin® ©2000 - 2025, Jelsoft Enterprises Ltd.
©2012 - PPCGeeks.com


Content Relevant URLs by vBSEO 3.6.0