private void btnReadBlock_Clicked(System.Object sender, System.EventArgs e) { byte[] cardKey = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; byte[] encryptedResult = nfcService.ReadByteBlock(16, cardKey, NfcKeyType.KeyB); byte[] result = encryptionService.Decrypt(encryptedResult); Device.BeginInvokeOnMainThread(() => lbState.Text = result == null ? "Error reading NFC block" : $"NFC block read {BitConverter.ToString(result)}"); }
private string ReadBlock(int block) { byte[] cardKey = new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; byte[] encryptedResult = nfcService.ReadByteBlock(block, cardKey, NfcKeyType.KeyB); byte[] result = encryptionService.Decrypt(encryptedResult); if (result == null) { DisplayAlert("Error", "Error reading", "Ok"); return(null); } return(Encoding.Default.GetString(result)); }