Application:Encrypted Password Database [localised]
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Application:Encrypted Password Database [localised]
Hi All
So many passwords so decided to create a small database to hold them all. The database stores the Service, UserName and Password. All passwords are stored in encrypted form so no clear text available to the casual browser. You can easily change the code to store Service and UserName in encrypted form as well if you wish.
The programme requires a password at startup to run.
Notes on use. You need a main password, this is set to "abc123" in the download, this can be changed using the password encryption programme in this post http://www.purebasic.fr/english/viewtop ... &hilit=key This one you must remember as no password is stored in clear text form anywhere in your programme.
I actualy keep the programme and database on a separate usb stick which I keep with me for extra security. You can as well change the main database password encryption to a different type for more security, I have used the same throughout in the example to ease writing and understanding.
The programme is localised for English, French, German and Italian let me know of any translation messes.
The code is available here:-https://github.com/collectordave/PureBa ... d-Database
Any problems post here.
Enjoy
cd
So many passwords so decided to create a small database to hold them all. The database stores the Service, UserName and Password. All passwords are stored in encrypted form so no clear text available to the casual browser. You can easily change the code to store Service and UserName in encrypted form as well if you wish.
The programme requires a password at startup to run.
Notes on use. You need a main password, this is set to "abc123" in the download, this can be changed using the password encryption programme in this post http://www.purebasic.fr/english/viewtop ... &hilit=key This one you must remember as no password is stored in clear text form anywhere in your programme.
I actualy keep the programme and database on a separate usb stick which I keep with me for extra security. You can as well change the main database password encryption to a different type for more security, I have used the same throughout in the example to ease writing and understanding.
The programme is localised for English, French, German and Italian let me know of any translation messes.
The code is available here:-https://github.com/collectordave/PureBa ... d-Database
Any problems post here.
Enjoy
cd
Last edited by collectordave on Sat Jan 21, 2017 10:48 am, edited 1 time in total.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Encrypted Password Database [localised]
I run the program. I give abc123 for password to continue. I write the info in the text boxes. Then, whatever I press, the "add" button, the "save edits" one, both of them, I never see the password with some way. Passwords.db file has the same CRC as before running the program.
EDIT: I took a look in ecryption procedure. The code runs only if password is <= 32 bytes length. If the users gives a bigger one, should be warned or the program should take care of the big password with some way.
EDIT: I took a look in ecryption procedure. The code runs only if password is <= 32 bytes length. If the users gives a bigger one, should be warned or the program should take care of the big password with some way.
Re: Encrypted Password Database [localised]
Hi,
why you reinvent the wheel
Only a question, sometimes it makes sense, when you want to include it in an other program.
I use keepass (freeware) with many features inside, like
auto typing
cleaning the clipboard
ported also to android, linux, osx
...
http://keepass.info/
Bernd
why you reinvent the wheel

