Can't create ZMK component

Oct 11, 2010 at 5:13 PM

Hi again

 

I Try commands     0000OCComponent1, 0000OCComponent2 and 0000GY2<comp1><comp2>

but in program exception occur:

Request: 0000OCComponent1
Parsing header and code of message 0000OCComponent1...
Searching for implementor of OC...
Found implementor ThalesSim.Core.HostCommands.BuildIn.GenerateAndPrintZMKComponent_OC, instantiating...
Calling AcceptMessage()...
Exception while processing message
System.ArgumentOutOfRangeException: Index and length must refer to a position in line..
Parameter name: length
   в System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   в System.String.Substring(Int32 startIndex, Int32 length)
   в ThalesSim.Core.Message.XML.MessageParser.Parse(Message msg, MessageFields fields, MessageKeyValuePairs& KVPairs, String& result)
   в ThalesSim.Core.HostCommands.BuildIn.GenerateAndPrintZMKComponent_OC.AcceptMessage(Message msg)
   в ThalesSim.Core.ThalesMain.WCMessageArrived(WorkerClient sender, Byte[]& b, Int32 len)
Disconnecting client.
Calling Terminate()...
Implementor to Nothing
Client disconnected.

 

Any ideas?

Coordinator
Oct 11, 2010 at 6:24 PM

First of all, you should use A2 instead of OC, this command is considered obsolete.

That being said, there are several problems with the implementation of OC. First of all, the delimiters are mixed up in the XML command code definitions. On top of that, the implementation assumes that the client will always send the | delimiter, which is not correct. Let me find out how to properly fix it and I'll post back.

Coordinator
Oct 11, 2010 at 7:08 PM

I've added a fix for this case (change set 55937). Can you download it and test it before I release it?

Oct 11, 2010 at 7:44 PM

I am a newbie in HSM.

First of all I try <A2>... After that I try <OC>

I just do not know how to generate ZMK.

Oct 11, 2010 at 7:46 PM
Edited Oct 11, 2010 at 7:47 PM

Sorry, but I can check it only at work.

At home I can check only C++ code :)

Coordinator
Oct 11, 2010 at 10:36 PM

That's ok, please check your other post as well and download the change set specified on that post, it should fix both your problems.

Oct 12, 2010 at 8:22 AM

I check your fix - all works fine. Thanks a lot.

Oct 12, 2010 at 2:21 PM

Generating component works fine.

However, not working key assembly of the components (command GY)

 

I try next series of command

COMMAND: "0000OCComponent1|U00"
ANSWER: "0000OD00UCDE4D252B6EFE7157CC2B8CA7993D595"

COMMAND: "0000OCComponent2|U00"
ANSWER: "0000OD00UB6B5007E3ADF75D62ED83BEA25C87898"


COMMAND: "0000GY2CDE4D252B6EFE7157CC2B8CA7993D595B6B5007E3ADF75D62ED83BEA25C87898;00;000"
ANSWER: "0000GZ15"

Can you help me?

Coordinator
Oct 12, 2010 at 3:32 PM

Thanks for testing the fix out, glad to know that it's working!

The GY command is really old. When it was first created, it assumed that you would provide keys in ANSI format but the OC command generates keys in variant format when you specify the U flag. You should try something like "0000OCComponent1|X00" in order to get a double-length component in ANSI format. You would then get that component without the leading X and feed it to the GY command. Also note that the GY command should end with something like "....;001" or "...;000" because it expects one and not two delimiters. Try these two changes out and let me know how it goes.

Oct 12, 2010 at 3:53 PM
Edited Oct 12, 2010 at 3:54 PM

Yes, after my last post I try many variants and stop on this:

COMMAND: "0000OCComponent1|U00"
ANSWER: "0000OD00U4DCFEBC973BC2AA32EDAD4BBB76614C1"

COMMAND: "0000OCComponent2|U00"
ANSWER: "0000OD00UF0DDD7241C6ED2DC9C048807A9B5D504"

COMMAND: "0000GY24DCFEBC973BC2AA32EDAD4BBB76614C1F0DDD7241C6ED2DC9C048807A9B5D504;0U0"
ANSWER: "0000GZ10"

Creating components works fine, but forming ZMK key failed. It always return GZ10. It looks like not checked scheme type for key (last U in command)

If I change the scheme type like this

COMMAND: "0000GY2D5367DD439857B553E969F917DA832DCD44839389725867BC05F043CC8CAFEE3;UU1"
ANSWER: "0000GZ15"

I receive error GZ15. Whats wrong - I dont understand...

PS what version of Thales RG emulated? I have documentation on host commands of RG7000.

 

 

 

Coordinator
Oct 12, 2010 at 4:18 PM

First of all, ThalesSim attempts to emulate the 8000 series which is backwards-compatible with RG7000. I got a feeling that you've got an old manual because of the commands you're sending. However, that should not be a problem since they are supported by 8000.

Back to your command. You're sending "0000OCComponent1|U00" which generates "0000OD00U4DCFEBC973BC2AA32EDAD4BBB76614C1". The U parameter of the OC command tells the simulator to give back the component in variant form. That is why the key you're receiving back starts with a U - it's Thales notation. Normally that would not be a problem...but the GY command is an old one and it does not work with keys in the variant format (but A4 does). What you should do is send the OC like "0000OCComponent1|X00" - this tells the simulator to generate a double-length key and return it in ANSI format. If you do that you should get back a response with a key that starts with X and not U. Once you do that two times, take the keys without the starting X and pass them to the GY command, like you wrote it the last time.

Let me know if that's not clear, in which case I will give an example.

Oct 12, 2010 at 4:29 PM

It's all clear for me.

