javacard

Send more than 261 bytes to Java Card with Android NFC

ⅰ亾dé卋堺 提交于 2019-12-06 04:04:22
I want to send an APDU with a length of 1699 bytes via NFC (class IsoDep ) to a Java Card smartcard. I get the error java.io.IOException: Transceive length exceeds supported maximum My phone is a Samsung Galaxy S7. I use extended-length in my applet on the card. I have verified that the card supports extended length. I tested this via pyapdutool by sending an APDU with 4000 bytes to the card. I found that when I write this code, the result is false : final Tag t = (Tag) tag; myTag = IsoDep.get(t); boolean result = myTag.isExtendedLengthApduSupported(); I have this in my manifest: <activity

Sending Extended APDU to Javacard

谁说胖子不能爱 提交于 2019-12-05 18:23:43
I have a ACR38 samrt-card-reader and a number of Javacard [2.1.1] compliant with GP Spec [02]. As I know, there is two kind of APDU, Short-APDU [APDU with LC or/and LE shorter than 255 ] and Extended-APDU [APDU with LC or/and LE greater than 255 ]. is that right? We send Short-APDU in T=0 protocol and send Extended-APDU in T=1 protocol. is that right? I sent Short-APDU to my card successfully. [via GPJ , GPShell , OpenSC-Tool ]. And now, I want to know: 1: if I want to use Extended APDU, my card must support it? or my Reader must support it? or both!? or all the cards and all the readers

En-/Decryption output in Java Card + corresponding APDUs

余生颓废 提交于 2019-12-05 18:21:47
I'm new to the whole topic of Java Card and tried to look at a few code examples to get a better understanding. I found a sample for AES usage in the oracle forum but have a few problems with the following part: private void doAES(APDU apdu) { byte b[] = apdu.getBuffer(); short incomingLength = (short) (apdu.setIncomingAndReceive()); if (incomingLength != 24) ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); //perform encryption and append results in APDU Buffer a[] automatically cipherAES.init(aesKey, Cipher.MODE_ENCRYPT); cipherAES.doFinal(b, (short) dataOffset, incomingLength, a, (short)

Java Card applets, secure data transmission and Secure Channel

烈酒焚心 提交于 2019-12-05 16:19:05
I want to write my applet in a way that its APDU commands and status words wasn't be clear in the transmission channel between my card and my reader. I mean I don't want to send APDU commands and responses to be plain text for third parties. I think I have two option : After selecting my applet on the card, for all the other commands, do an encryption function on the data section of APDU commands and decrypt them on the card and after that analyze them. Note that I can't encrypt whole the command using this methodology because the result may have conflict with another SELECT APDU command and

Fast way to convert byte[] to short[] on Java Card

别说谁变了你拦得住时间么 提交于 2019-12-05 13:29:34
I want to optimize SHA-3 algorithm on a Java Card. I need a fast algorithm consuming less memory which allows to easy convert byte[] to short[] (or short [] to byte[] ). My current implementation looks like this: private short[] byteToShort(byte[] b,int len) { short len_conv = (short)(len/2); for ( short x = 0; x < len_conv;x++) { for ( short j = 0 ; j < 2 ; j++) aux[j] = b[2*x+j]; temp_conv[x] = (short)((((short)aux[1]) & 0xFF) | ((((short)(aux[0]) & 0xFF) << 8 ))); } return temp_conv; } where len is actual size of the b array and aux and temp_conv are defined as private and allocated as :

Hash generator applet doesn't work fine

淺唱寂寞╮ 提交于 2019-12-05 06:28:20
问题 Below, you see an applet that generate hash value of input data based on MD5 , RIPEMD160 , SHA , SHA224 , SHA256 , SHA384 and SHA512 : package hashPack; import javacard.framework.*; import javacard.security.CryptoException; import javacard.security.MessageDigest; public class HashMachine extends Applet { //outputArray byte[] hashedValue = new byte[64]; //output Length short OLength = 0x0000; //Defining switch case variables for Hash algorithm commands final byte MD5 = (byte) 0x00; final byte

Point addition using Elliptic Curve calculations on Java Card

耗尽温柔 提交于 2019-12-05 04:57:01
问题 I have a smart card which supports JavaCard 2.2.2 and I would like to develop a signature with tickets on elliptic curve. To do that, I need to compute the sum of 2 points on an elliptic curve. I've read the JavaCard's API and I don't think it is possible, in fact there are things about elliptic curves but only for algorithms that are already developed (ECPrivateKey for ECDSA for example ...) But when you want to create an ECPrivateKey, you have to give the parameters which define the

is jcop is only way to install applet in java card?

被刻印的时光 ゝ 提交于 2019-12-05 01:55:57
问题 I am trying to understand the concept of java card , I have some doubts , I want to share with , perhaps you would any best suggestion for me. //Jcop- I read somewhere that Java Card OpenPlatform (JCOP) is a smart card operating system for the Java Card platform developed by IBM Zürich Research Laboratory. question 1 - if this above sentence is right it means jcop is an operating system developed by IBM, handle all operation inside the card.right? I have a card which indicate ATR like- 3b 89

Safe Max Java Card APDU Data Command and Respond Size

拟墨画扇 提交于 2019-12-05 00:36:44
问题 What is the recommended data field size in a Java Card APDU ? From Zhiqun Chen's Java Card Technology for Smart Cards: Architecture and Programmer's Guide book, it mentions that Le field allows a max of 255. Are we to interpret it as follow for the APDU Command: |<----------------------- 255 Bytes total ------------------------>| |<- CLA -><- INS -><- P1 -><- P2 -><- Lc -><---- DATA ----><- Le ->| Thus, if CLA, INS, P1, P2, Lc, Le are all 1 bytes each, we should assume that the we can safely

ALG_RSA_NOPAD in Java Card

柔情痞子 提交于 2019-12-04 23:05:52
问题 To compute efficiently a square in Java Card, I want to use the algorithm ALG_RSA_NOPAD with an exponent equals to 2 and a modulus greater than the expected result (so the modular reduction has no effect). But I'm not able to use the algorithm ALG_RSA_NOPAD . In fact, when I call the method doFinal() I get a CryptoException which is ILLEGAL_VALUE . In the Java Card 2.2.2 spec, it's said that: CryptoException.ILLEGAL_USE if one of the following conditions is met: • This Cipher algorithm does