DESFire Authentication and Key Derivation
Now Available!
_________________________________________________________________________
"rich as Croesus"
either very fine powder of the gold straight from the mines, or else get bigger pieces of old gold and hammer it out into very thin sheets - a bit like the old-fashioned cigarette papers - and then put these in a pot along with common salt, that's sodium chloride. And then heat that in a furnace to about 800 degrees centigrade, and ultimately you are left with pretty pure gold."
So the Lydians learned how to make pure gold coins. But no less importantly, they then employed craftsmen to stamp on them symbols indicating their weight, and thus their value. These first coins have no writing on them - dates and inscriptions on coins were to come much later - but archaeological evidence allows us to date our coins to around 550 BC, so the middle of Croesus's reign.
Gold Coin of Croesus, Kig of Lydia 550BC Turkey
- Once cards send money to each other, the reign of Croesus is finally over
_______________________________________________
28 February 2011
16 February 2011
Compile a Java Card Applet, Load onto JCOP card, execute..
ok this is how to
Compile a Java Card Applet, Load onto JCOP card, execute..
Applet Source is in \card\src\joe\Fred.java
joe is the package
Batch file to make CAP
_________________________________________________________
prompt $g
set JC_HOME=C:\card\java_card_kit-2_2_1
:: CARE set JAVA_HOME does NOT change javac version
set JAVA_HOME="C:\Program Files\Java\jre1.5.0_05"
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
:: path overkill?
cd \card\src\joe
C:\card\jsdk13\bin\javac -g -classpath ".;%JC_HOME%\lib\api.jar" Fred.java
:: this JCOP card uses javacard 2.2.1 and javac 1.3
:: j1.5 gives: unsupported class file format of version 49.0.
:: nb classpath api.jar does give access to javacard.framework
set _CLASSES=C:\card\java_card_kit-2_2_1\lib\apduio.jar;C:\card\java_card_kit-2_2_1\lib\api.jar;C:\card\java_card_kit-2_2_1\lib\capdump.jar;C:\card\java_card_kit-2_2_1\lib\converter.jar;C:\card\java_card_kit-2_2_1\lib\offcardverifier.jar;
:: do this once only ......... xcopy /S C:\card\java_card_kit-2_2_1\api_export_files\*.* exp\
cd \card\src\
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Fred.opt
____________________________________________________
You have to hunt around Oracle's archives to find the JDK1.3
Fred.opt
____________________________________________________
-out EXP JCA CAP
-exportpath joe\exp
-applet 0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1:0x1 joe.Fred
joe
0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1 1.0
____________________________________________________
Any old AID will do, but there are international Company standards in the Real World
To load the CAP I use jcManager
later on I'll try to do a low level load
Install for load etc etc
gpshell didnt load the HelloWorld that jcManager did,
so expect more difficulties
____________________________________________________
____________________________________________________
anubis script to run the Applet
(I copied CLA 80 and INS 20 from a wallet program)
I guess they can be anything...
____________________________________________________
atr = open();
prints(atr);
prints(" Select joe ");
cmd = new ApduCmd("00A404000A0100000001030100010100");
card_response = execute(cmd);
prints(card_response);
prints(" Get Data ");
cmd = new ApduCmd("B020000008111213141516171800");
card_response = execute(cmd);
prints(card_response);
____________________________________________________
right now the Applet just returns 2 bytes.
Now to get it to do Something interestng.
....
Also I would like to get NetBeans Card going with javac 1.3 and jcdk 2.2.1
- is that even possible??
Compile a Java Card Applet, Load onto JCOP card, execute..
Applet Source is in \card\src\joe\Fred.java
joe is the package
Batch file to make CAP
_________________________________________________________
prompt $g
set JC_HOME=C:\card\java_card_kit-2_2_1
:: CARE set JAVA_HOME does NOT change javac version
set JAVA_HOME="C:\Program Files\Java\jre1.5.0_05"
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
:: path overkill?
cd \card\src\joe
C:\card\jsdk13\bin\javac -g -classpath ".;%JC_HOME%\lib\api.jar" Fred.java
:: this JCOP card uses javacard 2.2.1 and javac 1.3
:: j1.5 gives: unsupported class file format of version 49.0.
:: nb classpath api.jar does give access to javacard.framework
set _CLASSES=C:\card\java_card_kit-2_2_1\lib\apduio.jar;C:\card\java_card_kit-2_2_1\lib\api.jar;C:\card\java_card_kit-2_2_1\lib\capdump.jar;C:\card\java_card_kit-2_2_1\lib\converter.jar;C:\card\java_card_kit-2_2_1\lib\offcardverifier.jar;
:: do this once only ......... xcopy /S C:\card\java_card_kit-2_2_1\api_export_files\*.* exp\
cd \card\src\
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Fred.opt
____________________________________________________
You have to hunt around Oracle's archives to find the JDK1.3
____________________________________________________
____________________________________________________
Fred.opt
____________________________________________________
-out EXP JCA CAP
-exportpath joe\exp
-applet 0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1:0x1 joe.Fred
joe
0x1:0x0:0x0:0x0:0x1:0x3:0x1:0x0:0x1 1.0
____________________________________________________
Any old AID will do, but there are international Company standards in the Real World
To load the CAP I use jcManager
later on I'll try to do a low level load
Install for load etc etc
gpshell didnt load the HelloWorld that jcManager did,
so expect more difficulties
____________________________________________________
____________________________________________________
anubis script to run the Applet
(I copied CLA 80 and INS 20 from a wallet program)
I guess they can be anything...
____________________________________________________
atr = open();
prints(atr);
prints(" Select joe ");
cmd = new ApduCmd("00A404000A0100000001030100010100");
card_response = execute(cmd);
prints(card_response);
prints(" Get Data ");
cmd = new ApduCmd("B020000008111213141516171800");
card_response = execute(cmd);
prints(card_response);
____________________________________________________
right now the Applet just returns 2 bytes.
Now to get it to do Something interestng.
....
Also I would like to get NetBeans Card going with javac 1.3 and jcdk 2.2.1
- is that even possible??
JavaCard CAP converter
Many problems trying to compile, Convert & Load a Java Applett onto a JCOP card
some lines from batch file
:: Compile the .java file
prompt $g
set JC_HOME=C:\card\java_card_kit-2_2_1
::set JAVA_HOME="C:\Program Files\Java\jre1.5.0_05"
set JAVA_HOME=\card\jre13
:: java 1.3 unsupported class file format of version 50.0.
:: java 1.5 gives eror unsupported class file format of version 50.0.
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
cd \card\src\joe
java -version
pause
javac -g -classpath C:\card\java_card_kit-2_2_1\lib\javacardframework.jar Fred.java
pause
set _CLASSES=C:\card\java_card_kit-2_2_1\lib\apduio.jar;C:\card\java_card_kit-2_2_1\lib\api.jar;C:\card\java_card_kit-2_2_1\lib\capdump.jar;C:\card\java_card_kit-2_2_1\lib\converter.jar;C:\card\java_card_kit-2_2_1\lib\offcardverifier.jar;
::xcopy /S C:\card\java_card_kit-2_2_1\api_export_files\*.* exp\
:: this sems extreme ....to copy !!!
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Fred.opt
- so far havnt found the right combo of jcdk & jre
newer jcdk gave errors on CAP load...
they say JCOP can NOT do UNencrypted loads so we cant inspect the payload???
plan:
go back to
http://lavamunky.wordpress.com/2010/03/28/java-card-prog-compile/#comment-69
lavamonkey - why does blogsearch not find monkey??
lava monkey javacard compile - will blogsearch find this??
some lines from batch file
:: Compile the .java file
prompt $g
set JC_HOME=C:\card\java_card_kit-2_2_1
::set JAVA_HOME="C:\Program Files\Java\jre1.5.0_05"
set JAVA_HOME=\card\jre13
:: java 1.3 unsupported class file format of version 50.0.
:: java 1.5 gives eror unsupported class file format of version 50.0.
set PATH=.;%JC_HOME%\bin;%JAVA_HOME%\bin;%PATH%
cd \card\src\joe
java -version
pause
javac -g -classpath C:\card\java_card_kit-2_2_1\lib\javacardframework.jar Fred.java
pause
set _CLASSES=C:\card\java_card_kit-2_2_1\lib\apduio.jar;C:\card\java_card_kit-2_2_1\lib\api.jar;C:\card\java_card_kit-2_2_1\lib\capdump.jar;C:\card\java_card_kit-2_2_1\lib\converter.jar;C:\card\java_card_kit-2_2_1\lib\offcardverifier.jar;
::xcopy /S C:\card\java_card_kit-2_2_1\api_export_files\*.* exp\
:: this sems extreme ....to copy !!!
java -classpath "%_CLASSES%" com.sun.javacard.converter.Converter -config Fred.opt
- so far havnt found the right combo of jcdk & jre
newer jcdk gave errors on CAP load...
they say JCOP can NOT do UNencrypted loads so we cant inspect the payload???
plan:
go back to
http://lavamunky.wordpress.com/2010/03/28/java-card-prog-compile/#comment-69
lavamonkey - why does blogsearch not find monkey??
lava monkey javacard compile - will blogsearch find this??
Labels:
lavamonkey
13 February 2011
Java Swing/AWT and Waiting for a Card
You need to use a "SwingWorker" which is a kind of Thread.
If not, your screen refreshes will freeze.
SwingWorker<String, String> waitForCard = null;
String tap = "Tap";
private void buttonPress(java.awt.event.ActionEvent evt)
{
jTextArea1.setBackground(Color.white);
jButton1.setEnabled(false);
jTextArea1.setText(tap);
final String badRead = "badRead";
//SW SW SW SW SW SW SW SW SW SW SW SW SW SW SW SW
waitForCard = new SwingWorker<String, String>()
{
public String doInBackground()
{
do
{
waitCard(); // waits for a card on the NFC card reader
if (this.isCancelled())
return("cancelled");
}
while ( rbal.contentEquals(badRead) ); // rbal example is Card BAlanc
publish(rbal);
//publish an update, this will get added to a list and
// processed in bulk by the process() method at some point
/ ie if we want a sequence, eg clear the field after one second, do the work, publish
then "done" does the final clear
waitCardGone();
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
return("rupt"); // never seen?
}
return("blank");
}
@Override
protected void process(List<String> chunks) {
jTextArea1.setText(chunks.get(0)); // display your data
}
@Override
protected void done()
{
jTextArea1.setText(""); // clear the text after 1.5 seconds
jTextArea1.setBackground(mgreen);
jButton1.setEnabled(true);
} // done
}; //waitForCard definition fin
//SW SW SW SW SW SW SW SW SW SW SW SW SW SW
waitForCard.execute();
}
You need to use a "SwingWorker" which is a kind of Thread.
If not, your screen refreshes will freeze.
The main will need to be "invokeLater"
I wish Java AWT could do threads in a more simple fashion,
but this is how it is
SwingWorker<String, String> waitForCard = null;
String tap = "Tap";
private void buttonPress(java.awt.event.ActionEvent evt)
{
jTextArea1.setBackground(Color.white);
jButton1.setEnabled(false);
jTextArea1.setText(tap);
final String badRead = "badRead";
//SW SW SW SW SW SW SW SW SW SW SW SW SW SW SW SW
waitForCard = new SwingWorker<String, String>()
{
public String doInBackground()
{
do
{
waitCard(); // waits for a card on the NFC card reader
if (this.isCancelled())
return("cancelled");
}
while ( rbal.contentEquals(badRead) ); // rbal example is Card BAlanc
publish(rbal);
//publish an update, this will get added to a list and
// processed in bulk by the process() method at some point
/ ie if we want a sequence, eg clear the field after one second, do the work, publish
then "done" does the final clear
waitCardGone();
try {
Thread.sleep(1500);
} catch (InterruptedException e) {
return("rupt"); // never seen?
}
return("blank");
}
@Override
protected void process(List<String> chunks) {
jTextArea1.setText(chunks.get(0)); // display your data
}
@Override
protected void done()
{
jTextArea1.setText(""); // clear the text after 1.5 seconds
jTextArea1.setBackground(mgreen);
jButton1.setEnabled(true);
} // done
}; //waitForCard definition fin
//SW SW SW SW SW SW SW SW SW SW SW SW SW SW
waitForCard.execute();
}
----------------------------------------------------------------------------------
public static void main(String args[])
{
java.awt.EventQueue.invokeLater(new Runnable()
{
public void run()
{
Framek f = new Framek();
f.setLocation(Uti.centrePoint(f));
f.setTitle("Card Balance ");
f.setVisible(true);
f.initk(); // initialise stuff
}
});
}
Subscribe to:
Posts (Atom)