1. Lemuel Bacli
  2. PowerBuilder
  3. Friday, 4 October 2024 03:20 AM UTC

HI Appeon, 

 

I was tasked with testing our inhouse application that was created from PB12.5 to PB2022R3. The migration is fast, and no syntax error encountered except for the changes on obselete keyword mostly for exporting datawindow. 

 

The issue now is the inhouse application implemented encrypting/decrypting the user/pass of the user.  The issue now is this similar function works properly on pb12.5 and also pb2019 and not on PB2022R3... 

 

The error was 

 

Im having now an issue with the functions of_dec, of_enc and n_bcrypt. 

I added the main.pbl for your checking

Thanks

The n_bcrypt was provided online and was not from my organization. 

Attachments (1)
John Fauss Accepted Answer Pending Moderation
  1. Friday, 4 October 2024 14:32 PM UTC
  2. PowerBuilder
  3. # 1

It appears that you are using an old version of the n_bcrypt object from Roland Smith's TopWizProgramming web site.

I compared the exported source for the version in the .pbl you provided against the exported source of the current/latest version (last changed on Sept. 30, 2021), and there are many changes, mainly regarding the datatypes of values/arguments used for WinAPI handles and pointers (memory addresses).

Apps built from newer versions of Visual Studio, such as PowerBuilder apparently have more stringent checking of datatypes, as the Community has seen multiple questions/issues similar to yours... and the root cause turns out to be the more stringent datatype checking that the underlying runtime libraries now perform. There can be a variety of reasons why code that works in an older version no longer works in a newer version, so your supposition that this shouldn't happen because things work in an older version is naive and incorrect.

I suggest you download the latest version of the BCrypt free code example app from the TopWizProgramming web site, export the n_bcrypt object from it and import it into the PB 2022 version of your app. Here's the link:

    https://www.topwizprogramming.com/freecode_bcrypt.html

One final suggestion for future reference: Providing a .pbl, by itself, makes it more difficult to investigate an issue than it should be. If you are going to include PB objects in your posts, please instead either provide a zip'd small, example app (including the .pbl, .pbt, & .pbw) that exhibits the problem/issue, or zip the exported object(s) to make it as easy as possible for people in the Community to look into the problem. We want to help and like to help, and we would appreciate you making it easier for us to help you.

Best regards, John

Comment
There are no comments made yet.
Andreas Mykonios Accepted Answer Pending Moderation
  1. Friday, 4 October 2024 06:47 AM UTC
  2. PowerBuilder
  3. # 2

Hi.

Based on the messagebox you provided, I do believe that the problem is related to BCryptGetProperty, possibly there is a problem with pszProperty value you provide. But I'm not sure...

I do see that you set pszProperty to BCRYPT_OBJECT_LENGTH (which value is: "ObjectLength")... I remember someone mentioned in another post that there was issue with strings provided to variables of type dword. I write this because maybe this will help someone else to provide an answer about how to correct that issue. Follows BCRYPT_OBJECT_LENGTH description as provided in Microsoft's official documentation.

Cryptography Primitive Property Identifiers (Bcrypt.h) - Win32 apps | Microsoft Learn

 

BCRYPT_OBJECT_LENGTH

L"ObjectLength"

The size, in bytes, of the subobject of a provider. This data type is a DWORD. Currently, the hash and symmetric cipher algorithm providers use caller-allocated buffers to store their subobjects. For example, the hash provider requires you to allocate memory for the hash object obtained with the BCryptCreateHash function. This property provides the buffer size for a provider's object so you can allocate memory for the object created by the provider.

 

Andreas.

Comment
There are no comments made yet.
Lemuel Bacli Accepted Answer Pending Moderation
  1. Friday, 4 October 2024 04:09 AM UTC
  2. PowerBuilder
  3. # 3

I saw that, but the legacy systems still depend on it and it run properly on pb2019.  

Since no syntax error is found on the n_bcrypt, im wondering why it doesn't work as expected.

Comment
  1. John Fauss
  2. Friday, 4 October 2024 11:33 AM UTC
One reason might be because PB 2022 itself is built on a newer version of Visual Studio than PB 2019.
  1. Helpful 1
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 4 October 2024 04:05 AM UTC
  2. PowerBuilder
  3. # 4

Hi, Lemuel -

In PB 2017 R3, Appeon added the CrypterObject object to perform many encryption/decryption tasks. I suggest you may want to check if you can eliminate your dependency on an older, third-party DLL that appears to have issues with the latest (and future?) version of PowerBuilder by switching to use an Appeon-provided and supported solution.

Here is a link to the online Help for CrypterObject:

    https://docs.appeon.com/pb2022r3/objects_and_controls/CrypterObject_object.html

Best regards, John

Comment
  1. Andreas Mykonios
  2. Friday, 4 October 2024 06:32 AM UTC
Hi John.

You are right. But, in this case it depends on three dlls that I believe are all part of the Windows OS... I believe the issue is related to the change of c++ used by Appeon in PB 2022Rx... But I'm not sure what.

Andreas.
  1. Helpful 1
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.