×

Discussion Board

Results 1 to 11 of 11
  1. #1
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Exclamation Problem: Java.Security.SecureRandom does not exists

    Dear all,
    I am working to fix a problem for 1 week. To make things clear, I want to create MIDlet using Netbeans+WTK for my N70 mobile. every thing works very fine using eclipse + carbide.j (Nokia tool), but when I moved to Netbeans; the builder says:

    Java.Security.SecureRandom does not exists

    I tried to add the library from j2sdk 1.4.2_12 (src.zip) but it still doesn't work. the most wierd thing is: when i write "java" then "." the "security" pakage appears, obvouisly I select "security" then i pressed my littel pretty ".", i got "SecureRandom", that means normally nothings wrong.

    I know something missing please anyone heeeeeelp.

    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Problem: Java.Security.SecureRandom does not exists

    java.security.* is part of JSR-177 (SATSA API), which is not available on N70 phone.
    SecureRandom is not part of JSR-177 though, it is a J2SE class.

    For some reason, in your installation the code completion suggests classes which are not available for midlets. I tried on my Eclipse / Carbide.j installation, but I was not able to get code completion to suggest SecureRandom for my midlets.

    Hartti

  3. #3
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Re: Problem: java.security.SecureRandom does not exists

    thank you hartti for your fast response.

    STRANGE, it works very fine with me. moreover i deploy my midlet to my N70 and it's working properly.

    but, when i used Netbeans the only pakages avalible are:

    java.io
    java.rmi
    java.lang
    java.util


    where is java.security ? and how can i add it if it deosn't exist?

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Problem: java.security.SecureRandom does not exists

    Why it works on N70? Apparently you have included java.security.SecureRandom class in your midlet and happens to work on top of Java ME VM (so it does not use any native calls). Or then it really does not work, but it looks like it's working :-)

    I hope someone will answer the NetBeans part for you.

    Hartti

  5. #5
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Re: Problem: Java.Security.SecureRandom does not exists

    hartti, i used a 3rd party library which is bouncy castle. this lib has many and many of:

    import java.security.RandomSecure;

    To make it simple it works in eclipse but not in Netbeans.

  6. #6
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Problem: Java.Security.SecureRandom does not exists

    hi Ayed,

    NetBeans uses information from SDK specified as platform for project (default configuration),
    if you select S602ndEdFP3 SDK (N70 platform) it wont include JSR177 or any java.security.* library,
    if you select s603rdEd SDK (as well as Nokia Prototype 4 SDK) - which is platform that introduced JSR177 mentioned by Hartti it does include java.security.* in platform/project abilities,
    but that does not mean that you will have acces to SecureRandom class 'cause JSR177 shipped with S603rdEd SDK contains only following in java.security.* package:
    java.security
    Interfaces
    Key
    PublicKey
    Classes
    KeyFactory
    MessageDigest
    Signature
    Exceptions
    DigestException
    GeneralSecurityException
    InvalidAlgorithmParameterException
    InvalidKeyException
    KeyException
    NoSuchAlgorithmException
    SignatureException
    that is all definition available via JSR177 specs I guess,

    I guess NetBeans is much stricter to what can be included in project than Eclipse or somehow you have already defined global ref variable to java.security.* in Eclipse which is used in j2me projects,

    regards,
    Peter

  7. #7
    Registered User
    Join Date
    Aug 2006
    Posts
    10

    Re: Problem: Java.Security.SecureRandom does not exists

    Thank you peterblazejewicz for this great demonstration,

    But does that mean that i can't use any of the security packages provided by (bouncy castle) which is a third paryt lib for any nokia device.

    and if so ,is there any solution that makes me use an encryption algorithm(say AES in my case) for a MIDlet program?

  8. #8
    Regular Contributor
    Join Date
    Jan 2006
    Location
    CPH, Denmark
    Posts
    64

    Re: Problem: Java.Security.SecureRandom does not exists

    Quote Originally Posted by AyedSQ
    Dear all,
    I am working to fix a problem for 1 week. To make things clear, I want to create MIDlet using Netbeans+WTK for my N70 mobile. every thing works very fine using eclipse + carbide.j (Nokia tool), but when I moved to Netbeans; the builder says:

    Java.Security.SecureRandom does not exists

    I tried to add the library from j2sdk 1.4.2_12 (src.zip) but it still doesn't work. the most wierd thing is: when i write "java" then "." the "security" pakage appears, obvouisly I select "security" then i pressed my littel pretty ".", i got "SecureRandom", that means normally nothings wrong.

    I know something missing please anyone heeeeeelp.

    Thanks in advance.
    Funny, I have the exact same problem right now - I'm also working with Bouncy Castle and I get the same error in Netbeans. The weird part is that it is possible to create an "instance" of bigInteger which also is a part of the external Bouncy Castle lib...

  9. #9
    Regular Contributor
    Join Date
    Jan 2006
    Location
    CPH, Denmark
    Posts
    64

    Thumbs up Re: Problem: Java.Security.SecureRandom does not exists

    Oh, I've found the solution - the problem lies in the j2me security model which dictates that an application should not be able to overload classes in Java "core" language namespaces. The solution is to obfuscate the code.

    In Netbeans you goes to file -> "application-name" properties -> Obfuscating -> and then choose "high". Then it should work (It works fine here :-))

    Regards Mads

  10. #10
    Registered User
    Join Date
    Feb 2011
    Posts
    1

    Unhappy Re: Problem: Java.Security.SecureRandom does not exists

    After obfuscation we are getting as class format error on SecureRandom object creation statement.

  11. #11
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Problem: Java.Security.SecureRandom does not exists

    Which SecureRandom do you use? You have to use the one of Bouncy Castle J2ME variant. It is open source, consequently, you compile it and such an error is not possible. Either you use the wrong class file or your tools compile not corrcetly.

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36
  5. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×