LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Windows credential manager

Solved!
Go to solution

Hi there!

 

Getting to the point, I'm developing an OAuth-based application. The user must indicate an email and a password to log in the application and start it. What I would like to do is to give to the user the possibility to store its credentials in order to don't log in everytime the app is started. My intention is to store the credentials in the Cridentials Manager of Windows, as other applications do, in order to provide certain security level.

 

How can I achieve this in LabVIEW? I have searched .net methods or dlls and I'm not able to find how to do it.

 

Thank you very much for your time and help.

0 Kudos
Message 1 of 6
(334 Views)
Highlighted
Solution
Accepted by Albert_

You want to access CredWriteA() and CredReadA() in Advapi32.dll.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 2 of 6
(282 Views)

First of all, thank you for your quick response and time.

 

I found these functions and I called from the VI, but I don't know how to use it (configuration of the parameters and return and what to provide to the functions). I don't catch the documentation of the function. Also, I have downloaded the SDK of Windows 10 in order to use the 'wincred.h' with the dll import wizard (unsuccesfully).

 

It would be too much to ask for more info or an VI example?

 

Again, thank you very much.

0 Kudos
Message 3 of 6
(240 Views)

This API uses a single structures with embedded pointers. That’s not something the Call Library Wizard can handle as there are to many unclear things that can not be safely determined from the header file alone. It is even so that creating this interface directly on LabVIEW diagram requires more C programming knowledge than writing a wrapper DLL in C which translates between a LabVIEW friendly interface and this API!

 

I don’t have.currently any such code in either flavor available and therefore can’t give you a quick example.

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 4 of 6
(222 Views)
Solution
Accepted by Albert_

I've been doing some work and started of trying to do it all in a LabVIEW diagram but quickly run into trouble that were pretty hard to debug. So I then started up Visual C and did this little library that I attached. It took less time to do it this way and has more functionality than the VI only variant which did no enumeration of the available credentials. And yes it has no documentation, sorry, you'll have to read the according MSDN pages about the CredRead and CredWrite functions to get the nitty gritty details of how it works.

 

For passwords for your own purpose you want to use the Generic type. Domain Passwords are treated speciall for the Windows Domain management.

 

It is a VI library that contains 4 methods.

- Enumerate returns a list of all currently available credentials.

- Read will return the values for a particular credential entry given its Target Name and Type.

- Write will add a new credential entry. You can't modify an existing entry in this way. If you want to do that you first have to delete it.

- Delete will remove a specific credential entry given its Target Name and Type.

 

The LabVIEW VIs are in version 2009 and there is a 32-bit and 64-bit version of the DLL prebuild. The C source code is in a subdirectory inside the archive.

 

 

Rolf Kalbermatter
Averna BV
LabVIEW ArchitectLabVIEW ChampionLabVIEW Instructor
Message 5 of 6
(151 Views)

Wow! Simply amazing! Thank you very much for your help and time.

0 Kudos
Message 6 of 6
(129 Views)