I have documentation  on RG7000 (and my HSM module also).

 

According this documentation format of ZMK component is 16H or 32H or 1A+32H or 1A+48H.

And I decide that I can send the key component in U format. Is it wrong?

Coordinator
Oct 12, 2010 at 4:40 PM

That's the problem. I checked with an RG7000 documentation and you're correct. However, issue 6.1 for the 8000 HSM specifies that the command expects ZMK components in the form of 16H or 32H only, hence the implementation of the simulator only accepts keys of the ANSI format.

Here's what we can do. Either you will use the A4 command to create a ZMK or I will create a new parameter (something like "legacyMode") that, when set to True, will force GY to behave in the old fashion. Let me know how you want to proceed.

Oct 12, 2010 at 4:52 PM
Edited Oct 12, 2010 at 4:53 PM

I think that implementing "legacyMode" flag is a right way.

As a temporary way I can use A4 command on simulator and GY command on real hardware.

Coordinator
Oct 12, 2010 at 4:58 PM

This shouldn't take too long. I'll post back when it's ready.

Oct 12, 2010 at 5:05 PM

I understand and I will wait

Coordinator
Oct 12, 2010 at 5:35 PM

Changeset 55962 contains the change. Don't forget to set the LegacyMode flag to True to get back the old behavior.

Let me know if this works.

Oct 13, 2010 at 7:34 AM

Hi nickntg,

Incredible speed!!! I am will prepared to wait about some days...

I checked the fix: now key generate normal with LegacyMode = True, but  I have got parity error again.

In all next commands with ZMK key returning error code 10 (parity error).

for example:

=== [GY], starts 11:25:48.296 =======
[Key,Value]=[Delimiter,;]
[Key,Value]=[Key Check Value Type,0]
[Key,Value]=[Key Scheme LMK,U]
[Key,Value]=[Number of Components,2]
[Key,Value]=[Reserved,0]
[Key,Value]=[ZMK Component #1,FF21B02CE02032C5D03E026D5C0CB233]
[Key,Value]=[ZMK Component #2,D10C4EFED723AE12A1BEABE375D8F204]
[Key,Value]=[ZMK Component Scheme #1,U]
[Key,Value]=[ZMK Component Scheme #2,U]

Component 1 (clear): AB8A07BF01464F25A18A85D6EF920D4A
Component 2 (clear): BCF7E39D3701F82F837AC4D5D0C1C7E3
Key (clear): 177DE4223647B70A22F041033F53CAA9
Key (crypt): U5F6B79C354563A320DBFC1F53F780ABA
Check value: 187401311E8B5808
=== [GY],   ends 11:25:48.312 =======

=== [BU], starts 11:26:06.250 =======
[Key,Value]=[Key,5F6B79C354563A320DBFC1F53F780ABA]
[Key,Value]=[Key Length Flag,1]
[Key,Value]=[Key Scheme,U]
[Key,Value]=[Key Type Code,00]

=== [BU],   ends 11:26:06.250 =======

 

Log:

Client from 127.0.0.1:1605 is connected
Client: 127.0.0.1:1605
Request: 0000GY2UFF21B02CE02032C5D03E026D5C0CB233UD10C4EFED723AE12A1BEABE375D8F204;0U0
Parsing header and code of message 0000GY2UFF21B02CE02032C5D03E026D5C0CB233UD10C4EFED723AE12A1BEABE375D8F204;0U0...
Searching for implementor of GY...
Found implementor ThalesSim.Core.HostCommands.BuildIn.FormZMKFromTwoToNineComponents_GY, instantiating...
Calling AcceptMessage()...
Calling ConstructResponse()...
Calling ConstructResponseAfterOperationComplete()...
Attaching header/response code to response...
Sending: 0000GZ00U5F6B79C354563A320DBFC1F53F780ABA187401311E8B5808
Calling Terminate()...
Implementor to Nothing
Client disconnected.
Client from 127.0.0.1:1606 is connected
Client: 127.0.0.1:1606
Request: 0000BU001U5F6B79C354563A320DBFC1F53F780ABA
Parsing header and code of message 0000BU001U5F6B79C354563A320DBFC1F53F780ABA...
Searching for implementor of BU...
Found implementor ThalesSim.Core.HostCommands.BuildIn.GenerateCheckValue_BU, instantiating...
Calling AcceptMessage()...
Calling ConstructResponse()...
Calling ConstructResponseAfterOperationComplete()...
Attaching header/response code to response...
Sending: 0000BV10
Calling Terminate()...
Implementor to Nothing
Client disconnected.

 

PS. Where a can write my wish to programm interface?

Oct 13, 2010 at 7:44 AM

And it looks like you forgot to add the LegacyMode in the configuration file in the folder ThalesServiceSimulatorSetup (in ThalesParameters.xml)...

Coordinator
Oct 13, 2010 at 8:15 AM

ThalesWinSimulatorSetup/ThalesParameters.xml has been checked in. Are you having a problem with the setup?

This is another case of not forcing odd-parity to the output - this time on the GY command. It's been fixed on the latest changeset. Please have a look and let me know.

Oct 13, 2010 at 8:32 AM
nickntg wrote:

ThalesWinSimulatorSetup/ThalesParameters.xml has been checked in. Are you having a problem with the setup?

This is another case of not forcing odd-parity to the output - this time on the GY command. It's been fixed on the latest changeset. Please have a look and let me know.

 No. I didn't build installer... just simply check all files ThalesParameters.xml :)

 

I checked the last fix - all works fine. Thank your for quick and helpful response.

Coordinator
Oct 13, 2010 at 8:42 AM

Super. I'll probably bundle all changes up to now and post 9.1.