Welcome, Guest
Username: Password: Remember me
Hier wird Deutsch gesprochen

TOPIC:

Zugriff auf SmartCard Reader mit PCSC 03 May 2022 09:20 #22361

  • lagraf
  • lagraf's Avatar
  • Topic Author


  • Posts: 310
  • Hallo Wolfgang,
    cryptoStream:Write(decrypted, 1, decrypted:Length)
    hab ich schon probiert, hat aber nichts geändert. Aber ich habe soeben eine andere Array Schleife in der Methode TransformBlock gefunden, die mit 0 beginnt. Mit 1 beginnend geht die Routine schon mal nicht mehr in die Exception:
    PUBLIC METHOD TransformBlock(inputBuffer AS BYTE[] , inputOffset AS LONG , inputCount AS LONG , outputBuffer AS BYTE[] , outputOffset AS LONG ) AS LONG
    	LOCAL i AS LONG
    	LOCAL b AS BYTE
    	//
    	i := 0
    	WHILE i < inputCount
    		i++	// Index starts with 1 not 0!
    		IF SELF:NeedMoreXorMaskBytes()
    			SELF:EncryptCounterThenIncrement()
    		ENDIF
    		b := SELF:_xorMask:Dequeue()
    		outputBuffer[outputOffset + i] := (BYTE)(inputBuffer[inputOffset + i] ^ b)
    //		i++
    	ENDDO
    	RETURN inputCount
    Wenn man in der FUNCTION Start() eine Ausgabe von encrypted hinzufügt
    EncryptAES256_CTR(@@array, OUT encrypted , Convert.FromBase64String(aeskey), kassa, renr)
    ? "encrypted.Length", encrypted.Length	// => Länge 8
    FOREACH x AS BYTE IN encrypted
    	? x   // => alle 8 Elemente sind 0
    NEXT
    sieht man dass encrypted zwar 8 Byte lang ist, aber alle Elemente sind 0 wodurch kein Crypto String rückgeliefert wird.

    Please Log in or Create an account to join the conversation.

    Last edit: by lagraf.

    Zugriff auf SmartCard Reader mit PCSC 03 May 2022 11:08 #22363

    • Chris
    • Chris's Avatar


  • Posts: 3653
  • Hi Franz ,

    The problem is the translation of the the "^" operator of c# in the TransformBlock() method. This represents the xor operator in c#, but in X# this is used as the "Power of" operator (for compatibility with VO) so you need to change the code from

    outputBuffer[outputOffset + i] := (BYTE)(inputBuffer[inputOffset + i] ^ b)

    to

    outputBuffer[outputOffset + i] := (BYTE)(_Xor(inputBuffer[inputOffset + i] , b))

    and then it should work.

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Zugriff auf SmartCard Reader mit PCSC 03 May 2022 11:54 #22364

    • lagraf
    • lagraf's Avatar
    • Topic Author


  • Posts: 310
  • Hi Chris,
    that's it, you're right, I would never have found that!
    Thank you very much, now my X# DLL is complete, I extracted 10 classes and 70 methods from the original DLL.
    Now I can go on with the next steps:
    • Test the X# DLL directly with an already from VO to X# transported app Passed
    • Make a com enabled DLL from it outstanding
    • Integrate the com enabled DLL into my VO apps and test it outstanding
    And then I can discard the foreign DLL and use my own one.

    Please Log in or Create an account to join the conversation.

    Last edit: by lagraf.

    Zugriff auf SmartCard Reader mit PCSC 03 May 2022 14:35 #22366

    • Chris
    • Chris's Avatar


  • Posts: 3653
  • Hi Franz ,

    You're welcome, glad it worked and good luck with the next steps! Myself I have very limited knowledge about COM stuff, but I'm sure the guys can further help you with that.

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Moderators: wriedmann