I want to enable NFC in pkpass. I have created a new certificate with NFC check.
I have used below code for pass.json to enable NFC.
pass.nfc = new NFC
{
message = mbr.MembershipID.ToString(),
encryptionPublicKey="UU5g65SpyhFa9nJ1nnSiXWU88KZZCb7Ah2iOB/TwuNOMKcMYTY5WdUG7zvK63OEqdaj4P8c7vk7AtBbe+LgnOg==",
requiresAuthentication = false
};
Now after using this, the pass if not opening. If I use "nfc":[{...}], then it opens the pass, but if I use nfc object as mentioned in the Apple documentation, the pass is not opening.
I am using the below code to generate encryptionPublicKey:
using (ECDiffieHellman ecdh = ECDiffieHellman.Create(ECCurve.NamedCurves.nistP256))
{
byte[] publicKey = ecdh.ExportSubjectPublicKeyInfo();
var xCoord = new byte[32];
var yCoord = new byte[32];
Array.Copy(publicKey, publicKey.Length - 64, xCoord, 0, 32);
Array.Copy(publicKey, publicKey.Length - 32, yCoord, 0, 32);
byte[] rawPublicKey = new byte[64];
Array.Copy(xCoord, rawPublicKey, 32);
Array.Copy(yCoord, 0, rawPublicKey, 32, 32);
string base64PublicKey = Convert.ToBase64String(rawPublicKey);
Console.WriteLine(base64PublicKey); // Copy this value!
byte[] decodedKey = Convert.FromBase64String(base64PublicKey);
}
Please guide and let me know where I am going wrong.
I want to enable NFC in my pkpass, I am already using pkpass and its working great, I am using Event Ticket. Now, I want to enable the NFC to my pkpass.