473,395 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Cannot authenticate NTAG216 password protected block using winscard libarary

I am using an ACR122U NFC reader to password protect an NTAG216 NFC block. I think I have managed to set the password correctly, but I cannot authenticate and change the block afterward. My code for authenticating looks like this:

I set password "1234" and Pack "OK".

Expand|Select|Wrap|Line Numbers
  1. public int Authentication(string Password){
  2.  
  3.    if(connectCard()){
  4.       ModWinsCard.SCARD_IO_REQUEST Request;
  5.       Request.dwProtocol = Protocol;
  6.       Request.cbPciLength = System.Runtime.InteropServices.Marshal.SizeOf(typeof(ModWinsCard.SCARD_IO_REQUEST));
  7.  
  8.        ClearBuffers();
  9.  
  10.  
  11.        SendBuff[0] = 0x1B; //PWD_AUTH (See data sheet)                         
  12.        SendBuff[1] = (byte)Password[0];
  13.        SendBuff[2] = (byte)Password[1];
  14.        SendBuff[3] = (byte)Password[2];
  15.        SendBuff[4] = (byte)Password[3];
  16.  
  17.        byte[] receivedUID = new byte[256];              
  18.        int outBytes = receivedUID.Length;
  19.        int status = ModWinsCard.SCardTransmit(hCard, ref Request, ref SendBuff[0], SendBuff.Length, ref Request, ref receivedUID[0], ref outBytes);
  20.  
  21.      }
  22.     return status;
  23. }
  24.  
This should send the PWD_AUTH command to the NTAG216 with the Pwd. I expected to receive an error if the password is wrong or two bytes with the PACK if the password is correct. But SCard_Status is SCARD_S_SUCCESS and outBytes is 0 afterwards. And if I try to write to the block I get an error.

I am having trouble finding any examples showing how to do this. Can anyone see what I am doing wrong?
May 10 '16 #1
1 2186
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

It would help if you told us what language this is so we can move it to the correct forum.
May 10 '16 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Geert-Pieter Hof | last post by:
Hello, My VB 6.0 application read and writes data from and to a MS Excel workbook, using the Microsoft.Jet.OLEDB.4.0 provider. Now I want to protect the Excel workbook with a password, but I...
9
by: Ben Allen | last post by:
Hi, I want to create a password protected page to administer my site from (the news is read from a mySQL database and I have created a PHP form to as a GUI to do this). I thought of...
4
by: Kelly Bowles | last post by:
I have made a purchase requistion which I have been asked to put password protected copy of requestors signature. I am thinking that each signature will have to be scanned as a picture and linked...
4
by: kthiagar | last post by:
Hi I am trying to connect to a password protected access file from VB.NET. I have no problem in connecting to Access, if I remove the password. This is what I am doing: In the server explorer,...
2
by: nyclamusician | last post by:
The action URL to my form is a page that is password protected (standard password protected directory). What would I need to do to authenticate? I've tried ...
3
by: fred | last post by:
Hi all, I am new for using C# to develop web app. I made a web project which was password protected by using form mode authentication. in my login page ,I added one button of "add a user" which...
8
by: gngui | last post by:
Hi, Please Please Please anyone out there, if you have a solution, i will highly appreciate as i have searched the internet for 5 days now with no hope. 1st, the versions i am using are Ms Access...
2
by: veer | last post by:
Hi i want to open excel file using vb.net . The file is passsword protected and i know the password when i used to open the file with out password it works fine and open but when the file with...
0
by: netri | last post by:
I need to write a java program in which i need to access a computer in my network using IP address but system is password protected.so how can i access a password protected system to fetch a file...
0
by: Ganesh Kulkarni | last post by:
In Microsoft SQL 2005 I'm trying to import from a table of a password protected Microsoft Access database file, by using OPENROWSET command, but it's not working. here is my code: INSERT INTO...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.