Make Read Only access for Mifare UltraLight using Android

Bhoomika Brahmbhatt

I can write my data on card successfully. I want that no one can write on my card, but that they can only read. Is this possible to achieve? Or is there any key where I can assign some password protection before writing data on my card?

To write data using:

public void writeTag(Tag tag) {
        MifareUltralight ultralight = MifareUltralight.get(tag);
        String[] mg= getParts(s, 4);

        try {
            ultralight.connect();
            int j=4;
            for (int i = 0; i < mg.length; i++) {

                ultralight.writePage(j, mg[i].getBytes(Charset.forName("US-ASCII")));
                j++;
            }
            Toast.makeText(getApplicationContext(), "Write Done!", Toast.LENGTH_LONG).show()
        } catch (IOException e) {
            Log.e(TAG, "IOException while closing MifareUltralight...", e);
        } finally {
            try {
                ultralight.close();
            } catch (IOException e) {
                Log.e(TAG, "IOException while closing MifareUltralight...", e);
            }
        }
    }

Any help would be appreciated!

Michael Roland

The lock bits for MIFARE Ultralight are located on bytes 2-3 in page 2 (note that Ultralight C and Ultralight derivates like NTAG may have additional lock bits on other pages, see the datasheet for their location). Each of the lock bits controls the lock state of certain pages of the memory area. In order to activate locking, you have to set the lock bit to '1' by issuing a write command for the pages containing the lock bits. So for the simplest scenario of locking the whole tag, you could do something like this:

    // write all-ones to the lock bits on page 0x02
    byte[] result;
    result = ultralight.transceive(new byte[]{
            (byte)0xA2,  // Command: WRITE
            (byte)0x02,  // Address: page 0x02 (2)
            (byte)0x00, (byte)0x00, (byte)0xFF, (byte)0xFF  // Data: set bytes 2-3 to all '1'
    });

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to make a read-only data connection to a read-write locked MS Access using MS Excel?

분류에서Dev

NTAG212 Mifare Ultralight with 인증

분류에서Dev

Mifare Ultralight C 쓰기 잠금

분류에서Dev

Mifare Ultralight C 카드를 사용하는 Android에서 송수신 실패

분류에서Dev

Mifare Ultralight C를 NDEF로 포맷

분류에서Dev

SeeedStudio의 NFC 실드가있는 Arduino UNO 용 Mifare Ultralight C 쓰기?

분류에서Dev

Mifare Ultralight를 NDEF로 포맷하면 IO 예외 발생

분류에서Dev

Make ckeditor read only on page load

분류에서Dev

Is there any way to make the Entire Screen Read Only in wpf

분류에서Dev

Setting up read-only http access to git repo

분류에서Dev

How to access private variables using functions only

분류에서Dev

MIFARE Ultralight C 태그에서 특정 데이터 페이지를 영구적으로 잠 그려면 어떻게합니까?

분류에서Dev

android -How to make notification disappear only when user clicked on it

분류에서Dev

How to only make searching in std::map using a custom comparator?

분류에서Dev

Access editing profile only by profile owner using UserPassesTestMixin showing error?

분류에서Dev

fatal: Could not read from remote repository. Please make sure you have the correct access rights

분류에서Dev

How to make a formula-based cell read-only in MS Excel?

분류에서Dev

How to disable (make read only) a cell in a DataGridView CheckBox column based on the value in other cells?

분류에서Dev

How to make property read only in model which is generated by Entity Framework (database first)?

분류에서Dev

Mifare authentication

분류에서Dev

Android Mifare Classic 인증 키 A가 작동하지 않음

분류에서Dev

read only mount point

분류에서Dev

Crashlytics: Using build server to make a release and upload the distribution of an Android App

분류에서Dev

How to make package inside master package in Android project using Eclipse?

분류에서Dev

Flutter: Is there any way of using a widget only on ios but not on android?

분류에서Dev

Branching directory with partial read access

분류에서Dev

Mifare 인증

분류에서Dev

Xcode Project read only solution

분류에서Dev

Support for read-only properties

Related 관련 기사

  1. 1

    How to make a read-only data connection to a read-write locked MS Access using MS Excel?

  2. 2

    NTAG212 Mifare Ultralight with 인증

  3. 3

    Mifare Ultralight C 쓰기 잠금

  4. 4

    Mifare Ultralight C 카드를 사용하는 Android에서 송수신 실패

  5. 5

    Mifare Ultralight C를 NDEF로 포맷

  6. 6

    SeeedStudio의 NFC 실드가있는 Arduino UNO 용 Mifare Ultralight C 쓰기?

  7. 7

    Mifare Ultralight를 NDEF로 포맷하면 IO 예외 발생

  8. 8

    Make ckeditor read only on page load

  9. 9

    Is there any way to make the Entire Screen Read Only in wpf

  10. 10

    Setting up read-only http access to git repo

  11. 11

    How to access private variables using functions only

  12. 12

    MIFARE Ultralight C 태그에서 특정 데이터 페이지를 영구적으로 잠 그려면 어떻게합니까?

  13. 13

    android -How to make notification disappear only when user clicked on it

  14. 14

    How to only make searching in std::map using a custom comparator?

  15. 15

    Access editing profile only by profile owner using UserPassesTestMixin showing error?

  16. 16

    fatal: Could not read from remote repository. Please make sure you have the correct access rights

  17. 17

    How to make a formula-based cell read-only in MS Excel?

  18. 18

    How to disable (make read only) a cell in a DataGridView CheckBox column based on the value in other cells?

  19. 19

    How to make property read only in model which is generated by Entity Framework (database first)?

  20. 20

    Mifare authentication

  21. 21

    Android Mifare Classic 인증 키 A가 작동하지 않음

  22. 22

    read only mount point

  23. 23

    Crashlytics: Using build server to make a release and upload the distribution of an Android App

  24. 24

    How to make package inside master package in Android project using Eclipse?

  25. 25

    Flutter: Is there any way of using a widget only on ios but not on android?

  26. 26

    Branching directory with partial read access

  27. 27

    Mifare 인증

  28. 28

    Xcode Project read only solution

  29. 29

    Support for read-only properties

뜨겁다태그

보관