RandomData
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   abghour_noreddine
Posted On:   Tuesday, January 8, 2002 12:34 PM

hi all,


i want to generate a random data on the card, so
Does anybody know how to use the javacard.security .Randomdata class ?
or can you tell me how to implement the generateData and setseed methods of the
abstract RandomData class or give me sample program....

thanks.

Re: RandomData

Posted By:   Julien_SIMON  
Posted On:   Wednesday, January 9, 2002 12:25 AM

Here's how you can use it :




// Applet constructor
private RandomData random = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
…
// Applet APDU handling code
private processGetChallenge(APDU apdu) {
short length = apdu.setOutGoing();
random.generateData(apdu.getBuffer(), (short)0, length);
apdu.setOutgoingLength(length);
apdu.sendBytes((short)0, length);
}


That's it !

About | Sitemap | Contact