Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Ben Weijers' crypt.pkg for 2021

  1. #1

    Post Ben Weijers' crypt.pkg for 2021

    Hi,

    Has anyone updated the crypt.pkg to work with the new 2021 (BTW, thank you for the name change... I had enough of 2020)

    I was able to get it working but when I decrypt data encrypted with the original one it does not give me the original data.

    I attached the modified file.

    Regards,
    Oscar
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2009
    Location
    Cayman Islands
    Posts
    3,969

    Default Re: Ben Weijers' crypt.pkg for 2021

    Quote Originally Posted by Oscar View Post
    Hi,

    Has anyone updated the crypt.pkg to work with the new 2021 (BTW, thank you for the name change... I had enough of 2020)

    I was able to get it working but when I decrypt data encrypted with the original one it does not give me the original data.

    I attached the modified file.

    Regards,
    Oscar
    Here is what we use, courtesy of Wempy. Decodes tings encrypted with crypt but we only use it for a few use cases so a test in your environment would be appropriate. Enjoy.
    cMyCryptographer.pkg
    I should be on a beach ...

  3. #3
    Join Date
    Feb 2009
    Location
    The Netherlands
    Posts
    4,674

    Default Re: Ben Weijers' crypt.pkg for 2021

    Note that a version of this package is also in the pkg folder, by the name of cCryptographer.pkg. While we never documented it as part of the public API's, it is being maintained, as it is used by some of our other packages. It has had some adjustments for DataFlex 20 and we created a cCryptographerEx that uses UChar arrays for the potentially binary data.

    When using cryptography in 20 there are a few things to consider:
    - DataFlex 20 uses UTF-8 for its encoding of strings. When encoding strings, that need to be read in older versions of DataFlex, either convert them to OEM before encoding or after decrypting in older revs.
    - Since strings are now UTF-8 we recommend against putting binary (non string) data in strings. The debugger and string functions will try to interpret it as UTF-8 so it is hard to work with. We recommend to use UChar arrays for this (which is why we created cCryptographerEx).

  4. #4
    Join Date
    Apr 2009
    Location
    Wilmington NC, USA or Oaxaca Mexico
    Posts
    919

    Default Re: Ben Weijers' crypt.pkg for 2021

    I happened on to this same issue yesterday. The following is from the 19.1 help and is the method I'm using to encrypt/decrypt user passwords. Can we safely assume the cCryptographerEx.pkg package will not be going away?

    https://docs.dataaccess.com/dataflex...Dictionary.htm

    There was a pretty slick user password library demonstrated at the EDUC back in the spring. Might we be seeing this in the examples any time soon?

  5. #5
    Join Date
    Feb 2009
    Location
    Adelaide, South Australia
    Posts
    2,863

    Default Re: Ben Weijers' crypt.pkg for 2021

    Hi Dan

    I think you mean the security library. I’m use it it in one of my new projects and it works great. But you will need to watch the video with your finger close to the pause button to implement it properly.
    So I would not be surprised if it will stay a video + library.
    Marco Kuipers
    DataFlex Consultant
    28 IT Pty Ltd - DataFlex Specialist Consultancy
    DataFlex Channel Partner for Australia and Pacific region
    Adelaide, South Australia
    www.28it.com.au

  6. #6
    Join Date
    Apr 2009
    Location
    Wilmington NC, USA or Oaxaca Mexico
    Posts
    919

    Default Re: Ben Weijers' crypt.pkg for 2021

    Marco,

    I don't know if you attended EDUC, but my understanding at the time was that this new library was a step beyond the current library and that we could expect to see it in the near future. I in particular remember an extended file structure and a forgotten password mechanism that emailed a temporary password to the user. Does this sound like the library you're currently using?

  7. #7
    Join Date
    Feb 2009
    Posts
    2,026

    Default Re: Ben Weijers' crypt.pkg for 2021

    Hi Dan,
    I think Marco might be talking about this one https://support.dataaccess.com/Forum...curity-Library which I don't think has password reset etc. If there is one available that has all the what could now be called "standard" functions in a web based system, like password reset etc that is great.
    Cheers
    Richard

  8. #8

    Default Re: Ben Weijers' crypt.pkg for 2021

    Quote Originally Posted by Harm Wibier View Post
    Note that a version of this package is also in the pkg folder, by the name of cCryptographer.pkg. While we never documented it as part of the public API's, it is being maintained, as it is used by some of our other packages. It has had some adjustments for DataFlex 20 and we created a cCryptographerEx that uses UChar arrays for the potentially binary data.

    When using cryptography in 20 there are a few things to consider:
    - DataFlex 20 uses UTF-8 for its encoding of strings. When encoding strings, that need to be read in older versions of DataFlex, either convert them to OEM before encoding or after decrypting in older revs.
    - Since strings are now UTF-8 we recommend against putting binary (non string) data in strings. The debugger and string functions will try to interpret it as UTF-8 so it is hard to work with. We recommend to use UChar arrays for this (which is why we created cCryptographerEx).

    Hi Harm,

    I changed the code to use cCryptographer.pkg and they both (crypt.pkg and Cryptographer.pkg) behave the same way. When encrypting data they encrypt different in 19.1 and in 20.0... but the decrypt actually does work exactly the same on both versions.
    I have try using encrypt by sending the strings as tooem() and toansi() and they both return exactly the same encrypted text as if I omit the conversion... I guess I am not sure when to convert the strings. What I noticed is that the text returned by the CryptEncrypt external function is what is different when encrypting... otherwise everything works exactly the same in both versions. Also is to notice is that this happens only when the key used is small (i.e. 5 characters)

    Thank you for looking into this.
    Oscar

  9. #9

    Default Re: Ben Weijers' crypt.pkg for 2021

    Hi Dave,

    Thank you for the file... I tested it and I get the same results as with the one I supplied.

    Thank you,
    Oscar

  10. #10
    Join Date
    Feb 2009
    Location
    The Netherlands
    Posts
    4,674

    Default Re: Ben Weijers' crypt.pkg for 2021

    Quote Originally Posted by Oscar View Post
    Hi Harm,

    I changed the code to use cCryptographer.pkg and they both (crypt.pkg and Cryptographer.pkg) behave the same way. When encrypting data they encrypt different in 19.1 and in 20.0... but the decrypt actually does work exactly the same on both versions.
    I have try using encrypt by sending the strings as tooem() and toansi() and they both return exactly the same encrypted text as if I omit the conversion... I guess I am not sure when to convert the strings. What I noticed is that the text returned by the CryptEncrypt external function is what is different when encrypting... otherwise everything works exactly the same in both versions. Also is to notice is that this happens only when the key used is small (i.e. 5 characters)

    Thank you for looking into this.
    Oscar
    Hi Oscar,

    Note that it is possible that the results are the same but they just look different. That can happen because the debugger now tries to interpret it as UTF-8, so if there are bytes above 128 it will look funky. Which is why using UChar arrays is better, then you can compare the bytes as numbers to see if the data is the same.

    If you can post a small example to look at I am happy to give it test run..

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •