KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
My app needs to generate a hex string to use as a session ID. Java's SecureRandom doesn't seem to be working ("java/lang/NoClassDefFoundError: java/security/SecureRandom: Cannot create class in system package") I thought of doing something like this: byte[] resBuf = new byte[50]; new Random().nextBytes(resBuf); String resStr = new String(Hex.encode(resBuf)); But the method nextBytes(byte[] bytes) isn't available for some strange reason. Does anyone have a means of generating a random hex number in Java ME/J2ME? Many thanks. Edit: The above generator seems to work when using Bouncy Castle lcrypto-j2me-145 (but not lcrypto-j2me-147).
Tags (comma-separated)
Save Edits
Cancel