It's our great honour to announce the Industry’s First VHBR CCID reader - VHBR Dual interface smart card reader vR504. It is able to support the world’s fastest ePassports.

To celebrate the new product release, there is Special Discount for New Registered Members in our store.
- Get $20.00 OFF instantly for smart card reader vR504, R502 and bR301

Come to get the readers now!

How to generate random data?

Algorithm School

Moderator: UNKNwYSHSA

javaABC
Posts: 2
Joined: Sun Mar 18, 2018 10:47 pm
Points :28
Contact:

How to generate random data?

Post by javaABC » Tue Mar 20, 2018 5:27 am

as the title, how to generate random data in my applet?

javacardx
Posts: 9
Joined: Thu Sep 10, 2015 4:43 am
Points :516
Contact:

Re: How to generate random data?

Post by javacardx » Tue Mar 20, 2018 5:54 am

You can reference this first,maybe it is useful.
viewtopic.php?f=31&t=1265&p=4068&hilit=random#p4068

bigWhite
Posts: 25
Joined: Tue Aug 25, 2015 8:21 am
Points :164
Contact:

Re: How to generate random data?

Post by bigWhite » Wed Mar 21, 2018 3:00 am

Code: Select all

RandomData rand = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
short lenBytes = (short) (KeyBuilder.LENGTH_DES3_3KEY/8);
byte[] buffer = JCSystem.makeTransientByteArray(lenBytes, JCSystem.CLEAR_ON_DESELECT);
DESKey key = (DESKey) KeyBuilder.buildKey(KeyBuilder.TYPE_DES, KeyBuilder.LENGTH_DES3_3KEY, false);

rand.generateData(buffer, (short) 0, lenBytes);
key.setKey(buffer, (short) 0);



The above is a method to generate a random DES key, you can refer

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: Google [Bot] and 0 guests

JavaCard OS : Disclaimer