javacard

Javacard beginner - questions

故事扮演 提交于 2019-12-04 21:52:18
first of all i want to let you know that i am new regarding javacards. I am in the research phase of writing a javacard applet and i have some questions which suprisingly are not so easy to answer through google-search. I want to create an android application which triggers a javacard application via NFC. So far i established a connection to the card with IsoDep. Lets say i have a cap-file. How do I put/install it on an actual javacard? (Do i need a card reader/writer with PC/SC? Which ones do you suggest) Is it possible to put/install the cap-file using my smartphone (via android)? Is there

EMV JavaCard APDU Response in TLV Format

孤街浪徒 提交于 2019-12-04 21:29:31
I have a simple JavaCard HelloWorld script, i execute it in JCIDE with virtual reader then i send apdu commands from pyapdutool: 00a404000e aid then 80000000 and i receive javacard string, everything runs fine. My question is: how can i return a tlv format data instead of that response ? I was looking in the emv book 4.3 about this and also on google haven't found a single example to implement emv tlv tags in javacard script. Can someone put me on correct path to understand this ? package helloworld; import javacard.framework.*; public class helloworld extends Applet { private static final

Fast bit shift of a byte array - CMAC subkeys

邮差的信 提交于 2019-12-04 20:59:39
问题 I need to implement as fast as possible left bit shift of a 16-byte array in JavaCard . I tried this code: private static final void rotateLeft(final byte[] output, final byte[] input) { short carry = 0; short i = (short) 16; do { --i; carry = (short)((input[i] << 1) | carry); output[i] = (byte)carry; carry = (short)((carry >> 8) & 1); } while (i > 0); } Any ideas how to improve the performace? I was thinking about some Util.getShort(...) and Util.setShort(...) magic, but I did not manage to

Encode publicKey on Java Card

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 16:44:40
How to encode an ECDSA PublicKey on Java Card so that after I can decode it on another platform (e.g. sending the encoded key in a response APDU and processing it in a standard Java application)? keyPair.getPublic().getEncoded() on Java would do the trick with PKCS#8 encoding, but as far as I know getEncoded() is not available on the Java Card platform. You can implement this function like this: Card side: 1 KeyPair.getPublicKey() --> publicKey; 2 publicKey.getW() --> W; 3 Send W to outside; Standard java application side: 1 get W data bytes; 2 W data bytes --> ECPoint; 3 Build PublicKey with

Javacard applet RPDU does not contain any data when accessed from seek-for-android

这一生的挚爱 提交于 2019-12-04 14:26:00
问题 I have a complex Javacard applet, which is developed and tested for ordinary Smart Card (e. g. NXP J3E145, T=1). Now I have to use it in UICC in a mobile phone and access it from my Android app. The UICC uses T=0 protocol. When I communicate to the SIM card from an ordinary card reader (Omnikey 5321), the applet works fine. However, when I move it into my mobile phone (Sony Xperia S) and send APDUs via seek-for-android API, some RPDUs do not contain any data part, there is only the status

Some questions about SELECT APDU command in Javacards

若如初见. 提交于 2019-12-04 14:08:58
The quoted below passage is a part of an article that named How to write a Java Card applet: A developer's guide and written by Zhiqun Chen. I saw it here Once an applet is selected, the JCRE forwards all subsequent APDU commands (including the SELECT command) to the applet's process() method. In the process() method, the applet interprets each APDU command and performs the task specified by the command. For each command APDU, the applet responds to the CAD by sending back a response APDU, which informs the CAD of the result of processing the command APDU. The process() method in class

Authentication failed to java card Manager after changing Global Platform default key in gpshell

余生颓废 提交于 2019-12-04 12:36:32
I want to change globalplatform default key for loading applet and secure messaging to card manager. I could change my gemalto default GP card key using bellow commands successfuly: mode_211 enable_trace establish_context card_connect -readerNumber 1 select -AID A000000018434D00 open_sc -security 1 -keyind 0 -keyver 1 -key 47454d5850524553534f53414d504c45 -keyDerivation visa2 // Open secure channel put_sc_key -keyver 0 -newkeyver 1 -key 505152535455565758595a5b5c5d5e5f // Put secure channel keys card_disconnect release_context But when i want to make secure channel to card manager by new key,

Extended APDUs and T=0/1 communication protocols

*爱你&永不变心* 提交于 2019-12-04 11:48:18
I have a JCOP V2.4.2 R3 java card that it is mentioned in its datasheet "The card support both T=1 and T=0 communication protocols" I have also an ACR38 smart card reader that it support both T=0 and T=1 protocols. (I have T=0 communication with one card successfully and T=1 communication with this card successfully.) I wrote the below program and upload it on the card to send and receive extended APDUs: package extAPDU; import javacard.framework.APDU; import javacard.framework.Applet; import javacard.framework.ISOException; import javacardx.apdu.ExtendedLength; public class ExAPDU extends

How to create and use Java Card library packages?

ε祈祈猫儿з 提交于 2019-12-04 11:22:43
As you may know, and as it is mentioned in Java Card Development Kit User Guide , the key to writing large applications for the Java Card platform is to divide the code into individual package units. The most important limitation on a package is the 64KB limitation on the maximum component size. This is especially true for the Method component: if the size of an application’s Method component exceeds 64KB, then the Java Card converter will not process the package and will return an error. So, we need to use Java Card library packages in some special cases. My question is how to create and how

JCWDE : Exception from install() method

左心房为你撑大大i 提交于 2019-12-03 21:44:57
I am working on JavaCard and I developed an applet with JCDE on Eclipse: import javacard.framework.APDU; import javacard.framework.Applet; import javacard.framework.ISO7816; import javacard.framework.ISOException; import javacard.framework.Util; import javacardx.framework.math.BigNumber; import javacard.security.CryptoException; import javacard.security.MessageDigest; public class SignatureGPS extends Applet { public static final byte CLA = (byte) 0xB0; public static final byte INS = (byte) 0x00; private BigNumber s; private BigNumber x; private MessageDigest h; private SignatureGPS() { s =