JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html
https://ftsafe.en.alibaba.com/index.html
How to store offline payment data in Java Card?
How to store offline payment data in Java Card?
I am new to Java Card. I want to know how to store some offline data (such as a balance). Does it need to use a file structure(compliance to 7816 standard) to store data?
Re: How to store offline payment data in Java Card?
define your own file struct to store data.
https://github.com/JavaCardOS/Java-Card ... ystem.java
viewtopic.php?f=34&t=24d
Defile your FileSystem that you need to store data!
https://github.com/JavaCardOS/Java-Card ... ystem.java
viewtopic.php?f=34&t=24d
Defile your FileSystem that you need to store data!
Code: Select all
private void processWriteBinary(APDU apdu) throws ISOException {
if(state != STATE_INITIAL) {
ISOException.throwIt(SW_INS_NOT_SUPPORTED);
}
byte[] buf = apdu.getBuffer();
byte p1 = buf[OFFSET_P1];
byte p2 = buf[OFFSET_P2];
short offset = 0;
short ef = -1;
if((byte)(p1 & MASK_SFI) == MASK_SFI) {
byte sfi = (byte)(p1 | ~MASK_SFI);
if(sfi >= 0x1F) {
ISOException.throwIt(SW_INCORRECT_P1P2);
}
ef = fileSystem.findCurrentSFI(sfi);
if(ef == -1) {
ISOException.throwIt(SW_FILE_NOT_FOUND);
}
ef = fileSystem.fileStructure[ef];
offset = unsigned(p2);
}else{
ef = fileSystem.getCurrentIndex();
if(fileSystem.getFile(ef) == null) {
ISOException.throwIt(SW_COMMAND_NOT_ALLOWED);
}
offset = Util.makeShort(p1, p2);
}
byte[] file = fileSystem.getFile(ef);
short lc = unsigned(buf[OFFSET_LC]);
if((short)(offset + lc) > file.length) {
ISOException.throwIt(SW_WRONG_LENGTH);
}
apdu.setIncomingAndReceive();
Util.arrayCopyNonAtomic(buf, OFFSET_CDATA, file, offset, lc);
}
well
Re: How to store offline payment data in Java Card?
http://javacardos.com/javacardforum/vie ... ?f=42&t=27 In this project store data with OathObj object.there is no suitable file struct to fit your need,youneed to define your file struct.
well
Re: How to store offline payment data in Java Card?
Thank you very much for your reply
Who is online
Users browsing this forum: No registered users and 64 guests