Only a question, sometimes it makes sense, when you want to include it in an other program.
I use keepass (freeware) with many features inside, like
auto typing
cleaning the clipboard
ported also to android, linux, osx
...
http://keepass.info/
Bernd
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Encrypted Password Database [localised]
This code could be part of a much bigger app that supports many things and a password management is needed.infratec wrote:why you reinvent the wheel![]()
I spend time with it because I wanted to see what type of encryption is used. I have a program of mine that uses already 256bit AES encryption and I wanted to see if I could find a better one.
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Encrypted Password Database [localised]
@infratech wrote
Main reason though is that I actually enjoy coding with PureBasic I believe others do too and finding examples written in PureBasic of things I would like to do for me is paramount. So I also post anything I do for others to browse and get ideas.
After an admittedly quick search on the forum I could not find an example of using encryption with an sqlite database. So programmed one. So I do not see it as reinventing the wheel. It is also part of a larger programme. When all is said and done Notepad and separate USB stick is enough for personal passwords.why you reinvent the wheel
Main reason though is that I actually enjoy coding with PureBasic I believe others do too and finding examples written in PureBasic of things I would like to do for me is paramount. So I also post anything I do for others to browse and get ideas.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Encrypted Password Database [localised]
Hi doctorised
My mistake somehow.
Line 266 of winmain.pb should be
Missed username out of that part so no update.
Change that line then run. After adding one password etc it will be displayed. After two or more you can look through them as the navigation buttons are enabled.
regards
cd
My mistake somehow.
Line 266 of winmain.pb should be
Code: Select all
Criteria = "INSERT INTO Service (PDBService,PDBUserName,PDBPassword) VALUES ('" + NewService + "','" + NewUserName + "','" + NewPassword + "');"
Change that line then run. After adding one password etc it will be displayed. After two or more you can look through them as the navigation buttons are enabled.
regards
cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
- doctorized
- Addict
- Posts: 882
- Joined: Fri Mar 27, 2009 9:41 am
- Location: Athens, Greece
Re: Encrypted Password Database [localised]
Now it works. In ClearGadgets(), SetGadgetText(#txtUserName,"") is missing.collectordave wrote:Line 266 of winmain.pb should beCode: Select all
Criteria = "INSERT INTO Service (PDBService,PDBUserName,PDBPassword) VALUES ('" + NewService + "','" + NewUserName + "','" + NewPassword + "');"
-
- Always Here
- Posts: 6426
- Joined: Fri Oct 23, 2009 2:33 am
- Location: Wales, UK
- Contact:
Re: Encrypted Password Database [localised]
Well, you surely do not want to trust your password store/management with freeware, whose developer you know nothing about? One day that app might phone home and hand-over all your details...........why you reinvent the wheel![]()
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
If it sounds simple, you have not grasped the complexity.
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Encrypted Password Database [localised]
Thanks doctorized
Added code to main download including the cleartext bit.
Regards
cd
Added code to main download including the cleartext bit.
Regards
cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: Encrypted Password Database [localised]
Off Topic:
Oh sh.. I use linux which stores my user account and it is freeware... and I never met Linus and the other GNU guys
But maybe it is better to use Windows, because then I know better what they are doing with my account settings, but I paid for it.
Ironic Off
Back to topic:
I wrote that it makes sense if you want to use it in an other program.
But for a standalone app (or better exe) to save my passwords it would be reinventing the wheel.
KeePas is also 'portable' and you can store the file on a USB stick or in your smartphone.
And if you want to be safe, you have also to clean the variables after usage, because else the encrypted stuff is in the memory and can be sniffed.
Bernd
IdeasVacuum wrote:Well, you surely do not want to trust your password store/management with freeware, whose developer you know nothing about? One day that app might phone home and hand-over all your details...........



Oh sh.. I use linux which stores my user account and it is freeware... and I never met Linus and the other GNU guys
But maybe it is better to use Windows, because then I know better what they are doing with my account settings, but I paid for it.
Ironic Off
Back to topic:
I wrote that it makes sense if you want to use it in an other program.
But for a standalone app (or better exe) to save my passwords it would be reinventing the wheel.
KeePas is also 'portable' and you can store the file on a USB stick or in your smartphone.
And if you want to be safe, you have also to clean the variables after usage, because else the encrypted stuff is in the memory and can be sniffed.
Bernd
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Application:Encrypted Password Database [localised]
Updated for PB 5.6B6 same link as above.
Updated functionality as well.
Regards
cd
Updated functionality as well.
Regards
cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: Application:Encrypted Password Database [localised]
After logging into your app the cleartext password (default 'abc123') remains in memory, at least on my quick check in Windows (didn't check other OS). It is not in memory before logging in (it still requires somebody with the password to log in), but for example when a valid user has logged in and then walks away to take a phonecall and a corrupt/malicious employee inserts their USB stick to dump process memory.
-
- Addict
- Posts: 1310
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: Application:Encrypted Password Database [localised]
Cheers keya
I did not destroy or reassign the variable etc after a successfull login.
Fingers crossed it should be fixed now.
Regards
cd
I did not destroy or reassign the variable etc after a successfull login.
Fingers crossed it should be fixed now.
Regards
cd
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: Application:Encrypted Password Database [localised]
You're only overwriting the first 4 bytes though:collectordave wrote:I did not destroy or reassign the variable etc after a successfull login.
Code: Select all
If CheckPassword = MainPassword
CheckPassword = "Bye"
Code: Select all
#MAXPASS=256 ;longest possible/allowed (so attacker cant learn length info)
OpenCryptRandom()
CryptRandomData(@CheckPassword, #MAXPASS) ;overwrite buffer with secure random bytes
sorry dave we can't accept that response hehe, ill PM you shortlyFingers crossed it should be fixed now.
Re: Application:Encrypted Password Database [localised]
Yeah, I prefer homegrown apps for passwords and backup.
I have no doubt that keepass and others are way better than my code, but the same is true of hackers seeking honey pots like keepass/lastpass's hidden servers.
To that end, your critical passwords should never be stored anywhere.
Only save clues to solve them.
I have no doubt that keepass and others are way better than my code, but the same is true of hackers seeking honey pots like keepass/lastpass's hidden servers.
To that end, your critical passwords should never be stored anywhere.
Only save clues to solve them.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum