Mai 16
Hi everyone,
today I had some time taking problems with the RSA implementation on Android. I was trying to do the following:
Encrypt a log file on my Android device with a RSA public key, copy the device to the server and on the server decrypt the log file with my RSA private key using a small Java-App.
So for testing I first encrypted and decrypted on my Android device using the generated key pair, then I encrypted and decrypted a String in my Java App using the same key pair. Worked nicely.
Then I tried to copy the encrypted file from the Android device and decrypt in on the server. Didn’t work. But why? I used the same key pair all the time, but always got an Exception:
javax.crypto.BadPaddingException: Blocktype mismatch: 0
Solution:
Afters some hours of trying, confirming that the key pairs are the same, using different options of saving the public key in the Android filesystem, etc. I finally found a post stating that Android is using the Bouncycastle Security provider. Bouncycastle’s default RSA implementation is: “RSA/None/NoPadding”, whereas Sun’s default security provider implementation is “RSA/None/PKCS1Padding”. So, no decryption possible when just using
Cipher.getInstance("RSA")
because of the different paddings used.
So for a solution I downloaded the bouncycastle Jar, added bounycastle as a Security provider to my Java App, and now use
Cipher.getInstance("RSA", "BC");
It works fine now.
Jun 01
Game development tutorial on Android – Part 1
First I have to say that I am using Eclipse and the Android plugin to program, because it really minifies the work needed. If your using another IDE you have to change some of the steps according to your IDE’s workflow, but the code stays the same.
I decided that my game should have a welcome screen and an options menu to start the game (or later when playing to pause or stop the game). That is easily done with Android.
First lets create a new project in Android, name it what you like, I chose “Space Janitor” (I assume that you already now how to create new Android project, otherwise refer to one of the many tutorials).
Weiterlesen »
Jun 01
I am currently learning more on Android development and for me the best way to learn something new is to try it out by myself. It’s the same when I learn new ways of programming: reading books and tutorials is fine, but when I try to build my own apps I learn even more.
So I decided to write a simple game for the Android platform, not that there aren’t already enough games in the Android Market, more because in the last weeks I mostly concentrated on developing games for the Vodafone mobile widget runtime. I made a game called “Space Janitor”, which I now want to port to the Android platform. I would like to extend the game at some points, i.e. making use of the device accelerometer sensors to move the spaceship to the left or to the right, or vibrating the mobile when being hit by an asteroid. That would be real fun.
Another good way to learn is to try to explain the things one learned to others. That was a great way to learn during my university time, because the professors always wanted to have something explained
So if one already explained the learned things to others, it was no problem to explain it again to the professor. I now decided to keep track of my development by writing some blog posts about how to develop the game, thus explaing it to others. But I would also very much appreciate your comments on how to improve the quality and the speed of my code as I would call myself just a novice in Android programming. Maybe you’ve also got some more tipps for game improvement, game handling, gameplay, etc.
I will somewhat unregularly post new entries in my blog, so keep in touch.
Apr 25
Programmierer waren schon immer ein lustiges Völkchen. Besonders deutlich wird dies an dem kleinen Spielchen zu Sun’s neuem “Sun Studio”, hier zu finden http://howmachineswork.com/sun/templeofthesun/?source=wom.
Ganz in Indiana Jones-Manier müssen hier verschiedene Aufgaben erledigt werden, um das “Sun Studio” zu finden. Ein Blick lohnt sich auf jeden Fall!
Viel Spaß beim Zocken!