to get/generate nonce. error in random, getBytes Options

by sebby zml » Tue, 09 Mar 2010 09:52:26 GMT


Sponsored Links
 Hello every1,

I am now working on a program which is someting related to IMS.
I want the Server to send back a nonce to the Client.
In order to get nonce, I tried using the code from this site.

==>   http://forums.sun.com/thread.jspa?threadID=595626 

-Use java.security.SecureRandom:

--byte[] nonce = new byte[16];
--Random rand;
--rand = SecureRandom.getInstance ("SHA1PRNG");
--rand.getBytes (nonce);

But the problem is I could not use rand.getBytes as the class Random
doesn't provide methot getbytes().

Is there any other way to get or generate nonce? please help.
Thanks a lot.


--



to get/generate nonce. error in random, getBytes Options

by sebby zml » Wed, 10 Mar 2010 04:32:45 GMT


 Hello every1,

I am now working on a program which is someting related to IMS.
I want the Server to send back a nonce to the Client.
In order to get nonce, I tried using the code from this site.

==>   http://forums.sun.com/thread.jspa?threadID=595626 

-Use java.security.SecureRandom:

--byte[] nonce = new byte[16];
--Random rand;
--rand = SecureRandom.getInstance ("SHA1PRNG");
--rand.getBytes (nonce);

But the problem is I could not use rand.getBytes as the class Random
doesn't provide methot getbytes().

Is there any other way to get or generate nonce? please help.
Thanks a lot.


--


Sponsored Links


Other Threads

1. help with game development.

hi all,

this to all those who are into game development. i want to start on the game
development in android, and just as a starter, can anyone suggest me an
ebook or a simple procedure oriented blog or some link that'll help me to
get things started!

thanks in advance.




Regards,
Saurav Mukherjee.

-- 

2. Exception when clearing tabs and onResume() from different applications

Hi,
In my onResume() I have this, to recreate the tabs every time i run.
This is because the tab content changes depending on the program
state.

        tabHost = getTabHost();
        tabHost.setCurrentTab(0);
        tabHost.clearAllTabs();
        tabSpec = tabHost.newTabSpec("Label");
        tabSpec.setContent(new Intent(this, ContentActivity.class));
        // more tabs...

This works within the same application.
But when an external application is launched, or if the phone returns
from idle, this happens. It looks like an internal loop or race
condition. Is there a better way to rebuild the TabHost? This is on
Cupcake.

12-09 18:55:47.596 E/AndroidRuntime( 1009): Caused by:
java.lang.NullPointerException
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.widget.TabWidget.onFocusChange(TabWidget.java:241)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.View.onFocusChanged(View.java:2430)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.View.handleFocusGainInternal(View.java:2258)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.handleFocusGainInternal(ViewGroup.java:398)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.View.requestFocus(View.java:3232)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.requestFocus(ViewGroup.java:1005)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:
1050)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.requestFocus(ViewGroup.java:1009)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:
1050)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.requestFocus(ViewGroup.java:1006)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:
1050)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.requestFocus(ViewGroup.java:1006)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:
1050)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.requestFocus(ViewGroup.java:1006)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.View.requestFocus(View.java:3183)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewRoot.clearChildFocus(ViewRoot.java:1378)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.clearChildFocus(ViewGroup.java:501)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.clearChildFocus(ViewGroup.java:501)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.clearChildFocus(ViewGroup.java:501)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.clearChildFocus(ViewGroup.java:501)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.clearChildFocus(ViewGroup.java:501)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.removeAllViewsInLayout(ViewGroup.java:2204)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.view.ViewGroup.removeAllViews(ViewGroup.java:2150)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.widget.TabHost.clearAllTabs(TabHost.java:214)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
xx.xx.xx.XXXActivity.onResume(XXXActivity.java:40)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:
1229)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.app.Activity.performResume(Activity.java:3530)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:
2619)
12-09 18:55:47.596 E/AndroidRuntime( 1009):     ... 10 more

-- 

3. Is it christmas?

4. Android ecommerce and processing credit cards

5. App Not showing up on Verizon DROID Phones

6. ActivityManager.restartPackage() is not working

7. Safely passing Object references to new Activities