“Lets pretend to be developers” 🙂

Have you tried lowercase UID? It is worth a shot. auth.PCDchallenge should also be lowercase to match.

When I send my UID to vivokey I flip it’s Endianness. This only applies to the UID, everything else that I send and receive from my chip and from Vivokey is unmodified. This means the UID should be rearranged to look like this: XXXXXXXXXXXX04

2 Likes

I’ll give it a go when I get home.

Nope. Tried uid and pcd challenge lower with and without uid reversed and no dice still error.

@fraggersparks im wondering if you are going to be around at any point this week to sit down and talk about this.

Bit of floundering on my part but me and @AbbottSmith been chatting in DM’s and we made progress. I’ll update later as got to leave for work in 15 minutes but ive got PCD response and PICC response!

Were almost there!

2 Likes

Well bugger me that was a trip.

IT’S VIVOME!!!

Note for people who havent seen vivokey api info: that is a hash so is not private info not really.

4 Likes

TODO:

  • Tidy code and properly comment
  • Add some proper checks so it don’t exception.
  • Add apex support (no point in spark1 as the acr122u wont read it).
  • Share on github.
  • Write up some pointers on improvements to documentation for the chipscan api.
1 Like

Nice! What was the jist of the issue?

The UID MUST be sent in a specific way, in regards to how I recieve the string when reading it must be sent Little-endian.

TLDR

I read 04 xx xx xx xx xx EA - does not work.
Normal reversal of the string AE xx xx xx xx xx 40 - does not work

I had to convert the string to a byte array, reverse the byte array and then convert back to a string. In C# this is done like this:

reverseByteOrder
public string reverseByteOrder(string hexString)
        {
            byte[] array = stringToHex(hexString);
            Array.Reverse(array, 0, array.Length);

            return BitConverter.ToString(array).Replace("-", string.Empty);
        }
stringToHex
public byte[] stringToHex(string hexstring)
        {
            Dictionary<char, byte> hexmap = new Dictionary<char, byte>()
            {
                { 'a', 0xA },{ 'b', 0xB },{ 'c', 0xC },{ 'd', 0xD },
                { 'e', 0xE },{ 'f', 0xF },{ 'A', 0xA },{ 'B', 0xB },
                { 'C', 0xC },{ 'D', 0xD },{ 'E', 0xE },{ 'F', 0xF },
                { '0', 0x0 },{ '1', 0x1 },{ '2', 0x2 },{ '3', 0x3 },
                { '4', 0x4 },{ '5', 0x5 },{ '6', 0x6 },{ '7', 0x7 },
                { '8', 0x8 },{ '9', 0x9 }
            };

            byte[] data = new byte[hexstring.Length / 2];
            char one, two;

            int x = 0;
            for (int i = 0; i < hexstring.Length; i += 2, x++)
            {
                one = hexstring[i];
                two = hexstring[i + 1];
                data[x] = (byte)((hexmap[one] << 4) | hexmap[two]);
            }

            return data;
        }

I suppose the most confusing part in the API is here there is no mention of Endianness and it shows a UID being sent with 04 at the begining (knowing all NXP chips start with that) you would think that i could send it like that but nope.

1 Like

How I feel:
10402dce-e738-4bdc-90ba-fd4005c2c9a8_text
I appreciate all of the work you’ve been putting in @Devilclarke, and the UI looks great!

2 Likes

Haha it looks shite lol imma tidy it all up then share like I said.

1 Like

Great to hear!

1 Like

It might be of use to someone so here it is, it aint finished but it will scan my spark2 and auth it. Also added detecting a non vivokey device and returning that info.

5 Likes

Just pushed another commit to tidy a few things and finish adding Apex support. Obviously I have no way to test it for Apex so if someone did and an ACR122U handy id appreciate it.

5 Likes