PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WD23] HChangePassword
[WD23] HChangePassword
Débuté par ARV, 05 mai 2021 16:46 - 8 réponses
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 05 mai 2021 - 16:46
Hi

I have a question

I have Classic files on my project, this classic files are on a directory on C
These files I want to put a password, before hand they don't have a password and now I want to add a password to access those files

The problem is that I use the function HChangePassword I even above put the code HOpen on those files
but it nevers add the password I'm setting

I even try to put HmodifyFileRights but this functions looks like only works for C/S because I need to put a DataBase and a connection, on Classic files I could have a connection name but the name of the Data base I'm not sure about this

Also the Classic failes have data on it

There's a way to put a password on those files who has data on it?

I try everything an nothing works

The solution I have is to Create with zero data on those files and in the function HCreation or HCreationIfNotFound I set the password and then add the data I want, but this process is so long a tedious I don't want it, I want to use the functions of windev of changing password but nothing seems to work.

maybe on Classic files this doesn't work and only works for C/S files not sure about this.

But please someone could tell me if it's possible?
I'm doing something wrong?
Classic file are mean to be use for this function?

on the documentation of PCsoft it's saids that works for HFSQL and C/S I'm not sure if HFSQL means HFSQL Classic

Thanks for your time

--
Best Regards
ARV
Posté le 05 mai 2021 - 17:09
Not doing that often, so from the top of my head:

1. Modify the file in the analysis to now use a password
2. ADD A FIELD (bDummy is boolean, by example) SO THAT THE FILE WILL BE MODIFIED
3. Do the file modification (either in the analysis editor or by code)... AT that point only is fyour file ready to accept a password
4. do the hchangepassword in your code
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 06 mai 2021 - 18:34
Hi argus

Thanks this works great!

If anyone have the question about the part of
1. Modify the file in the analysis to now use a password

Just go to the table on the analysis, right click above the table, select the option description of data file then on that window select the tab details
Now on the section where it's says Data protection you will see combo boxes
Now select the automatic encryption if password (just to make everything works the easy way)

Then follow everything Argus says

Now argus I have another question

This problem I have happend because I create the table, this parameter was on no encryption
Now when I create the file for default it will have the automatic encryption but when I want to create the .fic just to have data for testing I create it like this:

1. Select the file
2. Select the option Edit with WDMap
3. Select the button Browse...
4. Select the default directory of the proyect

With this it will create my .fic without password

Do you recommend me to create the file not using WDMap and instead of this use HPass and then HCreation?
Also for my files on C/S I don't want it to use the password so to separated Classic from C/S I need to select the Hpass combobox for one to one?

For example about the combobox of Hpass:
Test1 it's a C/S file
Test2 it's a Classic file

Test1 will have on Hpass parameters = No encryption
Test2 will have on Hpass parameters = automatic encryption

When I use Hpass it will only affect my classic files correct?


Thanks!

--
Best Regards
ARV
Posté le 07 mai 2021 - 02:17
> Thanks this works great!

Cool

Now when I create the file for default it will have the automatic encryption but when I want to create the .fic just to have data for testing I create it like this:

1. Select the file
2. Select the option Edit with WDMap
3. Select the button Browse...
4. Select the default directory of the proyect

With this it will create my .fic without password

Do you recommend me to create the file not using WDMap and instead of this use HPass and then HCreation?


That's what I always do... Just need to do a GO of my project and all my files are there.

> Also for my files on C/S I don't want it to use the password so to separated Classic from C/S I need to select the Hpass combobox for one to one?

For legal reasons if nothing else, I reccomand that ALL YOUR FILES be encrypted/password protected ALL THE TIME (GDPR as a starter).



For example about the combobox of Hpass:
Test1 it's a C/S file
Test2 it's a Classic file

Test1 will have on Hpass parameters = No encryption
Test2 will have on Hpass parameters = automatic encryption

When I use Hpass it will only affect my classic files correct?


No... Always use the "automatic encryption if password" for ALL files ALL THE TIME...

