473,287 Members | 1,570 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,287 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 2178
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.