Generate the ZMK from the components example
mchhil-incomm opened this issue · 6 comments
In the example you indicate usage of X (XOR components). I believe if X is used you need to use the clear keys output from the GC commands. In the example you are using the encrypted components to form the key, so instead of the X I think it should be an E (encrypted components and XOR).
As an example
Encrypt a clear key of 09's to get Encrypted component and check digits.
EC
Key Type: 000
Key Scheme: U
Enter component: 09090909090909090909090909090909
Encrypted Component: U 0A26 760B D078 7102 6B67 02C5 F9BA 25B3
Key check value: D6A8 75
Now do a form key from encrypted components (3 components of the same type are used to fool it into using one component as XOR'ing something odd number of times will result in the original value)
FK
Key length [1,2,3]: 2
Key Type: 000
Key Scheme: U
Component type [X,H,E,S]: E
Enter number of components (2-9): 3
Enter component #1: U0A26760BD07871026B6702C5F9BA25B3
Enter component #2: U0A26760BD07871026B6702C5F9BA25B3
Enter component #3: U0A26760BD07871026B6702C5F9BA25B3
Encrypted key: U 0A26 760B D078 7102 6B67 02C5 F9BA 25B3
Key check value: D6A8 75
As expected the encrypted value is the same as the output of the EC command.
Now try a form key from components using clear keys and xor
FK
Key length [1,2,3]: 2
Key Type: 000
Key Scheme: U
Component type [X,H,E,S]: X
Enter number of components (2-9): 3
Enter component #1: 09090909090909090909090909090909
Enter component #2: 09090909090909090909090909090909
Enter component #3: 09090909090909090909090909090909
Encrypted key: U 0A26 760B D078 7102 6B67 02C5 F9BA 25B3
Key check value: D6A8 75
Again the output is as expected and matches the the output of the EC command.
Now if we try FK with X (xor clear components ) but use encrypted values of the EC command. The key generated is incorrect.
FK
Key length [1,2,3]: 2
Key Type: 000
Key Scheme: U
Component type [X,H,E,S]: X
Enter number of components (2-9): 3
Enter component #1: 0A26760BD07871026B6702C5F9BA25B3
Enter component #2: 0A26760BD07871026B6702C5F9BA25B3
Enter component #3: 0A26760BD07871026B6702C5F9BA25B3
Encrypted key: U B0CC 7DDD EA0A 8867 A640 CE3E E7AC 1301
Key check value: 80DD 96
Incorrect value due to mismatch of X and encrypted value.
@snowch Issue seems right. changing Component type [X,H,E,S]: X
to E
in 'Generate the ZMK from the components' example should fix that.
Cool - @gunvantk, I've added you as a collaborator on this project. Do you want to go ahead and make the change?
Sure. I'll do that. Also I'm planning to add PIN translation example in near future.