Giter Club home page Giter Club logo

desfire-tools-for-android's People

Contributors

skjolber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

desfire-tools-for-android's Issues

Saving failed

I can save the file use app from google play but always failed if i use this project
Is there something i missing?

close

Length error in create_file2 method

First let me say "thank you" for this fine peace of work, at the moment I'm trying to enhance your sample app by adding some functions to it (e.g. create applications and files, deletion, formatting and writing to the different file types).

I created a standard file with no problems but when trying to create a cyclic record file I got an "7E" (= length) error. When analyzing the code I found that a record file is created using this method (located in com.github.skjolber.desfire.libfreefare.MifareDesfire.java):

public static int
create_file2 (MifareTag tag, byte command, byte file_no, boolean has_iso_file_id, short iso_file_id, byte communication_settings, short access_rights, int record_size, int max_number_of_records) throws Exception
{
	// todo the original create_file2 method seems to use wrong lengths
	ASSERT_ACTIVE (tag);
	ASSERT_MIFARE_DESFIRE (tag);

	ByteBuffer cmd = C.BUFFER_INIT (11 + CMAC_LENGTH);

	C.BUFFER_APPEND (cmd, command);
	C.BUFFER_APPEND (cmd, file_no);
	if (has_iso_file_id)

		C.BUFFER_APPEND_LE (cmd, C.getBytes2(iso_file_id), 2, 2);
	C.BUFFER_APPEND (cmd, communication_settings);
	C.BUFFER_APPEND_LE (cmd, C.getBytes2(access_rights), 2, 2);
	C.BUFFER_APPEND_LE (cmd, C.getBytes4(record_size), 3, 4); // this might be wrong, field size is 3 ?
	C.BUFFER_APPEND_LE (cmd, C.getBytes4(max_number_of_records), 3, 4); // this might be wrong, field size is 3 ?

	byte[] p = MifareDesfireCrypto.mifare_cryto_preprocess_data (tag, cmd, cmd.position(), 0, MifareDesfireCrypto.MDCM_PLAIN | MifareDesfireCrypto.CMAC_COMMAND);

	byte[] res = DESFIRE_TRANSCEIVE2(tag, p);

	byte[] buffer = new byte[1 + CMAC_LENGTH];
	System.arraycopy(res, 0, buffer, 0, res.length);

	p = MifareDesfireCrypto.mifare_cryto_postprocess_data (tag, buffer, res.length, MifareDesfireCrypto.MDCM_PLAIN | MifareDesfireCrypto.CMAC_COMMAND | MifareDesfireCrypto.CMAC_VERIFY);

	if (p == null) {
		return -1;
	}

	cached_file_settings[file_no] = null;

	return 0;
}

As you can see in my code comments, the C.BUFFER_APPEND_LE (cmd, C.getBytes4(record_size), 3, 4) and C.BUFFER_APPEND_LE (cmd, C.getBytes4(max_number_of_records), 3, 4) are using a fileSize of 4 instead of 3. In my opinion this is a "copy&paste" issue when working with previous create_value_file method.

I changed the method in my code but it could be a good idea to change your code as well, thanks again.

For all others: in the meantime you change the mentioned code lines as follows (change to C.getBytes3 as well):

    C.BUFFER_APPEND_LE (cmd, C.getBytes3(record_size), 3, 3); // changed to field size is 3
    C.BUFFER_APPEND_LE (cmd, C.getBytes3(max_number_of_records), 3, 3); // changed to field size is 3

Greetings from Germany
Michael

cannot find symbol class MifareDESFireKey!

After building this project I faced with "cannot find symbol class MifareDESFireKey" error .. So I checked it and I saw this class doesn't exist!
What's the problem?

version of app

hi

what version of android is it compatible with ?
it's not possible to install on android 12, It's not available for my android phone from google PlayStore

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.