×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    MFStandardException: Write Failed

    Hi,
    I implemented a signed midlet to write data into internal mifare card of Nokia 6212. First, I tested this midlet under two Nokia 6212 and it works fine; data is wrote into the mifare card.
    But, when I had tried it under a third Nokia 6212, I get connected to the Mifare internal card but write operation failed and I reached this exception :
    MFStandardException: Write Failed

    Any Idea please ?

    Cheers
    Miriam

  2. #2
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: MFStandardException: Write Failed

    The internal Mifare card of this 6212 might be protected. Do you write the data with a MFStandardConnection, accessing the MAD and creating/opening your own application or do you use the regular NDEF Connection?

    If you're not familiar with Mifare 4k, I suggest you take a look at the specifications : http://www.nxp.com/acrobat_download/...on/m043531.pdf especially the part about the tag's structure and read/write protection.

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: MFStandardException: Write Failed

    Thank you a lot for replaying 

    I use a MFStandardConnection like showing in this part of my code:

    Code:
    try {
    
                // get URI of the secure element from the system
                uri = System.getProperty("internal.mf.url");
    
                // Opening the Conneciton to the Secure Element
                conn = (MFStandardConnection) Connector.open(uri);
                
                
                if (conn != null){
                	info.setText("Connection OK");
                	sector = conn.getSector(14);
                	
                	// To initialize Blocks
                	MFBlock bloque_0 = sector.getBlock(0);
        			bloque_0.write(null, zeroBuffer, 0, 16, 0);
        			MFBlock bloque_01 = sector.getBlock(1);
        			bloque_01.write(null, zeroBuffer, 0, 16, 0);
        			
                }
           
            } catch (IOException ie) {
                info.setText("Could not Select: " + ie.toString());
            } catch (SecurityException se) {
                info.setText("Error, Application not trusted (sign MIDLet!): " + se.toString());
            }catch (Exception e){
    			 info.setText("Exception: " + e.toString());
    				
            }
    I insist in the fact that the same midlet is correctly executed into two Nokia 6212.

    Cheers
    Miriam

  4. #4
    Regular Contributor
    Join Date
    Jul 2007
    Posts
    50

    Re: MFStandardException: Write Failed

    Quote Originally Posted by dahmoun_miriam View Post
    Thank you a lot for replaying 
    Code:
               	sector = conn.getSector(14);
                	
                	// To initialize Blocks
                	MFBlock bloque_0 = sector.getBlock(0);
        			bloque_0.write(null, zeroBuffer, 0, 16, 0);
        			MFBlock bloque_01 = sector.getBlock(1);
        			bloque_01.write(null, zeroBuffer, 0, 16, 0);
        			
                }
    It looks like you're trying to write in sector 14 with the default key. If it works on 2 phones but not on a third, this probably means that the sector 14 is locked on the 3rd phone (According to the SDK documentation the MFBlock.write() method throws a MFStandardException if authentication fails).
    There's probably some data already in there and the trailer of this sector has been changed so you can't write with the default key.

    It might be better for you to use the Mifare Application Directory. This way, rather than writing to a specific sector, you'll let the card manage the sectors and won't have that kind of problem (as long as you've got the key to access the MAD and enough free sectors left on the card).

  5. #5
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: MFStandardException: Write Failed

    Hi Pybel,
    Thank you again for replaying, your suggestions are very interesting .
    But, the problem is that project specifications require writing into Sector 14. So I have to found the Key to access to this sector, case it is access protected.

    Cheers
    Miriam.

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    7

    Re: MFStandardException: Write Failed

    Hi,
    Since I can’t find key to access to Sector 14, I write an applet to access to Mifare Card using jetZ library for Mifare Access (proposed by JCOP plugin).
    But Uploading applet failed, since to access to Nokia 6212 Mifare card, you must use Giesecke & Devrient’s (G&D) specific libraries (ExtSystem) provided by Sm@rtCafé®
    Professional Toolkit

    Cheers
    Miriam.

Similar Threads

  1. Write File
    By DavidCampos in forum Mobile Java General
    Replies: 5
    Last Post: 2009-08-24, 17:16
  2. continuous read and write from tcp/ip socket
    By rahul.shalik.makode in forum Symbian
    Replies: 0
    Last Post: 2009-08-01, 08:17
  3. CMdaAudioOutputStream unexpected playback pauses on Nokia E51
    By pkolaczk in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2009-07-29, 15:13
  4. SMS Encryption
    By jayakrishnan.salim in forum Mobile Java General
    Replies: 16
    Last Post: 2009-07-13, 06:26
  5. write body text to file
    By aden2004 in forum Symbian
    Replies: 3
    Last Post: 2007-03-26, 22:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×