• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pseudo Random Function for J2ME

 
Koot Jart
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

I think this is really tough question, but lets try.

I'm implementing small software in J2ME environment. Part of that software is to encrypt a small txt-file using a password based encryption. I'm using SATSA (Security And Trusted Services API, JSR177) for actual encryption. However, I need to generate a key for that encryption process. Key generation must be done using so called "slow funcktion". I have decided to use PBKDF2 algorithm for that purpose (see: http://www.ietf.org/rfc/rfc2898.txt)

At the moment I have started to implement PBKDF2 for J2ME. I can do everything else, but I have a problem creating PRF (Pseudo Random Function), that is used in key generation process. I can' use Mac and SecretKeySpec classes, that are part of JavaSE:

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

Those classes are not in J2ME unfortunately.

Could somebody give me any hint, how I could create my own PRF for J2ME? Which algorithm to use? Are there anything ready for J2ME.

Br
Koot
 
Tim Holloway
Bartender
Posts: 18469
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donald Knuth defines a PRF algorithm in his seminal work "The Art of Computer Programming". Basically, it chops the preceeding number in the series into 2 parts, then merges the parts using simple arithmetic.

You should be able to google for Random Number Generator Algorithm and find lots of code.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!