The author meant to say 'nextBytes(byte[])' instead of
'getBytes(byte[])'

It's called nextBytes instead of getBytes because you can call it
repeatedly, getting additional random bytes each time.

On Mar 8, 6:19 pm, sebby zml <[email protected]> wrote:
> thanks a lot for letting me know that the code written there is
> incorrect.
> i'll work on it.
>
> On Mar 9, 9:59 am, Mark Murphy <[email protected]> wrote:
>
>
>
> > sebby zml wrote:
> > > 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.
>
> > There has not been a getBytes() method on Random or SecureRandom going
> > back at least to Java 1.4.2, and perhaps earlier. I suggest you find a
> > better sample of using SecureRandom -- that forum post is incorrect.
>
> > I would recommend you consider posting on StackOverflow, with the #java tag.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > Android Training in NYC: 1-2 May 2010:http://guruloft.com-Hide quoted text -
>
> > - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to