fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

VO FWrite->C# ReadAllText 18 Oct 2020 18:44 #16255

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 793
  • In VO I write a crypted string like this:

    ptrHandle := FCreate(cPath)
    // ....some checks. creating + crypting the string
    FWrite(ptrHandle, cText)


    In C# I read it back as follows:

    string cName = File.ReadAllText(cExeDir + "\\MyFile.txt", Encoding.ASCII);

    (after which XSharp.VO.Functions.CryptRaw should decrypt it again, as suggested by Chris).

    But the value in cName (before decrypting) doesn't look like the value I see written by the VO function.

    What should I do to get the same result? In C# I tried some different encodings without success. I read the www.xsharp.info/forum/public-product/214...d-decodebase64#16183 thread
    but I am not sure if I need to encode my string first in VO to get it back correctly in C#.

    Finally I considered to use the X# function FRead but as this is part of XSharp.Core and not XSharp.VO I doubt if this is going to give me the same string back.

    Dick

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

    Last edit: by ic2.

    VO FWrite->C# ReadAllText 18 Oct 2020 23:19 #16258

  • ic2's Avatar

  • ic2

  • Topic Author


  • Posts: 793
  • I think I solved it in the meantime.

    string cName = File.ReadAllText(cExeDir + "\\Myfile.txt", Encoding.GetEncoding("Windows-1252"));

    This should give the same value as the encoding which was used on creating it with VO.
    I need to check a couple of keys to see if CryptRaw will always give the same value, because in my first example the first character of the (user) name was replaced by a ® character using CryptRaw and it was not with the further equal VO (de-) Crypt call.

    I've added a space (a couple of fields are encrypted) and now it seems fine, the space is not converted to the ®. Very strange.

    Dick

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

    • Page:
    • 1