Share via


MifareClassic.AuthenticateSectorWithKeyA(Int32, Byte[]) Method

Definition

Authenticate a sector with key A.

[Android.Runtime.Register("authenticateSectorWithKeyA", "(I[B)Z", "")]
public bool AuthenticateSectorWithKeyA (int sectorIndex, byte[]? key);
[<Android.Runtime.Register("authenticateSectorWithKeyA", "(I[B)Z", "")>]
member this.AuthenticateSectorWithKeyA : int * byte[] -> bool

Parameters

sectorIndex
Int32

index of sector to authenticate, starting from 0

key
Byte[]

6-byte authentication key

Returns

true on success, false on authentication failure

Attributes

Exceptions

if the tag leaves the field

if there is an I/O failure, or the operation is canceled

Remarks

Authenticate a sector with key A.

Successful authentication of a sector with key A enables other I/O operations on that sector. The set of operations granted by key A key depends on the ACL bits set in that sector. For more information see the MIFARE Classic specification on http://www.nxp.com.

A failed authentication attempt causes an implicit reconnection to the tag, so authentication to other sectors will be lost.

This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with IOException if #close is called from another thread.

<p class="note">Requires the android.Manifest.permission#NFC permission.

Java documentation for android.nfc.tech.MifareClassic.authenticateSectorWithKeyA(int, byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to