After that, it's just a question of setting a password or leaving it empty.. So in your code, in the project init, if you REALLY don't want the password, just do the hapass with an empty string.



But again, it's a bad idea.
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 07 mai 2021 - 18:42
Hi Argus

I see

I'm really glad for all of your time and replys it helps me a lot than you can imagen

also the last question (I hope)

you said that I use HPass and then if I don't want to set a password I just leave an empty string on that function

Now I can stored directorys of files that I want passwords and other directorys of files that I don't want to have password just to use HPass and then mention the directory of my analysis (this option PCSoft says it on the documentation) on HPass("MyDirectoryOnAnalysis","MyPassword")
But this doesn't work on a project of Android on Windev Mobile

If I use:
HPass("*","PutPassword"))


It will set a password for all of my files C/S and Classic if they have the "automatic encryption if password"
That's why I put no encryption on C/S files

Do you recommend me to save on a Classic files just to the project of android the names of the files and then use a query or for each of that classic file to list all the tables I have and set wich one I want to have password and which one doesn't?

That's because I see this problem on Windev mobile for android
Everything works for Web, Desktop and iOS projects but android project have that limit about this directorys on the analysis

Thanks all your knowledge it's really helpful

--
Best Regards
ARV
Posté le 07 mai 2021 - 21:41
First, let me reiterate that my advice is to have ALL FILES password protected...

Now, if you really don't want to do that, I can imagine two different cases, and I'm not sure in which one you are:

Either all the files are local classic files OR C/S files,n and you switch mode using a chancehconnexion, -OR- you have SOME files in classic and different ones in C/S...

If you are in the first case, when doing the hchangeconnexion, also do the hpass with a filled OR empty password
If you are in the second case, then you KNOW which file is what (or you should). If I had this problem, I would just put a different prefix for the two types fo files (by example F_ for the classic files and FCS_For the client server ones)...

Once that is done, you just do a hlistfile, loop on the result, test the prefix, and based on that prefix do a hapass with an empty or filled password.

All that work just so hackers can access your server files more easily....
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 08 mai 2021 - 16:05
Hi

Thanks for all of your info!

Yeah I'm on the second case sorry for not being clear like water about that

I have a project that works local using Classic files and when I have WiFi connection I use the C/S files to send the info I want.

Now about the password issue I see

I will keep the automatic encryption if password for all of my files

I will use the HListFile to have all of my files and then if my Classic files using his prefix I will set a password and the C/S ones without password

I know that you recommend me to use password for my C/S files, but if I set those C/S files without a password (but they will have the automatic encryption if password set) will be a bad idea?

Why I don't want C/S files with password?

Well when I consult those files using HFSQL Control Center I access to the data base, then on the list of files I open the files but if this file have a password I need to write it and then I see the data, I don't know if I use a query will need to write the password too.
That's why I don't want to set a password because I need to access on the data right away, also I have a lot of files that will have integrations I know it's super important to have password but if they have the parameter of automatic encryption if password could be save?

There's a way to set a password but HFSQL Control Center doesn't need to write it?
Maybe the answer to this question is using HPass("C/SFile","") not sure about this.
I want to have protection but in the same way have access on the data righ away using the tools of PCSoft

Sorry to be annoying about this
Thanks for all of your time and replys

--
Best Regards
ARV
Posté le 08 mai 2021 - 19:52
nope... not possible

To everything there is a price...

Security means entering the password

Setting an empty password means NO SECURITY WHATSOEVER....

So you have to choose between the chore of entering the password when you need to access data and the being legally responsible when your customer's data is hacked.... I made my choice a long time ago...

Also, -IF- I am in a situation where I have to access the data a lot, I generally just write my OWN data access windows in windev (backoffice), and NOT use the generic tools for anything. This solves the password/security problem easily and allows me to build the exact tools that I need in each specific case and not risking messing up production data if I make amistake in the completely open HF control center.
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 10 mai 2021 - 15:49
Hi Argus

Thank you so much for responding all of my question

I see, well I will think about it much more How I will set everything.

That's all the question I have

Good luck with your projects and developes!

--
Best Regards
ARV